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

if statements with lots of conditions causes phpstan to hang in 0.10.2 #1304

Closed
TRowbotham opened this issue Jul 27, 2018 · 3 comments
Closed

Comments

@TRowbotham
Copy link
Contributor

Summary of a problem or a feature request

If statements with a lot of conditions causes phpstan to hang.

Code snippet that reproduces the problem

I tried to post this on phpstan.org, but it causes the server to return a 500 error when using 0.10.2

<?php
$number = 0;

if ($number === 1000
    || $number === 2000
    || $number === 3000
    || $number === 4000
    || $number === 5000
    || $number === 6000
    || $number === 7000
    || $number === 8000
    || $number === 9000
    || $number === 10000
    || $number === 11000
    || $number === 12000
    || $number === 13000
    || $number === 14000
    || $number === 15000
    || $number === 16000
) {
	
}

This same snippet works perfectly fine when using 0.10.1.
https://phpstan.org/r/32a5a130291074b770f4d67254a0d66c

Expected output

PHPStan should not hang.

@ondrejmirtes
Copy link
Member

Fixed:
f45589b

@szepeviktor
Copy link
Contributor

@ondrejmirtes Thank you.
Could you add a test with the above code that should finish under less than a second?

@ondrejmirtes
Copy link
Member

@szepeviktor These kinds of tests are tricky and brittle, I prefer not to have them. I do some performance testing before stable release.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 19, 2019
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

3 participants