-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace old array() syntax with new [] #898
Conversation
I don't know, I like it like it is, I don't like the new syntax (reminds me of Javascript too much, and is a pain to write on Mac rather than the classic syntax). |
84e96bb
to
e581428
Compare
It's true that the old syntax is "prettier", however IMO it's just a matter of habit. |
@Pierstoval Why does it pain for you to write new array syntax on Mac? Almost any application is written with PHP and JS, so to have the same syntax is more readable IMHO. |
It's a matter of taste, I won't blame anyone for using it, but I personally don't like it because on mac I always confound |
We don't use the new sytax in symfony/symfony just to ease merging. But we can easily use it in symfony-standard. 👍 |
But there's no reason to throw a warning: the "old" syntax hasn't been deprecated or anything. The only issue would be mixing both syntaxes.
Symfony can be used as a full stack framework with PHP and javascript mixed, but that's not the only usage. It can also be used to create APIs where you wouldn't have any javascript. It could be used in many ways where you wouldn't have javascript. Also there's no way to know which usage is the most prevalent.
I agree. It doesn't matter which one we use as long as we're consistent everywhere. |
@gnugat It means that I need to use old syntax in my project if I want to be consistent with Symfony SE for now. But why I should do it? The main benefit of new array syntax is that it's shorter than old syntax. So why don't use it if we can. |
/** | ||
* @var ClassLoader $loader | ||
/* | ||
* @var ClassLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes should be reverted to actually work in IDEs. fabbot.io is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, reverted.
e581428
to
3b31fd2
Compare
We could use new array syntax based on the fact that Symfony 3 require PHP >=5.5.9
3b31fd2
to
e65402b
Compare
It's all about standards. Php-fig and PSRs were created in order to simplify writing "beautiful" (rather than "good") PHP applications, and having standards for coding is better to avoid one developer to use tabs instead of spaces, or a developer wanting to put opening brackets in the same line as the declaration, or in the following line. For 20 years (exaggerating ? :p ) we wrote |
I don't care about this as it dos not really matter whether or not we use the short syntax (people could also change these few occurrences on their own if they feel disturbed by it). |
Thank you @bocharsky-bw. |
This PR was submitted for the master branch but it was merged into the 3.0 branch instead (closes #898). Discussion ---------- Replace old array() syntax with new [] We could use a new array syntax `[]` based on the fact that Symfony 3 require PHP `>=5.5.9` Commits ------- f5b1ae8 Replace old array() syntax with new []
We could use a new array syntax
[]
based on the fact that Symfony 3 require PHP>=5.5.9