Skip to content

Path in match causes infinite loop ( iterator|int type definition ) #13218

@BinaryKitten

Description

@BinaryKitten

Bug report

I thought this could be down to the Template but it comes down to a 1 path in a match - without it present there is no infinite loop.

This happens in v1.12.27 (currently used in project) as well as on the playground version.

project's phpstan.neon.dist

parameters:
  paths:
    - src

  level: 7

includes:
    - vendor/phpstan/phpstan-mockery/extension.neon

I have performed some checks and it does have some weirdness:

  • is_int branch in match at position 0 = infinite-loop death,
  • is_int branch in match at position 1 = error: Match arm comparison between true and true is always true. on the interator check branch (poisition 2),
  • is_int branch in match at position 2 = error: Match arm comparison between true and true is always true. on the is_int check branch (poisition 2),
  • no is_int branch in match = no errors

Code snippet that reproduces the problem

to see the issue on playground - please uncomment the is_int branch on line 28

https://phpstan.org/r/b98eb911-eb9d-4ad0-b29a-0371c03395d1

Expected output

any errors reported and analyse moves on to next file

Affected Versions

  • v1.12.27
  • current - (assumed as error occurs on playground)

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

PHPStan always helps - has save me endless hours of bug hunting and also saved a huge amount of time during a refactor process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions