Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark pure function by Psalm #141

Open
snapshotpl opened this issue Sep 27, 2019 · 6 comments
Open

Mark pure function by Psalm #141

snapshotpl opened this issue Sep 27, 2019 · 6 comments

Comments

@snapshotpl
Copy link

https://psalm.dev/articles/immutability-and-beyond#purity

@moufmouf
Copy link
Member

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?

@snapshotpl
Copy link
Author

@muglug
Copy link

muglug commented Sep 30, 2019

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

@moufmouf
Copy link
Member

Excellent! Thanks a lot!

@Kharhamel
Copy link
Collaborator

#172

@Kharhamel
Copy link
Collaborator

@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?

maks-rafalko added a commit to infection/infection that referenced this issue Dec 7, 2020
maks-rafalko added a commit to infection/infection that referenced this issue Dec 7, 2020
maks-rafalko added a commit to infection/infection that referenced this issue Dec 8, 2020
maks-rafalko added a commit to infection/infection that referenced this issue Dec 9, 2020
* create mutators

* avaible only string param

* unit tests

* cs-fix

* mutatesNode rule

* coallesce on mutators

* regex only removes carret and dolar

* code format

* riddiculus pretty fix

* Add mutators to schema.json, add more tests, add psalm annotations, add support for all possible delimiters

* Add psalm issues to baseline because thecodingmachine/safe does not support psalm annotations yet

thecodingmachine/safe#141

* Add test with an unpacked array

* Simplify code by using ?? operator

Co-authored-by: bernard.van.der.esch <[email protected]>
Co-authored-by: Bernard van der Esch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants