You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Covariant false-positive with lower case string union #11835
We started getting errors with the linked code after updating from 1.12.5 => 1.12.6. It seems like some of the recent work on lowercase-string might be the issue? Using string as opposed to non-falsy-string results in a bit more description with a lower-case string union:
@@ @@-37: Method ProjectionCumulativeHeadersResolver::resolve() should return Collection<int, non-falsy-string> but returns Collection<int, non-falsy-string>.+37: Method ProjectionCumulativeHeadersResolver::resolve() should return Collection<int, non-falsy-string> but returns Collection<int, lowercase-string&non-falsy-string>.
Full report
Line
Error
37
Method ProjectionCumulativeHeadersResolver::resolve() should return Collection<int, non-falsy-string> but returns Collection<int, lowercase-string&non-falsy-string>.
Activity
ondrejmirtes commentedon Oct 12, 2024
/cc @VincentLanglet I'm not asking you to fix this problem, that's not easy, but VerbosityLevel should set the correct level so that this error message also includes
lowercase-string: https://phpstan.org/r/8ae98159-3199-4b9a-8b74-aed8354f8533As a workaround for this issue unfortunately you need to repeat the type in
@var: https://phpstan.org/r/a9e347e3-a37c-4b36-87d0-13d299ff88b0VincentLanglet commentedon Oct 12, 2024
Can also be solved this way https://phpstan.org/r/a938a60a-1326-4261-887d-4e02e77daac6
I'll see what can I do for the Verbosity.
phpstan-bot commentedon Oct 13, 2024
@calebdw @ondrejmirtes After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
Method ProjectionCumulativeHeadersResolver::resolve() should return Collection<int, non-falsy-string> but returns Collection<int, lowercase-string&non-falsy-string>.Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
Add regression tests for issues fixed by unresolved template arguments
github-actions commentedon Oct 9, 2026
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.