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
Did PHPStan help you today? Did it make you happy in any way?
PHPStan level 4 found a lot of redundant type checks in https://github.com/webonyx/graphql-php. A series of pull requests driven by the analysis lead to a 10-20% performance boost.
The text was updated successfully, but these errors were encountered:
Bug report
See #5841
Code snippet that reproduces the problem
https://phpstan.org/r/f64c26bf-9543-4f57-9024-a415d78b2cd2
Expected output
PHPStan recognizes the narrowing of the type:
However, it does not seem to recognize that
T of string
is covariant toT of int|string
.Separating the generics and doing an ad-hoc union seems to work: https://phpstan.org/r/673e1385-a14a-47b5-9102-a7d3d3e3ce96
Did PHPStan help you today? Did it make you happy in any way?
PHPStan level 4 found a lot of redundant type checks in https://github.com/webonyx/graphql-php. A series of pull requests driven by the analysis lead to a 10-20% performance boost.
The text was updated successfully, but these errors were encountered: