Skip to content

Commit ed40c5a

Browse files
committed
Handle crash redeclare isPHPStanTestPreloaded() method
1 parent 47693a2 commit ed40c5a

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

build/build-preload.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ final class PreloadBuilder
6565
return;
6666
}
6767
68-
function isPHPStanTestPreloaded(): bool
69-
{
70-
if (! class_exists(PHPStanTestCase::class, false)) {
71-
return false;
72-
}
68+
if (! function_exists('isPHPStanTestPreloaded')) {
69+
function isPHPStanTestPreloaded(): bool
70+
{
71+
if (! class_exists(PHPStanTestCase::class, false)) {
72+
return false;
73+
}
7374
74-
return interface_exists(Node::class, false);
75+
return interface_exists(Node::class, false);
76+
}
7577
}
7678
CODE_SAMPLE;
7779

preload-split-package.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
return;
1717
}
1818

19-
function isPHPStanTestPreloaded(): bool
20-
{
21-
if (! class_exists(PHPStanTestCase::class, false)) {
22-
return false;
23-
}
19+
if (! function_exists('isPHPStanTestPreloaded')) {
20+
function isPHPStanTestPreloaded(): bool
21+
{
22+
if (! class_exists(PHPStanTestCase::class, false)) {
23+
return false;
24+
}
2425

25-
return interface_exists(Node::class, false);
26+
return interface_exists(Node::class, false);
27+
}
2628
}
2729

2830
require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node.php';

preload.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
return;
1717
}
1818

19-
function isPHPStanTestPreloaded(): bool
20-
{
21-
if (! class_exists(PHPStanTestCase::class, false)) {
22-
return false;
23-
}
19+
if (! function_exists('isPHPStanTestPreloaded')) {
20+
function isPHPStanTestPreloaded(): bool
21+
{
22+
if (! class_exists(PHPStanTestCase::class, false)) {
23+
return false;
24+
}
2425

25-
return interface_exists(Node::class, false);
26+
return interface_exists(Node::class, false);
27+
}
2628
}
2729

2830
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';

0 commit comments

Comments
 (0)