Skip to content

Variable "might not be defined." in if/else block #5805

@eigan

Description

@eigan

Bug report

Variable "might not be defined." even though no path can be taken to end up in that situation.

Code snippet that reproduces the problem

I tried to reproduce the issue I have in the following PR: PHPOffice/PhpSpreadsheet#1785
The commit: eigan/PhpSpreadsheet@f6be129 PHPstan complains that $newStyle is undefined on line 427 (not visible in diff).

https://phpstan.org/r/26e08ed0-6623-4a4c-b96a-866318c4156e

Expected output

No error.

Similar issues

#1016
#5266

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

Yes I love PHPStan <3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions