Updated Rector to commit 684a317c5116bf60d43080ad62af7ae73c221894

684a317c51 [Php55][Renaming] Handle rename string on combination StringClassNameToClassConstantRector+RenameStringRector (#4869)
This commit is contained in:
Tomas Votruba 2023-08-28 05:28:50 +00:00
parent 08c1a94075
commit edd0b488c3
7 changed files with 46 additions and 17 deletions

View File

@ -113,6 +113,11 @@ final class AttributeKey
* @var string
*/
public const CREATED_BY_RULE = 'created_by_rule';
/**
* Helps with skipped below node
* @var string
*/
public const SKIPPED_BY_RECTOR_RULE = 'skipped_rector_rule';
/**
* @var string
*/

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '1c56aa9bdad38af386edd67f45405d641da37ed5';
public const PACKAGE_VERSION = '684a317c5116bf60d43080ad62af7ae73c221894';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-28 11:03:43';
public const RELEASE_DATE = '2023-08-28 12:26:14';
/**
* @var int
*/

View File

@ -23,7 +23,10 @@ final class RectifiedAnalyzer
if ($this->hasConsecutiveCreatedByRule($rectorClass, $node, $originalNode)) {
return \true;
}
return $this->isJustReprintedOverlappedTokenStart($node, $originalNode);
if ($this->isJustReprintedOverlappedTokenStart($node, $originalNode)) {
return \true;
}
return $node->getAttribute(AttributeKey::SKIPPED_BY_RECTOR_RULE) === $rectorClass;
}
/**
* @param class-string<RectorInterface> $rectorClass

View File

@ -195,10 +195,14 @@ CODE_SAMPLE;
}
if (\is_int($refactoredNode)) {
$this->createdByRuleDecorator->decorate($node, $originalNode, static::class);
// notify this rule changing code
$rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getLine());
$this->file->addRectorClassWithLine($rectorWithLineChange);
return $refactoredNode;
if (!\in_array($refactoredNode, [NodeTraverser::DONT_TRAVERSE_CHILDREN, NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN], \true)) {
// notify this rule changing code
$rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getLine());
$this->file->addRectorClassWithLine($rectorWithLineChange);
return $refactoredNode;
}
$this->decorateCurrentAndChildren($node);
return null;
}
// nothing to change → continue
if ($refactoredNode === null) {
@ -210,6 +214,23 @@ CODE_SAMPLE;
}
return $this->postRefactorProcess($originalNode, $node, $refactoredNode, $filePath);
}
private function decorateCurrentAndChildren(Node $node) : void
{
// filter only types that
// 1. registered in getNodesTypes() method
// 2. different with current node type, as already decorated above
//
$types = \array_filter($this->getNodeTypes(), static function (string $nodeType) use($node) : bool {
return $nodeType !== \get_class($node);
});
$this->traverseNodesWithCallable($node, static function (Node $subNode) use($types) {
if (\in_array(\get_class($subNode), $types, \true)) {
$subNode->setAttribute(AttributeKey::SKIPPED_BY_RECTOR_RULE, static::class);
$subNode->setAttribute(AttributeKey::SKIPPED_BY_RECTOR_RULE, static::class);
}
return null;
});
}
/**
* Replacing nodes in leaveNode() method avoids infinite recursion
* see"infinite recursion" in https://github.com/nikic/PHP-Parser/blob/master/doc/component/Walking_the_AST.markdown

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit3218c35e7e1f8e2af32e58b72ec06430
class ComposerAutoloaderInit6504f4b1285986c318f9a2848b666cca
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit3218c35e7e1f8e2af32e58b72ec06430
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3218c35e7e1f8e2af32e58b72ec06430', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit6504f4b1285986c318f9a2848b666cca', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit3218c35e7e1f8e2af32e58b72ec06430', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit6504f4b1285986c318f9a2848b666cca', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit6504f4b1285986c318f9a2848b666cca::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit6504f4b1285986c318f9a2848b666cca::$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 ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430
class ComposerStaticInit6504f4b1285986c318f9a2848b666cca
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -2608,9 +2608,9 @@ class ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3218c35e7e1f8e2af32e58b72ec06430::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit6504f4b1285986c318f9a2848b666cca::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6504f4b1285986c318f9a2848b666cca::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6504f4b1285986c318f9a2848b666cca::$classMap;
}, null, ClassLoader::class);
}