-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DisableConstructorPatch: make optional constructor parameters nullable explicitly #632
Conversation
2e0f1c9
to
07cfbb9
Compare
@@ -55,6 +56,16 @@ public function apply(ClassNode $node) | |||
\assert($constructor !== null); | |||
foreach ($constructor->getArguments() as $argument) { | |||
$argument->setDefault(null); | |||
if (\PHP_VERSION_ID < 80400) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest doing that for all versions instead, to avoid different behavior between PHP versions (making a type explicitly nullable is supported on PHP 7.1+, which covers more than our target versions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
$types = $argument->getTypeNode()->getNonNullTypes(); | ||
if ([] == $types || ['mixed'] == $types) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use strict comparisons here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
07cfbb9
to
1442852
Compare
Implicitly nullable types are deprecated in PHP 8.4
1442852
to
731031d
Compare
#633 should fix the CI (cs fixer + phpstan) |
This should receive the PHP 8.4 label |
This PR tries to fix #625 (comment)