Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.16 KB

no_unreachable_default_argument_value.rst

File metadata and controls

40 lines (28 loc) · 1.16 KB

Rule no_unreachable_default_argument_value

In function arguments there must not be arguments with default values before non-default ones.

Warning

Using this rule is risky.

Modifies the signature of functions; therefore risky when using systems (such as some Symfony components) that rely on those (for example through reflection).

Examples

Example #1

--- Original
+++ New
 <?php
-function example($foo = "two words", $bar) {}
+function example($foo, $bar) {}

Rule sets

The rule is part of the following rule sets:

@PHP80Migration:risky
Using the @PHP80Migration:risky rule set will enable the no_unreachable_default_argument_value rule.
@PSR12:risky
Using the @PSR12:risky rule set will enable the no_unreachable_default_argument_value rule.
@PhpCsFixer:risky
Using the @PhpCsFixer:risky rule set will enable the no_unreachable_default_argument_value rule.