Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yarimadam opened this issue Jul 24, 2023 · 5 comments

Comments

@yarimadam
Copy link

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!

@yarimadam yarimadam changed the title Match arm with many conditional expression takes forever to finish analysis starting from 1.10.22 Match arm with many conditional expression causes static analysis forever to finish, starting from 1.10.22 Jul 24, 2023
@mergeable
Copy link

mergeable bot commented Jul 24, 2023

This bug report is missing a link to reproduction at phpstan.org/try.

It will most likely be closed after manual review.

@yarimadam
Copy link
Author

I found which change set causes this: phpstan/phpstan-src@989dd6f

@ondrejmirtes
Copy link
Member

Worked around the performance problem: phpstan/phpstan-src@9adae6c

@yarimadam
Copy link
Author

Thank you very much for your hard work @ondrejmirtes.

@github-actions
Copy link

github-actions bot commented Sep 9, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants