-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Feature request
I think it is great that PHPStan requires specification of the value type within iterable types. This feature has prevented a lot of bugs and made our codebase much more understandable. It would be great if it could be taken even further: specifying the value type should also be required for nested iterables.
For the following example, PHPStan should complain that the value type for the nested iterable is missing:
/**
* @param array<iterable> $bar
*/
function foo(array $bar): void {}
This should extend all the way down if more levels of nesting are used. While it is increasingly more work to write out nested types, I found that those complex parts of our code are also the most error prone.
Did PHPStan help you today? Did it make you happy in any way?
Just yesterday, I was able to find 2 bugs in our codebase by adding a bunch of array shapes 🎉
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels