Skip to content

Commit 24393b4

Browse files
committed
[autoload] Add workaround for phpstan + rector tests co-run to avoid duplicated php-parser loading error
1 parent 366f329 commit 24393b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

build/build-preload.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ final class PreloadBuilder
5555
return;
5656
}
5757
58+
// edge case during Rector tests case, happens when
59+
// 1. phpstan autoload test case is triggered first,
60+
// 2. all php-parser classes are loaded,
61+
if (defined('PHPUNIT_COMPOSER_INSTALL') && class_exists(\PHPStan\Testing\PHPStanTestCase::class, false) && interface_exists(\PhpParser\Node::class, false)) {
62+
return;
63+
}
5864

5965
CODE_SAMPLE;
6066

0 commit comments

Comments
 (0)