Skip to content

Commit 232dcab

Browse files
committed
define early
1 parent ed40c5a commit 232dcab

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

build/build-preload.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ final class PreloadBuilder
5858
return;
5959
}
6060
61-
// edge case during Rector tests case, happens when
62-
// 1. phpstan autoload test case is triggered first,
63-
// 2. all php-parser classes are loaded,
64-
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
65-
return;
66-
}
67-
6861
if (! function_exists('isPHPStanTestPreloaded')) {
6962
function isPHPStanTestPreloaded(): bool
7063
{
@@ -75,6 +68,13 @@ function isPHPStanTestPreloaded(): bool
7568
return interface_exists(Node::class, false);
7669
}
7770
}
71+
72+
// edge case during Rector tests case, happens when
73+
// 1. phpstan autoload test case is triggered first,
74+
// 2. all php-parser classes are loaded,
75+
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
76+
return;
77+
}
7878
CODE_SAMPLE;
7979

8080
/**

preload-split-package.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
return;
1010
}
1111

12-
// edge case during Rector tests case, happens when
13-
// 1. phpstan autoload test case is triggered first,
14-
// 2. all php-parser classes are loaded,
15-
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
16-
return;
17-
}
18-
1912
if (! function_exists('isPHPStanTestPreloaded')) {
2013
function isPHPStanTestPreloaded(): bool
2114
{
@@ -27,6 +20,13 @@ function isPHPStanTestPreloaded(): bool
2720
}
2821
}
2922

23+
// edge case during Rector tests case, happens when
24+
// 1. phpstan autoload test case is triggered first,
25+
// 2. all php-parser classes are loaded,
26+
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
27+
return;
28+
}
29+
3030
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node.php';
3131
require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php';
3232
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';

preload.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
return;
1010
}
1111

12-
// edge case during Rector tests case, happens when
13-
// 1. phpstan autoload test case is triggered first,
14-
// 2. all php-parser classes are loaded,
15-
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
16-
return;
17-
}
18-
1912
if (! function_exists('isPHPStanTestPreloaded')) {
2013
function isPHPStanTestPreloaded(): bool
2114
{
@@ -27,6 +20,13 @@ function isPHPStanTestPreloaded(): bool
2720
}
2821
}
2922

23+
// edge case during Rector tests case, happens when
24+
// 1. phpstan autoload test case is triggered first,
25+
// 2. all php-parser classes are loaded,
26+
if (defined('PHPUNIT_COMPOSER_INSTALL') && isPHPStanTestPreloaded()) {
27+
return;
28+
}
29+
3030
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';
3131
require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php';
3232
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';

0 commit comments

Comments
 (0)