array_push.rst 581 B

123456789101112131415161718192021222324252627282930313233343536
  1. ===================
  2. Rule ``array_push``
  3. ===================
  4. Converts simple usages of ``array_push($x, $y);`` to ``$x[] = $y;``.
  5. Warning
  6. -------
  7. Using this rule is risky
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Risky when the function ``array_push`` is overridden.
  10. Examples
  11. --------
  12. Example #1
  13. ~~~~~~~~~~
  14. .. code-block:: diff
  15. --- Original
  16. +++ New
  17. <?php
  18. -array_push($x, $y);
  19. +$x[] = $y;
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule sets:
  23. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_
  24. - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_