Skip to content

Remove the array long syntax requirement #24396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sroze
Copy link
Contributor

@sroze sroze commented Oct 2, 2017

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ø
License MIT
Doc PR ø

Remove the long-array-syntax rule in the PHP-CS rules to allow usage of short-syntax PHP array for new PRs going to 4.1.

@javiereguiluz
Copy link
Member

I like the idea but I don't like the implementation. If merged, this will make the code use sometimes array(...) and sometimes [...] so the codebase will be inconsistent. It's better to make this change at once in the entire codebase applying PHP-CS-Fixer to all branches.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Oct 2, 2017

👎
we still have to merge 3.4 into 4.0 for some years to come.
I just spent yesterday's afternoon merging 2.7 up to master and loosing my time because we decided to remove all those /** Constructor. */ docblocks.
Fortunately for those, it's a do once job. Here, this will make fabbot fail on any file touched by a PR on 4.1, encouraging ppl to move from array() to [], thus breaking merges every time we do them.
Being consistent is of course also a good argument.

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Oct 2, 2017
@sroze
Copy link
Contributor Author

sroze commented Oct 2, 2017

Following the conversation in #22862, everybody kind of agreed that we should use PHP7+ syntaxes for all new code bases.

@nicolas-grekas I think your point is valid: cases where PRs are just updating existing usage of array() to [] will give merge conflicts for no benefit and if we merge this CS change, they won't be automatically catched by fabbot. What about making clear to contributors not to update existing array() usages but allow them to use [] for new contributions?

@javiereguiluz
Copy link
Member

What about making clear to contributors not to update existing array() usages but allow them to use [] for new contributions?

This won't work in practice. Non-regular contributors don't read the guidelines and don't follow them. This would cause lots of problems.

@sroze
Copy link
Contributor Author

sroze commented Oct 2, 2017

@javiereguiluz but we can't "make this change at once in the entire codebase" until 2018 because 2.7/2.8 have PHP 5.3 (that do not have the short-array syntax) as minimum PHP version.

@nicolas-grekas
Copy link
Member

correct, let's discuss this again in one year.

@chalasr
Copy link
Member

chalasr commented Oct 2, 2017

Closing for now as explained.

@chalasr chalasr closed this Oct 2, 2017
@sroze
Copy link
Contributor Author

sroze commented Oct 2, 2017

👍

@sroze sroze deleted the remove-array-syntax-rule branch October 2, 2017 10:05
sroze added a commit to sroze/symfony that referenced this pull request Oct 3, 2017
sroze added a commit to sroze/symfony that referenced this pull request Oct 23, 2017
sroze added a commit to sroze/symfony that referenced this pull request Oct 23, 2017
sroze added a commit to sroze/symfony that referenced this pull request Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants