You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
should also be fixed in str_ireplace, preg_replace while at it - but I guess we will find a solution which is independent of concrete function signatures.
Did PHPStan help you today? Did it make you happy in any way?
Activity
staabm commentedon Oct 21, 2024
I think to implement that, I would need to add
ParameterAcceptor->hasSideEffects(CallLike $callLike): TrinaryLogicor adjust
ParametersAcceptorSelector::selectFromArgsto return a variant without side-effects for such callsondrejmirtes commentedon Oct 21, 2024
I think we'd a new annotation like
@phpstan-pure-unless-parameter-passed.But again, this is not a pressing issue 😊
xPaw commentedon Nov 15, 2024
Not gonna make a separate issue, will just leave here: there's some other methods that aren't considered pure but probably can be?
preg_match, similar_text, sha256
I also noticed it's reporting hash_hmac call as impure, but says "call to function sha256()" (the first argumented to hash)
https://phpstan.org/r/ff33c5fa-38b1-4a30-87ef-6653fda81660
ondrejmirtes commentedon Nov 15, 2024
Make a separate issue please. It doesn't cost anything.
xPaw commentedon Nov 15, 2024
Do you want a separate issue for each of the methods or what? Created #12048 for hashes.
phpstan-bot commentedon Sep 12, 2025
@xPaw After the latest push in 2.1.x, PHPStan now reports different result with your code snippet: