Skip to content

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

Closed

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

Activity

  1. changed the title [-]Variable "might not be defined."[/-] [+]Variable "might not be defined." in if/else block[/+] on Oct 19, 2021
  2. added this to the Dependent types milestone on Jan 31, 2022
  3. github-actions commented on Jan 3, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  4. locked as resolved and limited conversation to collaborators on Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions