safe
safe copied to clipboard
Mark pure function by Psalm
https://psalm.dev/articles/immutability-and-beyond#purity
That would be a great idea. Of course, we don't want to do that manually. I guess Psalm has a list of pure PHP functions somewhere in the code. Would you happen to know where it is located?
Just found in https://github.com/vimeo/psalm/tree/master/src/Psalm/Internal/Stubs
@muglug Am I right?
Impure builtin functions are listed here: https://github.com/vimeo/psalm/blob/master/src/Psalm/Internal/Codebase/Functions.php#L280
All others are assumed pure
Excellent! Thanks a lot!
#172
@muglug how do you test your function isCallMapFunctionPure() ? Do you use some selected example that you know are pure or impure, or do you have a more general approach?