Skip to content

Commit 3468bc1

Browse files
committed
[Alternative] Use direct check to avoid redeclare function isPHPStanTestPreloaded()
1 parent 47693a2 commit 3468bc1

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

preload.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,12 @@
1212
// edge case during Rector tests case, happens when
1313
// 1. phpstan autoload test case is triggered first,
1414
// 2. all php-parser classes are loaded,
15-
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
15+
if (defined('PHPUNIT_COMPOSER_INSTALL')
16+
&& class_exists(PHPStanTestCase::class, false)
17+
&& interface_exists(Node::class, false)) {
1618
return;
1719
}
1820

19-
function isPHPStanTestPreloaded(): bool
20-
{
21-
if (! class_exists(PHPStanTestCase::class, false)) {
22-
return false;
23-
}
24-
25-
return interface_exists(Node::class, false);
26-
}
27-
2821
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';
2922
require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php';
3023
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';

0 commit comments

Comments
 (0)