no_unreachable_default_argument_value.rst 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ==============================================
  2. Rule ``no_unreachable_default_argument_value``
  3. ==============================================
  4. In function arguments there must not be arguments with default values before
  5. non-default ones.
  6. Warning
  7. -------
  8. Using this rule is risky
  9. ~~~~~~~~~~~~~~~~~~~~~~~~
  10. Modifies the signature of functions; therefore risky when using systems (such as
  11. some Symfony components) that rely on those (for example through reflection).
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. .. code-block:: diff
  17. --- Original
  18. +++ New
  19. <?php
  20. -function example($foo = "two words", $bar) {}
  21. +function example($foo, $bar) {}
  22. Rule sets
  23. ---------
  24. The rule is part of the following rule sets:
  25. - `@PER-CS1.0:risky <./../../ruleSets/PER-CS1.0Risky.rst>`_
  26. - `@PER-CS2.0:risky <./../../ruleSets/PER-CS2.0Risky.rst>`_
  27. - `@PER:risky <./../../ruleSets/PERRisky.rst>`_
  28. - `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_
  29. - `@PSR12:risky <./../../ruleSets/PSR12Risky.rst>`_
  30. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_