Updated Rector to commit f680a070335ee796de19b25a98c2d4ac172b6fe8

f680a07033 [Autoloading] Proper fix for fix bootstrap phpunit.phar (#5522)
This commit is contained in:
Tomas Votruba 2024-01-30 10:08:17 +00:00
parent 8fe9717aee
commit 0301d3f400
2 changed files with 13 additions and 5 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '3c51cd8ebebd6840a0374e367308049c36761ee0';
public const PACKAGE_VERSION = 'f680a070335ee796de19b25a98c2d4ac172b6fe8';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-30 16:00:02';
public const RELEASE_DATE = '2024-01-30 10:06:09';
/**
* @var int
*/

View File

@ -25,6 +25,7 @@ final class BootstrapFilesIncluder
{
$bootstrapFiles = SimpleParameterProvider::provideArrayParameter(Option::BOOTSTRAP_FILES);
Assert::allString($bootstrapFiles);
$isLoadPHPUnitPhar = \false;
/** @var string[] $bootstrapFiles */
foreach ($bootstrapFiles as $bootstrapFile) {
if (!\is_file($bootstrapFile)) {
@ -33,13 +34,16 @@ final class BootstrapFilesIncluder
// load phar file
if (\substr_compare($bootstrapFile, '.phar', -\strlen('.phar')) === 0) {
Phar::loadPhar($bootstrapFile);
if (\substr_compare($bootstrapFile, 'phpunit.phar', -\strlen('phpunit.phar')) === 0) {
$isLoadPHPUnitPhar = \true;
}
continue;
}
require $bootstrapFile;
}
$this->requireRectorStubs();
$this->requireRectorStubs($isLoadPHPUnitPhar);
}
private function requireRectorStubs() : void
private function requireRectorStubs(bool $isLoadPHPUnitPhar) : void
{
/** @var false|string $stubsRectorDirectory */
$stubsRectorDirectory = \realpath(__DIR__ . '/../../stubs-rector');
@ -50,7 +54,11 @@ final class BootstrapFilesIncluder
/** @var SplFileInfo[] $stubs */
$stubs = new RecursiveIteratorIterator($dir);
foreach ($stubs as $stub) {
require_once $stub->getRealPath();
$realPath = $stub->getRealPath();
if ($isLoadPHPUnitPhar && \substr_compare($realPath, 'TestCase.php', -\strlen('TestCase.php')) === 0) {
continue;
}
require_once $realPath;
}
}
}