Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Oct 23, 2025

@VincentLanglet VincentLanglet marked this pull request as ready for review October 24, 2025 17:33
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet
Copy link
Contributor Author

This issue was more complicated than expected... I'm not against your opinion/review @staabm :)

@VincentLanglet VincentLanglet requested a review from staabm October 29, 2025 21:49
namespace IsSubclassOf;

function (Bar $a, Bar $b, Bar $c, Bar $d) {
if (is_subclass_of($a, Bar::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have a test somewhere for use of is_subclass_of with a final-class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@VincentLanglet VincentLanglet requested a review from staabm October 31, 2025 15:32
@VincentLanglet VincentLanglet force-pushed the isSubClass branch 2 times, most recently from 5aab962 to b37f439 Compare December 5, 2025 15:28
@VincentLanglet
Copy link
Contributor Author

I dunno what to do about the webmozart-assert failure because I don't report anymore

Call to static method Webmozart\Assert\Assert::implementsInterface() with class-string<WebmozartAssertImpossibleCheck\Bar>|WebmozartAssertImpossibleCheck\Bar and 'WebmozartAssertImpossibleCheck\\Bar' will always evaluate to true.

Technically, because a implementsInterface check is called before it's indeed always true.
But strictly looking at the type, calling

class-string<WebmozartAssertImpossibleCheck\Bar>|WebmozartAssertImpossibleCheck\Bar

And currently, phpstan/phpstan-webmozart-assert#194 is showing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHPStan incorrectly narrows type of object after an instanceof check

3 participants