Skip to content

Regression: never defined variable #14458

@ondrejmirtes

Description

@ondrejmirtes

Bug report

First bad commit phpstan/phpstan-src@52704a4 (PR phpstan/phpstan-src#5386)

The problem is that although $c is defined in an if branch, PHPStan thinks it's never defined on the left side of ?? later in the code.

Code snippet that reproduces the problem

https://phpstan.org/r/1f5824ce-c5b0-4c15-9416-9ed56a2640f4

Expected output

$c might be defined so $c ?? null should not report an error

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions