Skip to content

"Call to function property_exists() with <non-final class> and <property-name> will always evaluate to false" in PHP 8.2 #8474

@spawnia

Description

@spawnia

Bug report

PHPStan is overly eager in determining a call to propery_exists() always returns false in PHP 8.2
when a class does not define a property itself - however its children might define the property.
In case of a final class, the result of property_exists() is indeed fixed.

I believe this change has been introduced due to the deprecation of dynamic properties in PHP 8.2, thus PHPStan
is behaving differently there.

Code snippet that reproduces the problem

https://phpstan.org/r/041cd047-46fc-4250-847f-9bcc62a98c0f

Expected output

No error in the linked snippet, the code works as written (and property_exists() does return different results): https://3v4l.org/3pFPb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions