Updated Rector to commit 59cf4dd699aff10f3cd59bdfc11236651200383a

59cf4dd699 [DX] Validate rules no longer exists on $rectorConfig->skip() (#4728)
This commit is contained in:
Tomas Votruba 2023-08-09 09:13:23 +00:00
parent e0af8c24c9
commit dcc3c616a4
5 changed files with 50 additions and 12 deletions

View File

@ -66,11 +66,49 @@ final class RectorConfig extends ContainerConfigurator
{
SimpleParameterProvider::setParameter(Option::MEMORY_LIMIT, $memoryLimit);
}
/**
* @param mixed $skipRule
*/
private function isRuleNoLongerExists($skipRule) : bool
{
return \is_string($skipRule) && \strpos($skipRule, '*') === \false && \realpath($skipRule) === \false && \substr_compare($skipRule, 'Rector', -\strlen('Rector')) === 0 && !\class_exists($skipRule);
}
/**
* @param array<int|string, mixed> $criteria
*/
public function skip(array $criteria) : void
{
$notExistsRules = [];
foreach ($criteria as $key => $value) {
/**
* Cover define rule then list of files
*
* $rectorConfig->skip([
* RenameVariableToMatchMethodCallReturnTypeRector::class => [
* __DIR__ . '/packages/Config/RectorConfig.php'
* ],
* ]);
*/
if ($this->isRuleNoLongerExists($key)) {
$notExistsRules[] = $key;
}
if (!\is_string($value)) {
continue;
}
/**
* Cover direct value without array list of files, eg:
*
* $rectorConfig->skip([
* StringClassNameToClassConstantRector::class,
* ]);
*/
if ($this->isRuleNoLongerExists($value)) {
$notExistsRules[] = $value;
}
}
if ($notExistsRules !== []) {
throw new ShouldNotHappenException('Following skipped rules on $rectorConfig->skip() are no longer exists or changed to different namespace: ' . \implode(', ', $notExistsRules));
}
SimpleParameterProvider::addParameter(Option::SKIP, $criteria);
}
public function removeUnusedImports(bool $removeUnusedImports = \true) : void

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b98df68ebb65cc05b7faba113e8e81a56d501c08';
public const PACKAGE_VERSION = '59cf4dd699aff10f3cd59bdfc11236651200383a';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-09 13:37:04';
public const RELEASE_DATE = '2023-08-09 11:09:15';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit9a8e05d1aba7af0507aaf7d5dd267427::getLoader();
return ComposerAutoloaderInit2b34e9dcc0472662e43329a42359ee72::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9a8e05d1aba7af0507aaf7d5dd267427
class ComposerAutoloaderInit2b34e9dcc0472662e43329a42359ee72
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit9a8e05d1aba7af0507aaf7d5dd267427
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9a8e05d1aba7af0507aaf7d5dd267427', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit2b34e9dcc0472662e43329a42359ee72', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9a8e05d1aba7af0507aaf7d5dd267427', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit2b34e9dcc0472662e43329a42359ee72', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit2b34e9dcc0472662e43329a42359ee72::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit2b34e9dcc0472662e43329a42359ee72::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427
class ComposerStaticInit2b34e9dcc0472662e43329a42359ee72
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3004,9 +3004,9 @@ class ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9a8e05d1aba7af0507aaf7d5dd267427::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2b34e9dcc0472662e43329a42359ee72::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2b34e9dcc0472662e43329a42359ee72::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2b34e9dcc0472662e43329a42359ee72::$classMap;
}, null, ClassLoader::class);
}