Skip to content
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

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Conversation

kukulich
Copy link
Collaborator

No description provided.

@kukulich kukulich added the dependencies Pull requests that update a dependency file label Nov 15, 2024
@kukulich kukulich marked this pull request as ready for review November 15, 2024 19:26
Copy link
Member

@Ocramius Ocramius left a 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

src/Reflection/ReflectionProperty.php Outdated Show resolved Hide resolved
@@ -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 */
Copy link
Member

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? 🤔

Copy link
Collaborator Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Member

@Ocramius Ocramius Nov 17, 2024

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:

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius Yes, we can :)

@kukulich kukulich merged commit 598266e into Roave:6.43.x Nov 19, 2024
23 checks passed
@Ocramius
Copy link
Member

Thanks @kukulich!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants