-
-
Notifications
You must be signed in to change notification settings - Fork 938
Description
Bug report
Getting a value from a big (6500 values in the snippet) const array and using it to access a different similarly sized const array causes PHPStan to take about 70 seconds to analyze the file. I'm fairly sure the affected file in our codebase used to take no significant time to analyse before, but there were some changes to it around the time we updated PHPStan, so I'll check with some older versions of PHPStan to see if it is a regression and update the issue.
EDIT: Doesn't seem like a regression, see times below.
parameters:
level: 8./vendor/bin/phpstan analyse -c phpstan.neon --debug -vvv test.php
# PHPStan v1.8.11
# --- consumed 92 MB, total 128 MB, took 67.74 s
# PHPStan v1.8.2
# --- consumed 74 MB, total 132 MB, took 209.80 s
# PHPStan v1.4.8
# --- consumed 74 MB, total 130 MB (time reports 110.67 s)Code snippet that reproduces the problem
The snippet causes the https://api.phpstan.org/analyse endpoint to return a 502, presumably because of the size, so here's a gist: https://gist.github.com/dpeukert/eadf816dc5cde760c1aa295fc065815e
Expected output
I would expect the analysis to be quicker.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan rocks!