-
-
Notifications
You must be signed in to change notification settings - Fork 947
Lost narrowed type from PHPDoc or Psl\Type #11386
Copy link
Copy link
Closed
phpstan/phpstan-src
#4787Description
Bug report
Hello, I've come across this issue a few versions back, when I narrow e.g. an array type using a PHPDoc var annotation (but also using Psl\Type\.. features from azjezz/psl), and passing this to a function I'm using to construct a \Ds\Map of the items the narrowed type is lost.
Hope there is not something I'm missing but it started to occur with v1.11.2, additional assertion inside the mapper function can get rid of the error, but from what it seems the type should be known for phpstan without the assertion.
Code snippet that reproduces the problem
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
Makes me happy every day when I see no errors :)
Reactions are currently unavailable