Skip to content
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

Misleading or unexpected error message about incomplete match when not trusting phpdoc #7622

Closed
stof opened this issue Jul 13, 2022 · 2 comments · Fixed by phpstan/phpstan-src#1560

Comments

@stof
Copy link
Contributor

stof commented Jul 13, 2022

Bug report

When using a union of class constants as argument and not marking phpdoc types as certain, phpstan complains about the last matched case not being handled.

Code snippet that reproduces the problem

https://phpstan.org/r/7c5c6bcc-0753-475b-a612-46d8f012ae6f

Expected output

No error should be reported. Or if an error is reported due to not being certain, it should talk about other strings, not about the last case (that is handled)

Did PHPStan help you today? Did it make you happy in any way?

Helping a lot.

@Seldaek
Copy link
Contributor

Seldaek commented Jul 22, 2022

Came here to report the same thing :)

Looks like really the same problem, error here:

https://phpstan.org/r/eda3117d-6a9e-4730-8757-8024376c2c0d

If you turn on "Treat PHPDoc types as certain" the error goes away.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants