Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions build/build-preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,23 @@ final class PreloadBuilder
return;
}

if (! function_exists('isPHPStanTestPreloaded')) {
function isPHPStanTestPreloaded(): bool
{
if (! class_exists(PHPStanTestCase::class, false)) {
return false;
}

return interface_exists(Node::class, false);
}
}

// 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()) {
return;
}

function isPHPStanTestPreloaded(): bool
{
if (! class_exists(PHPStanTestCase::class, false)) {
return false;
}

return interface_exists(Node::class, false);
}
CODE_SAMPLE;

/**
Expand Down
20 changes: 11 additions & 9 deletions preload-split-package.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@
return;
}

if (! function_exists('isPHPStanTestPreloaded')) {
function isPHPStanTestPreloaded(): bool
{
if (! class_exists(PHPStanTestCase::class, false)) {
return false;
}

return interface_exists(Node::class, false);
}
}

// 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()) {
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';
Expand Down
20 changes: 11 additions & 9 deletions preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@
return;
}

if (! function_exists('isPHPStanTestPreloaded')) {
function isPHPStanTestPreloaded(): bool
{
if (! class_exists(PHPStanTestCase::class, false)) {
return false;
}

return interface_exists(Node::class, false);
}
}

// 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()) {
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';
Expand Down