Skip to content

Oscillating boolean is "always false" #8621

@phinor

Description

@phinor

Bug report

A negated Boolean in a loop is used to oscillate between true and false on each iteration of the loop. PHPStan claims the expression is always false. This causes subsequent false positives in conditionals.

Code snippet that reproduces the problem

https://phpstan.org/r/7fffa805-d6b5-4397-a927-9b651294c76d

Expected output

No error.

The loop will ensure that the value changes on each iteration.

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

I love this tool!

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