Skip to content

Non-final method marked as @phpstan-impure says it is always pure when it could be overridden #12382

@dktapps

Description

@dktapps

Bug report

In the given test case, the dummy() method is explicitly marked as impure, because subclasses may override it to do impure things (this is what I expect them to do).

However, PHPStan 2.x now complains about this annotation because the base class method doesn't do anything impure.

Code snippet that reproduces the problem

https://phpstan.org/r/8f21a11b-7517-4d98-a277-f4f210d063c7

Expected output

No error should be reported. The function & class are non-final.

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions