Skip to content

Regression: maybe undefined variable #14269

Closed

Description

@ondrejmirtes

Bug report

First bad commit: phpstan/phpstan-src@0c740e396c
Worked on: phpstan/phpstan-src@ea5f10aaac

Code snippet that reproduces the problem

https://phpstan.org/r/44b5311c-87bb-4512-801b-5d49c52a91b1

Expected output

Variable is defined for sure, it's assigned when !$package->isMultiDay() and that condition is repeated inside the foreach.

Problem goes away when we remove the assign to $availableIntervals on line 52 (which is completely unrelated to the code above but still causes this problem).

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

No response

Activity

  1. added this to the Easy fixes milestone on Mar 12, 2026
  2. phpstan-bot commented on Mar 12, 2026

    @phpstan-bot
    Contributor

    Closed via merging phpstan/phpstan-src#5208

  3. github-actions commented on Apr 13, 2026

    @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 Apr 13, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions