Skip to content

False positive undefined variable when break-ing out of infinite loop. #9023

@anthonyryan1

Description

@anthonyryan1

Bug report

I'm seeing a false positive undefined when variable is defined immediately before break-ing out of an infinite loop. As far as I can tell, the variable is either defined, or it never escapes the loop.

Code snippet that reproduces the problem

https://phpstan.org/r/257dc500-10c9-43a8-88fc-861bb7be2734

Expected output

The Variable is defined, or the code is still stuck in the infinite loop.

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

PHPStan is helping me decrease the error rate of a mature PHP codebase. I love that the levels allow me to gradually improve things one level at a time. Best thing since set_error_handler().

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions