-
Notifications
You must be signed in to change notification settings - Fork 132
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
Update dependency phpstan/phpstan to v2 #1459
Conversation
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.
LGTM: just one question open before we decide to merge
@@ -452,6 +455,7 @@ public function getValue(object|null $object = null): mixed | |||
|
|||
$closure = Closure::bind(fn (string $implementingClassName, string $propertyName): mixed => $implementingClassName::${$propertyName}, null, $implementingClassName); | |||
|
|||
/** @phpstan-ignore-next-line function.alreadyNarrowedType instanceof.alwaysTrue */ |
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.
Are the stubs wrong in phpstan upstream? Or in psalm? 🤔
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.
@ondrejmirtes Can you check please?
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.
/** @phpstan-ignore-next-line function.alreadyNarrowedType instanceof.alwaysTrue */
This ignores everything on the next line, not just those identifiers - you need @phpstan-ignore function.alreadyNarrowedType instanceof.alwaysTrue
.
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.
Alright so PHPStan is complaining that assert($closure instanceof Closure);
. $closure
is what gets returned by Closure::bind
. When it can return null
?
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.
This is according to upstream types: https://www.php.net/manual/en/closure.bind.php
there's a clear : ?Closure
return type there.
Happy to patch PHP upstream, if we manage to demonstrate that there's no nullability there :D
The actual return locations:
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.
Alright, I'm going to return a benevolent union there. It's not going to complain in your case but it's not going to require handling the null either.
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.
@kukulich BTW, happy to iterate over this in future changes: should we move forward with this patch as-is, meanwhile?
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.
@Ocramius Yes, we can :)
Thanks @kukulich! |
No description provided.