Skip to content

Incorrect "variable might not be defined" #821

Closed

Description

Activity

  1. ondrejmirtes commented on Feb 10, 2018

    @ondrejmirtes
    Member

    Yes, this is currently not covered. You can add a simple else with some throw new ShouldNotHappenException or return; if it's a blocker for you 😊

  2. muglug commented on Feb 12, 2018

    @muglug
    Contributor

    I think the problem is more just incorrect user code than anything else – that elseif is unnecessary given the strict check. PHPStan understands the type of $a in the else branch:
    https://phpstan.org/r/13537686e551ba11a457afaaae89d98e

  3. mhujer commented on Feb 12, 2018

    @mhujer
    ContributorAuthor

    @muglug I know that the code can be rewritten to pass PHPStan check. On the other hand, it is a real
    world code that works properly, so PHPStan should (and can) understand it.

  4. ondrejmirtes commented on Jan 12, 2019

    @ondrejmirtes
    Member

    This is fixed.

  5. ondrejmirtes commented on Mar 25, 2019

    @ondrejmirtes
    Member
  6. locked as resolved and limited conversation to collaborators on Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions