You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all of the PSR/PER code examples show using PHP short array syntax $thing = [];. PRs (ex: #18) also use short array syntax $arr = ['a' => 'A', 'b' => 'B', 'c' => 'C'];. There is no rule though requiring short array syntax.
The short array syntax was adopted for good reasons. According to the RFC:
Good for framework development when dealing with long parameterlists
Other web languages have similar syntax
Readable
Scouring Github repositories, PHP short array syntax is very prevalent in popular PHP frameworks. Using the old syntax $thing = array(...); is relatively rare. Most occurrences are in old repositories or in conversion from old to short syntax tools.
Would creating a PR for adding a MUST use short array syntax section be welcomed?
The text was updated successfully, but these errors were encountered:
After mulling over it and talking with others about arrays and their ambiguity within the coding styles, I created an alternative pull request #48 that is an either-or with #47.
PR 47 is smaller scoped and leaves some aspects not clarified. PR 48 clarifies the uses and declarations for arrays.
Currently all of the PSR/PER code examples show using PHP short array syntax
$thing = [];
. PRs (ex: #18) also use short array syntax$arr = ['a' => 'A', 'b' => 'B', 'c' => 'C'];
. There is no rule though requiring short array syntax.The short array syntax was adopted for good reasons. According to the RFC:
Scouring Github repositories, PHP short array syntax is very prevalent in popular PHP frameworks. Using the old syntax
$thing = array(...);
is relatively rare. Most occurrences are in old repositories or in conversion from old to short syntax tools.Would creating a PR for adding a MUST use short array syntax section be welcomed?
The text was updated successfully, but these errors were encountered: