PHPStan and psalm doesn't handle iterable templates the same way #5484
-
I'm trying to remove the option
from my config. And I'm getting an issue with the following example. https://phpstan.org/r/6bf76fee-b55d-4177-81a0-e49fd5e6a6f0 Because the
But if I solve it with
If a Since,
Dunno which strategy is better, but I think some consistency should be added to avoid this situation. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
You can get rid of this problem if you specify the generic types of \IteratorAggregate and other extended interfaces: https://phpstan.org/r/aa5bc715-e1ad-460c-9f39-1b0c09546f47 Neither tool should have a problem with that. |
Beta Was this translation helpful? Give feedback.
-
Either fix it, as suggested by @ondrejmirtes, or stub it. |
Beta Was this translation helpful? Give feedback.
You can get rid of this problem if you specify the generic types of \IteratorAggregate and other extended interfaces: https://phpstan.org/r/aa5bc715-e1ad-460c-9f39-1b0c09546f47
Neither tool should have a problem with that.