Skip to content

Match arm with many conditional expression causes static analysis forever to finish, starting from 1.10.22 #9676

@yarimadam

Description

@yarimadam

Bug report

Hello!

Starting from version 1.10.22 (no issue in 1.10.21 and below) a weird problem started to appear in one of our projects.

It takes forever to finish static analysis in a PHP file containing a match expression where a single match arm consists of many conditional expressions.

Sharing a snippet from the playground is not possible because of the error. So I created a gist instead.

I am using the following command prompt to perform the static analysis:

./vendor/bin/phpstan analyse --level 3 --memory-limit=2G phpstan_analysis_bug.php

Code snippet that reproduces the problem

https://gist.github.com/yarimadam/1e4cb2fd27cc9a63d2a18a057ba0f3b6

Expected output

The static analysis would finish quickly.

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

Yes, every day!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions