Skip to content

Add non regression test for 3761 #4176

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

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.

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