Skip to content

Add regression test for #12820 - #6836

Merged
staabm merged 1 commit into
phpstan:2.3.xfrom
Amoifr:regression-test-12820
Oct 25, 2026
Merged

staabm merged 1 commit into
phpstan:2.3.xfrom
Amoifr:regression-test-12820

Conversation

@Amoifr

@Amoifr Amoifr commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Closes phpstan/phpstan#12820

Regression test for the method.notFound false positive with @phpstan-assert-if-true static<A> $this, as asked by @staabm. The data file is the snippet from the issue (playground), namespaced and marked // lint >= 8.0 for the union types.

The test fails on acd0511 with the exact error from the issue (Call to an undefined method (T of Bug12820\A = …)|T of Bug12820\B = …::a()) and passes from 0fb1068 ("Give a generic static type a class reflection with its type arguments") on, which is the commit that fixed it.

The full suite passes locally on PHP 8.5.

@staabm staabm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you

@staabm
staabm merged commit ff70090 into phpstan:2.3.x Oct 25, 2026
717 checks passed
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.

False positive method.notFound when using @phpstan-assert-if-true static<A> $this

2 participants