Skip to content

Cover dynamic static calls in tests#5009

Merged
staabm merged 4 commits intophpstan:2.1.xfrom
staabm:tests
Feb 20, 2026
Merged

Cover dynamic static calls in tests#5009
staabm merged 4 commits intophpstan:2.1.xfrom
staabm:tests

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Feb 20, 2026

lets add coverage for this scenario with more basic classes which do not depend on phpversion (like DateTimeImmutable via phpstorm stubs)

@staabm staabm marked this pull request as ready for review February 20, 2026 16:31
@phpstan-bot
Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

Comment on lines +33 to +34
$finalFoo::doFoo(); // could be "Call to static method .. on a separate line has no effect", because final class
$bar::finalFoo(); // could be "Call to static method .. on a separate line has no effect", because final method
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.

I'm not sure to understand the PR.
Is it worth covering this with a test with missing expectation ?

Or do you plan fixing this in the next PR ? (Then should it fix in the same ?)

Copy link
Copy Markdown
Contributor Author

@staabm staabm Feb 20, 2026

Choose a reason for hiding this comment

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

the PR is asserting the current state of things so we see when we change existing behaviour.

I think the possible

"Call to static method .. on a separate line has no effect"

are hardly useful, but they would not be wrong when they start to appear. (for 2 of the 3 examples)

@staabm staabm merged commit e89f78e into phpstan:2.1.x Feb 20, 2026
379 of 382 checks passed
@staabm staabm deleted the tests branch February 20, 2026 22:14
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.

3 participants