no_unreachable_default_argument_value.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. @PHP80Migration:risky
  26. Using the `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_ rule set will enable the ``no_unreachable_default_argument_value`` rule.
  27. @PSR12:risky
  28. Using the `@PSR12:risky <./../../ruleSets/PSR12Risky.rst>`_ rule set will enable the ``no_unreachable_default_argument_value`` rule.
  29. @PhpCsFixer:risky
  30. Using the `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_ rule set will enable the ``no_unreachable_default_argument_value`` rule.