diff --git a/build/build-preload.php b/build/build-preload.php index de87adabbbc..9f460325fd3 100755 --- a/build/build-preload.php +++ b/build/build-preload.php @@ -61,18 +61,11 @@ final class PreloadBuilder // edge case during Rector tests case, happens when // 1. phpstan autoload test case is triggered first, // 2. all php-parser classes are loaded, -if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) { +if (defined('PHPUNIT_COMPOSER_INSTALL') + && class_exists(PHPStanTestCase::class, false) + && interface_exists(Node::class, false)) { return; } - -function isPHPStanTestPreloaded(): bool -{ - if (! class_exists(PHPStanTestCase::class, false)) { - return false; - } - - return interface_exists(Node::class, false); -} CODE_SAMPLE; /** diff --git a/preload-split-package.php b/preload-split-package.php index da953d5a7e5..6a969d4aad8 100644 --- a/preload-split-package.php +++ b/preload-split-package.php @@ -12,19 +12,12 @@ // edge case during Rector tests case, happens when // 1. phpstan autoload test case is triggered first, // 2. all php-parser classes are loaded, -if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) { +if (defined('PHPUNIT_COMPOSER_INSTALL') + && class_exists(PHPStanTestCase::class, false) + && interface_exists(Node::class, false)) { return; } -function isPHPStanTestPreloaded(): bool -{ - if (! class_exists(PHPStanTestCase::class, false)) { - return false; - } - - return interface_exists(Node::class, false); -} - require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node.php'; require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php'; require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php'; diff --git a/preload.php b/preload.php index cecb0b90b4c..55beb85fb92 100644 --- a/preload.php +++ b/preload.php @@ -12,19 +12,12 @@ // edge case during Rector tests case, happens when // 1. phpstan autoload test case is triggered first, // 2. all php-parser classes are loaded, -if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) { +if (defined('PHPUNIT_COMPOSER_INSTALL') + && class_exists(PHPStanTestCase::class, false) + && interface_exists(Node::class, false)) { return; } -function isPHPStanTestPreloaded(): bool -{ - if (! class_exists(PHPStanTestCase::class, false)) { - return false; - } - - return interface_exists(Node::class, false); -} - require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php'; require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';