Open ohader opened 3 years ago
I found these snippets:
This would be very useful, mainly because it was deprecated in PHP 8: Deprecate required parameters after optional parameters in function/method signatures
To be discussed: I'm not actually sure it should be the role of Psalm to report this.
It seems to me that code style rules are perfectly equipped to enforce this kind of things
To people working on legacy projects, Rector has a rule to fix this: OptionalParametersAfterRequiredRector
I'm not actually sure it should be the role of Psalm to report this.
It seems to me that code style rules are perfectly equipped to enforce this kind of things
This is not code styling, this is actual code that due to the deprecation will behave differently than stated.
function test($foo = null, $bar) {
return $bar;
}
test(bar: 6); // error: $foo is required
This reads like it should work, but it acutally does not.
https://psalm.dev/r/82728ccc0b
It would be great if Psalm could report this issue (similar to https://www.jetbrains.com/help/phpstorm/php-optional-before-required-parameter.html).