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
Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.
This PR was merged into the 2.17-dev branch.
Discussion
----------
ArrayPushFixer - introduction
```
possum@aquarium:/home/possum/work/PHP-CS-Fixer$ php php-cs-fixer describe array_push
Description of array_push rule.
Converts simple usages of ``array_push($x, $y);`` to ``$x[] = $y;``.
Fixer applying this rule is risky.
Risky when the function `array_push` is overridden.
Fixing examples:
* Example #1.
```
```diff
--- Original
+++ New
@@ -1,2 +1,2 @@
<?php
-array_push($x, $y);
+$x[] = $y;
```
closes#3483
Commits
-------
4400ea5 ArrayPushFixer - introduction
Source: https://secure.php.net/manual/en/function.array-push.php
I think this fixer may be risky because there is a change in behaviour:
The text was updated successfully, but these errors were encountered: