safe icon indicating copy to clipboard operation
safe copied to clipboard

Use Psalm templated stubbed functions?

Open muglug opened this issue 5 years ago • 1 comments

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.

muglug avatar Jan 01 '20 20:01 muglug

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?

Kharhamel avatar Jan 06 '20 12:01 Kharhamel