Skip to content

Dependent variables not working if dependency referenced in another condition #5401

@brandonkelly

Description

@brandonkelly

Bug report

Dependent variable support (added in 0.12.64) dosen’t work properly if the variable used in the dependency condition is referenced in an additional condition before the dependent variable check kicks in.

Code snippet that reproduces the problem

Here’s two simple examples:

Expected output

There shouldn’t be any reported errors here.

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

I was prepared to have to start refactoring all the places where we are using dependent variables to make PHPStan happy, and was pleasantly surprised to find that there’s some basic support for it already!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions