Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule no_unreachable_default_argument_value

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


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).


Example #1

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

Rule sets

The rule is part of the following rule sets:


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.