Skip to content

NumberComparisonOperatorsConstantConditionRule reports false positive when array_shift is used inside loop #6013

@jaylinski

Description

@jaylinski

Bug report

NumberComparisonOperatorsConstantConditionRule reports false positive when array_shift is used inside loop.

I also wrote a failing test for it, because I wanted to check if 'array_values' => ['hasSideEffects' => true] fixes the issue (it doesn't).

Code snippet that reproduces the problem

https://phpstan.org/r/70279418-da71-42a7-bfa1-df63a25dbaf9

Expected output

Issue is reported incorrectly. The executed code prints 123.

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions