implode_call.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. =====================
  2. Rule ``implode_call``
  3. =====================
  4. Function ``implode`` must be called with 2 arguments in the documented order.
  5. Warning
  6. -------
  7. Using this rule is risky
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Risky when the function ``implode`` is overridden.
  10. Examples
  11. --------
  12. Example #1
  13. ~~~~~~~~~~
  14. .. code-block:: diff
  15. --- Original
  16. +++ New
  17. <?php
  18. -implode($pieces, '');
  19. +implode('', $pieces);
  20. Example #2
  21. ~~~~~~~~~~
  22. .. code-block:: diff
  23. --- Original
  24. +++ New
  25. <?php
  26. -implode($pieces);
  27. +implode('', $pieces);
  28. Rule sets
  29. ---------
  30. The rule is part of the following rule sets:
  31. - `@PHP74Migration:risky <./../../ruleSets/PHP74MigrationRisky.rst>`_
  32. - `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_
  33. - `@PHP82Migration:risky <./../../ruleSets/PHP82MigrationRisky.rst>`_
  34. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_
  35. - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_
  36. References
  37. ----------
  38. - Fixer class: `PhpCsFixer\\Fixer\\FunctionNotation\\ImplodeCallFixer <./../../../src/Fixer/FunctionNotation/ImplodeCallFixer.php>`_
  39. - Test class: `PhpCsFixer\\Tests\\Fixer\\FunctionNotation\\ImplodeCallFixerTest <./../../../tests/Fixer/FunctionNotation/ImplodeCallFixerTest.php>`_
  40. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.