Open muglug opened 4 years ago
Yes good idea.
However there is no way to automatically know which functions needs a template, so we need to get it from a documentation. Right now, the project can use the regular php doc or phpstan stubs. We would need to change the type generation (again) to use psalm stubs.
Integrating more psalm features in general is something I want to do. I think I will try to do that after #172, unless you want to try?
Psalm has a list of templated functions here:
https://github.com/vimeo/psalm/blob/master/src/Psalm/Internal/Stubs/CoreGenericFunctions.php
The big benefit of those is that they allow static analysis to figure out what's happening in a bunch of common cases, without the need for extra plugins – with Psalm's
@param-out
annotation the type of by-reference arrays can be easily inferred.Where those are available, you could use them instead of the functionmap versions.