phpstan-doctrine
phpstan-doctrine copied to clipboard
getResult() should return a list, not an array
When using listType: true feature toggle from bleeding edge, and using the list<*> type as the return type of a repository method that returns the result of getResult(), we have an error Method MyRepository::myMethod() should return list<*> but returns array<*>.
In DQL, any query that does not use INDEX BY returns a list I think, so better be more precise :)
Note that this must not always return a list (which is what was done and reverted in 1.3.31). It must be done based on the analysis of the query.