1.2.695. Mismatch Parameter Name¶
Parameter name change in overwritten method. This may lead to errors when using PHP 8.0 named arguments.
PHP use the name of the parameter in the method whose code is executed. When the name change between the method and the overwritten method, the consistency is broken.
Here is another example, in early PHP 8.0 (courtesy of Carnage).
<?php
class x {
function getValue($name) {}
}
class y extends x {
// consistent with the method above
function getValue($name) {}
}
class z extends x {
// inconsistent with the method above
function getValue($label) {}
}
?>
1.2.695.1. Connex PHP features¶
1.2.695.1.1. Suggestions¶
Make sure all the names are the same, between methods
1.2.695.1.2. Specs¶
Short name |
Functions/MismatchParameterName |
Rulesets |
|
Exakat since |
2.1.8 |
PHP Version |
With PHP 8.0 and older |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |