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
In PHP 8.3 it is now possible to add types to class constants. However, when using a namespaced enum type, e.g. one imported from another file, the inferred type reported by PHPStan seems to be incorrect when evaluating the type of the constant, causing a mismatch about constants not accepting a value. See also the snippet.
14 | Constant X\HelloWorld::C (Foo) does not accept value X\Foo::Bar. Non-ignorable
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
It's great that PHPStan is already so up-to-date with new PHP 8.3 syntax and ready to use for most cases! That makes me feel a lot more secure about code stability after upgrading my applications to the new version. Thanks!
The text was updated successfully, but these errors were encountered:
Bug report
In PHP 8.3 it is now possible to add types to class constants. However, when using a namespaced enum type, e.g. one imported from another file, the inferred type reported by PHPStan seems to be incorrect when evaluating the type of the constant, causing a mismatch about constants not accepting a value. See also the snippet.
Code snippet that reproduces the problem
https://phpstan.org/r/46a1d296-5f74-44d0-a5de-a2dd4ba1ff7c
outputs
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
It's great that PHPStan is already so up-to-date with new PHP 8.3 syntax and ready to use for most cases! That makes me feel a lot more secure about code stability after upgrading my applications to the new version. Thanks!
The text was updated successfully, but these errors were encountered: