Skip to content

str_replace considered impure #11884

@staabm

Description

@staabm

Feature request

str_replace could be considered pure, when the by-ref parameter is not passed.

https://phpstan.org/r/6d607859-e782-47bf-8da3-a6ba95bae922
I would expect no error in this snippet.

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?

finds bugs every day - you know that ;)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions