-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
Currently introducing PHPStan to a larger Laminas project (already using slam/phpstan-laminas-framework), when generating the baseline one entry is:
-
message: "#^Cannot access offset 'grpc' on 'https\\://…'\\|'https\\://…'\\|\\(array\\<int\\|\\(literal\\-string&non\\-falsy\\-string\\), 0\\|0\\.25\\|0\\.66\\|1\\|3\\|5\\|10\\|14\\|15\\|20\\|29\\|50\\|60\\|73\\|74\\|75\\|76\\|79\\|80\\|99\\|100\\|123\\|124\\|260\\|300\\|500\\|600\\|660\\|1000\\|2000\\|3600\\|4000\\|9002\\|10000\\|11211\\|24575\\|''\\|'/'\\|'/api/v1/'\\|'/api/v2/'\\|'/api/v3/'\\|'/backup/…'\\|'/collect'\\|'/overload_fp\\.html'\\|'/var/www/bigassets…'\\|'/var/www/…'\\|'/var/www/…'\\|'/var/www/|false\\.|HERE THE REGEX CONTINUES FOR VERY LONG$#"
count: 3
path: ../../../module/src/MyService.phpI already shortened the line. The original line in the baseline is 60733 characters long.
Running phpstan analyse with that baseline results in
In Strings.php line 447:
[_PHPStan_156ee64ba\Nette\Utils\RegexpException]
Compilation failed: regular expression is too large at offset 53891 in pattern: #^Cannot access offset 'grpc' on 'https\://…'\|'https\://…'\|\(array<int\|\(literal\-string...HERE THE LONG REGEX IS LISTED FROM BASELINE
Exception trace:
at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Strings.php:447
_PHPStan_156ee64ba\Nette\Utils\Strings::_PHPStan_156ee64ba\Nette\Utils\{closure}() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Callback.php:63
_PHPStan_156ee64ba\Nette\Utils\Callback::_PHPStan_156ee64ba\Nette\Utils\{closure}() at n/a:n/a
preg_match() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Callback.php:70
_PHPStan_156ee64ba\Nette\Utils\Callback::invokeSafe() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Strings.php:448
_PHPStan_156ee64ba\Nette\Utils\Strings::pcre() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Strings.php:410
_PHPStan_156ee64ba\Nette\Utils\Strings::match() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/IgnoredError.php:47
PHPStan\Analyser\IgnoredError::shouldIgnore() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/IgnoredErrorHelperResult.php:83
PHPStan\Analyser\IgnoredErrorHelperResult->PHPStan\Analyser\{closure}() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/IgnoredErrorHelperResult.php:139
PHPStan\Analyser\IgnoredErrorHelperResult->PHPStan\Analyser\{closure}() at n/a:n/a
array_filter() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/IgnoredErrorHelperResult.php:168
PHPStan\Analyser\IgnoredErrorHelperResult->process() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php:120
PHPStan\Command\AnalyseApplication->analyse() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php:200
PHPStan\Command\AnalyseCommand->execute() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php:259
_PHPStan_156ee64ba\Symfony\Component\Console\Command\Command->run() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php:870
_PHPStan_156ee64ba\Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php:261
_PHPStan_156ee64ba\Symfony\Component\Console\Application->doRun() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php:157
_PHPStan_156ee64ba\Symfony\Component\Console\Application->run() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:124
_PHPStan_156ee64ba\{closure}() at phar:///var/www/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:125
require() at /var/www/vendor/phpstan/phpstan/phpstan:8
include() at /var/www/vendor/bin/phpstan:119The line in code that triggers this error is:
$config = $this->serviceManager->get('config');
$hostname = $config['...']['grpc']['hostname'];
$grpcOptions = $config['...']['grpc']['options'];
$channel = $config['...']['grpc']['channel'];This issue only happens when using the baseline. If I have an empty baseline, generate it new - it runs perfectly. But after generation trying to re-run I get the above posted issue.
I tried reproducing the issue in the playground, but the playground crashes. The code used can be found here (could not post it in the issue).
Code snippet that reproduces the problem
No response
Expected output
PHPStan doesn't crash parsing baselines it previously generated.
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels