Having IteratorAggregate with generics messes up types #4415
-
|
Hi, didn't want to flush this out as a bug right away, but I find the behavior somewhat strange. Consider the following code: Some generics floating around, everything works fine. True, you will receive an error that you didn't specify the type for the value. But I have? Ok fine, maybe adding the But the most thing that is bothering me: Why is |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
The correct native return typehint for With |
Beta Was this translation helpful? Give feedback.
-
|
FYI @icanhazstring I had to break your use-case in order to fix another thing (phpstan/phpstan-src@1256192). The recommended approach is to change |
Beta Was this translation helpful? Give feedback.
FYI @icanhazstring I had to break your use-case in order to fix another thing (phpstan/phpstan-src@1256192). The recommended approach is to change
getIterator()native type to\Traversable, or to supply@param \Iterator<int, string>in the PHPDoc abovegetIterator(). Thanks for understanding.