From e1b8b2e468a38933d57cc15de1cc6d7cf91b0974 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 7 May 2022 09:29:04 +0000 Subject: [PATCH] Updated Rector to commit 81ba0c90bd2ce5a56e5a1fd5df3fc4277357ed88 https://github.com/rectorphp/rector-src/commit/81ba0c90bd2ce5a56e5a1fd5df3fc4277357ed88 [Scoper] Remove PHPStanStubLoader: move to dedicated file to define native classes (#2249) --- src/Application/VersionResolver.php | 4 +- src/Autoloading/BootstrapFilesIncluder.php | 6 +- .../RectorContainerFactory.php | 3 - src/Stubs/PHPStanStubLoader.php | 64 --------------- stubs-rector/Internal/EnumInterfaces.php | 4 +- stubs-rector/Internal/NativeClasses.php | 80 +++++++++++++++++++ vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_real.php | 14 ++-- vendor/composer/autoload_static.php | 9 +-- vendor/scoper-autoload.php | 10 +-- 11 files changed, 104 insertions(+), 93 deletions(-) delete mode 100644 src/Stubs/PHPStanStubLoader.php create mode 100644 stubs-rector/Internal/NativeClasses.php diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b79b61ca1dc..eeb394125e7 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = 'c2ade0583ccd8fe1413be641924f5b1576ffad8b'; + public const PACKAGE_VERSION = '81ba0c90bd2ce5a56e5a1fd5df3fc4277357ed88'; /** * @var string */ - public const RELEASE_DATE = '2022-05-07 09:20:29'; + public const RELEASE_DATE = '2022-05-07 16:21:59'; /** * @var string */ diff --git a/src/Autoloading/BootstrapFilesIncluder.php b/src/Autoloading/BootstrapFilesIncluder.php index e16c4fe7976..a1fe7aef2f9 100644 --- a/src/Autoloading/BootstrapFilesIncluder.php +++ b/src/Autoloading/BootstrapFilesIncluder.php @@ -13,7 +13,7 @@ final class BootstrapFilesIncluder /** * @var string[] */ - private const STUBS = ['/../../stubs-rector/PHPUnit/Framework/TestCase.php', '/../../stubs-rector/Internal/EnumInterfaces.php']; + private const STUBS = ['Internal/EnumInterfaces.php', 'Internal/NativeClasses.php', 'PHPUnit/Framework/TestCase.php']; /** * @readonly * @var \Symplify\PackageBuilder\Parameter\ParameterProvider @@ -44,8 +44,8 @@ final class BootstrapFilesIncluder } } foreach (self::STUBS as $stub) { - if (\is_file(__DIR__ . $stub)) { - require_once __DIR__ . $stub; + if (\is_file(__DIR__ . '/../../stubs-rector/' . $stub)) { + require_once __DIR__ . '/../../stubs-rector/' . $stub; } } } diff --git a/src/DependencyInjection/RectorContainerFactory.php b/src/DependencyInjection/RectorContainerFactory.php index 94149e7eb6b..61c257f08d7 100644 --- a/src/DependencyInjection/RectorContainerFactory.php +++ b/src/DependencyInjection/RectorContainerFactory.php @@ -7,7 +7,6 @@ use RectorPrefix20220507\Nette\Utils\FileSystem; use RectorPrefix20220507\Psr\Container\ContainerInterface; use Rector\Caching\Detector\ChangedFilesDetector; use Rector\Core\Kernel\RectorKernel; -use Rector\Core\Stubs\PHPStanStubLoader; use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs; use RectorPrefix20220507\Symfony\Component\Console\Style\SymfonyStyle; final class RectorContainerFactory @@ -40,8 +39,6 @@ final class RectorContainerFactory */ private function createFromConfigs(array $configFiles) : \RectorPrefix20220507\Psr\Container\ContainerInterface { - $phpStanStubLoader = new \Rector\Core\Stubs\PHPStanStubLoader(); - $phpStanStubLoader->loadStubs(); $rectorKernel = new \Rector\Core\Kernel\RectorKernel(); return $rectorKernel->createFromConfigs($configFiles); } diff --git a/src/Stubs/PHPStanStubLoader.php b/src/Stubs/PHPStanStubLoader.php deleted file mode 100644 index db949d551da..00000000000 --- a/src/Stubs/PHPStanStubLoader.php +++ /dev/null @@ -1,64 +0,0 @@ -areStubsLoaded) { - return; - } - foreach (self::VENDOR_PATHS as $vendorPath) { - $vendorPath = \realpath($vendorPath); - if ($vendorPath === \false) { - continue; - } - foreach (self::STUBS as $stub) { - $path = $this->getStubPath($vendorPath, $stub); - if ($path === null) { - continue 2; - } - require_once $path; - } - $this->areStubsLoaded = \true; - // already loaded? stop loop - break; - } - } - private function getStubPath(string $vendorPath, string $stub) : ?string - { - $path = \sprintf('phar://%s/phpstan/phpstan/phpstan.phar/stubs/runtime/%s', $vendorPath, $stub); - $isExists = \file_exists($path); - if ($isExists) { - return $path; - } - return null; - } -} diff --git a/stubs-rector/Internal/EnumInterfaces.php b/stubs-rector/Internal/EnumInterfaces.php index 6f613db3ae0..a673792fc47 100644 --- a/stubs-rector/Internal/EnumInterfaces.php +++ b/stubs-rector/Internal/EnumInterfaces.php @@ -1,6 +1,6 @@ flags = $flags; + } + + } +} + +if (\PHP_VERSION_ID < 80100 && ! class_exists('ReturnTypeWillChange', false)) { + #[Attribute(Attribute::TARGET_METHOD)] + final class ReturnTypeWillChange + { + } +} diff --git a/vendor/autoload.php b/vendor/autoload.php index 8291169669e..526560e41ea 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit408b7589446e352802303607cb19c324::getLoader(); +return ComposerAutoloaderInit75bc346b664248118129de1b6b216239::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index e213c7caf3b..8d274087123 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1781,7 +1781,6 @@ return array( 'Rector\\Core\\StaticReflection\\DynamicSourceLocatorDecorator' => $baseDir . '/src/StaticReflection/DynamicSourceLocatorDecorator.php', 'Rector\\Core\\StaticReflection\\SourceLocator\\ParentAttributeSourceLocator' => $baseDir . '/src/StaticReflection/SourceLocator/ParentAttributeSourceLocator.php', 'Rector\\Core\\StaticReflection\\SourceLocator\\RenamedClassesSourceLocator' => $baseDir . '/src/StaticReflection/SourceLocator/RenamedClassesSourceLocator.php', - 'Rector\\Core\\Stubs\\PHPStanStubLoader' => $baseDir . '/src/Stubs/PHPStanStubLoader.php', 'Rector\\Core\\Template\\DefaultResolver' => $baseDir . '/src/Template/DefaultResolver.php', 'Rector\\Core\\Util\\MemoryLimiter' => $baseDir . '/src/Util/MemoryLimiter.php', 'Rector\\Core\\Util\\PhpVersionFactory' => $baseDir . '/src/Util/PhpVersionFactory.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index fb0f1395ca0..aafa1aa6f28 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit408b7589446e352802303607cb19c324 +class ComposerAutoloaderInit75bc346b664248118129de1b6b216239 { private static $loader; @@ -22,19 +22,19 @@ class ComposerAutoloaderInit408b7589446e352802303607cb19c324 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit408b7589446e352802303607cb19c324', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit75bc346b664248118129de1b6b216239', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit408b7589446e352802303607cb19c324', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit75bc346b664248118129de1b6b216239', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit408b7589446e352802303607cb19c324::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit75bc346b664248118129de1b6b216239::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $includeFiles = \Composer\Autoload\ComposerStaticInit408b7589446e352802303607cb19c324::$files; + $includeFiles = \Composer\Autoload\ComposerStaticInit75bc346b664248118129de1b6b216239::$files; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire408b7589446e352802303607cb19c324($fileIdentifier, $file); + composerRequire75bc346b664248118129de1b6b216239($fileIdentifier, $file); } return $loader; @@ -46,7 +46,7 @@ class ComposerAutoloaderInit408b7589446e352802303607cb19c324 * @param string $file * @return void */ -function composerRequire408b7589446e352802303607cb19c324($fileIdentifier, $file) +function composerRequire75bc346b664248118129de1b6b216239($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d8951b1e117..13aa3d489ee 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit408b7589446e352802303607cb19c324 +class ComposerStaticInit75bc346b664248118129de1b6b216239 { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -2150,7 +2150,6 @@ class ComposerStaticInit408b7589446e352802303607cb19c324 'Rector\\Core\\StaticReflection\\DynamicSourceLocatorDecorator' => __DIR__ . '/../..' . '/src/StaticReflection/DynamicSourceLocatorDecorator.php', 'Rector\\Core\\StaticReflection\\SourceLocator\\ParentAttributeSourceLocator' => __DIR__ . '/../..' . '/src/StaticReflection/SourceLocator/ParentAttributeSourceLocator.php', 'Rector\\Core\\StaticReflection\\SourceLocator\\RenamedClassesSourceLocator' => __DIR__ . '/../..' . '/src/StaticReflection/SourceLocator/RenamedClassesSourceLocator.php', - 'Rector\\Core\\Stubs\\PHPStanStubLoader' => __DIR__ . '/../..' . '/src/Stubs/PHPStanStubLoader.php', 'Rector\\Core\\Template\\DefaultResolver' => __DIR__ . '/../..' . '/src/Template/DefaultResolver.php', 'Rector\\Core\\Util\\MemoryLimiter' => __DIR__ . '/../..' . '/src/Util/MemoryLimiter.php', 'Rector\\Core\\Util\\PhpVersionFactory' => __DIR__ . '/../..' . '/src/Util/PhpVersionFactory.php', @@ -3883,9 +3882,9 @@ class ComposerStaticInit408b7589446e352802303607cb19c324 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit408b7589446e352802303607cb19c324::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit408b7589446e352802303607cb19c324::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit408b7589446e352802303607cb19c324::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit75bc346b664248118129de1b6b216239::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit75bc346b664248118129de1b6b216239::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit75bc346b664248118129de1b6b216239::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 33e555ad809..858ceb4ac7d 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php'; if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) { spl_autoload_call('RectorPrefix20220507\AutoloadIncluder'); } -if (!class_exists('ComposerAutoloaderInit408b7589446e352802303607cb19c324', false) && !interface_exists('ComposerAutoloaderInit408b7589446e352802303607cb19c324', false) && !trait_exists('ComposerAutoloaderInit408b7589446e352802303607cb19c324', false)) { - spl_autoload_call('RectorPrefix20220507\ComposerAutoloaderInit408b7589446e352802303607cb19c324'); +if (!class_exists('ComposerAutoloaderInit75bc346b664248118129de1b6b216239', false) && !interface_exists('ComposerAutoloaderInit75bc346b664248118129de1b6b216239', false) && !trait_exists('ComposerAutoloaderInit75bc346b664248118129de1b6b216239', false)) { + spl_autoload_call('RectorPrefix20220507\ComposerAutoloaderInit75bc346b664248118129de1b6b216239'); } if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) { spl_autoload_call('RectorPrefix20220507\Helmich\TypoScriptParser\Parser\AST\Statement'); @@ -59,9 +59,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20220507\print_node(...func_get_args()); } } -if (!function_exists('composerRequire408b7589446e352802303607cb19c324')) { - function composerRequire408b7589446e352802303607cb19c324() { - return \RectorPrefix20220507\composerRequire408b7589446e352802303607cb19c324(...func_get_args()); +if (!function_exists('composerRequire75bc346b664248118129de1b6b216239')) { + function composerRequire75bc346b664248118129de1b6b216239() { + return \RectorPrefix20220507\composerRequire75bc346b664248118129de1b6b216239(...func_get_args()); } } if (!function_exists('scanPath')) {