-
Notifications
You must be signed in to change notification settings - Fork 112
Description
I have a strange issue that I cannot reproduce in CI: PHPStan execution does not end locally, it gets stuck at a certain code point (see example below) and runs until PHP timeout occurs after 300 seconds.
Usually my Symfony 6.4 app is analyzed in ~ 15 seconds, but with a recent code change on my end (a Doctrine subselect was added) it doesn't end, CPU is at 100% and RAM usage increases constantly (after 20 seconds its at 6GB+).
I use a Macbook M3 and tried PHP 8.1 and 8.3 with same results.
This code runs without issue in a GitHub action (Ubuntu latest with PHP 8.1 / 8.2 / 8.3).
PHPStan is installed in the project.
Composer packages are the same, all PHPstan configs are fetched from phpstan.neon.
The code is the same locally and in CI, besides the minor version of PHP.
Thats the code triggering the problem:
$qb = $this->createQueryBuilder('tag');
$qb1 = $this->getEntityManager()->createQueryBuilder();
$qb1->from(Timesheet::class, 't')->select('COUNT(tags)')->innerJoin('t.tags', 'tags')->where('tags.id = tag.id');
$qb->select('tag.id, tag.name, tag.color, tag.visible');
$qb->addSelect('(' . $qb1->getDQL() . ') as amount'); <= this here causes the endless loopIf I remove the last line (the getDQL() subselect), the issue goes away.
I tried to lower the Doctrine package, tried to lower the level from 9 to 4 and removed the bleeding-edge rules:

Do you have any idea where/how I could investigate what is going on?