Skip to content

False positive access violations when accessing non-public parent class members from conditionally-defined subclasses #5639

@gnarlyquack

Description

@gnarlyquack

Bug report

When there are multiple/duplicate subclass definitions which are conditionally defined, it appears that analysis of class definitions after the initial one gets confused about allowed visibility access. Probably clearest to just look at the code snippet. This was not a problem in previous versions of PHPStan.

Code snippet that reproduces the problem

https://phpstan.org/r/433658a8-90bf-4e5e-b3da-a1203f729946

Expected output

No error

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions