Thanks to visit codestin.com
Credit goes to github.com

Skip to content

False positive remaining after update from 2.1.39 to 2.1.46 #14448

@mind-bending-forks

Description

@mind-bending-forks

Bug report

I updated from phpstan 2.1.39 to 2.1.46. I was able to remove some ignores, because phpstan does a better job of understanding the code. However, I've got one case where some errors remain that I believe to be incorrect.

I've produced an example case that is as minimal as I could that reproduces it, but no doubt someone who understands the issue better could probably make a more concise one.

Code snippet that reproduces the problem

https://phpstan.org/r/e141cb74-c6a7-4689-88ab-fecf67f980db

Expected output

Expect no errors.

Note that the errors only start appearing when the second if block against which an error is recorded is introduced. Commenting out either of the two if blocks against which errors are recorded makes the error on the retained block go away...

... yet the two if blocks apply logic to different array keys and so should not have any impact on the other error block. This is what leads me to suspect a bug somewhere in phpstan.

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

Yes. Appreciative of the continual improvements to the quality and capabilities of this tool, and to the associated documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions