Skip to content

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 27, 2025

Rules about unreachable branch was removed in
7d74a63...cc7ff8b

The error doesn't exists anymore
https://phpstan.org/r/788cdf82-69e5-450b-8851-f475793aadcc

I added the test regression to ensure we won't get the following error
https://phpstan.org/r/b888b1ec-063b-49dc-8db8-daa1a0495200

Closes phpstan/phpstan#3761

@ondrejmirtes
Copy link
Member

Please reference the issue with "Closes ..." in the PR description.

@ondrejmirtes
Copy link
Member

Also I don't really get it - playground still reports the error https://phpstan.org/r/b888b1ec-063b-49dc-8db8-daa1a0495200, how could you add a regression test if it still needs fixing?

@VincentLanglet
Copy link
Contributor Author

Also I don't really get it - playground still reports the error phpstan.org/r/b888b1ec-063b-49dc-8db8-daa1a0495200, how could you add a regression test if it still needs fixing?

I edited to change

if($tag instanceof $class){

into

if($tag instanceof NamedTag){

to show what would happen with the previous understanding of PHPStan. (and what message we would have got, and therefor in which testCase i have to put the test)

@VincentLanglet
Copy link
Contributor Author

Please reference the issue with "Closes ..." in the PR description.

Sorry, I forgot, I added the phpstan/phpstan#3761 reference.

@ondrejmirtes ondrejmirtes merged commit c6167ec into phpstan:2.1.x Aug 30, 2025
254 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

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.

class-string variance not respected in instanceof (unless using @template)

2 participants