Updated Rector to commit b4120a8850

b4120a8850 [DX] Use direct method on node, instead of token position (#2340)
This commit is contained in:
Tomas Votruba 2022-05-21 08:50:30 +00:00
parent 6fe802bfdc
commit ba3d4a2c17
8 changed files with 27 additions and 32 deletions

View File

@ -16,11 +16,6 @@ final class AttributeKey
* @var string
*/
public const SCOPE = 'scope';
/**
* @deprecated Use @see \Rector\Naming\Naming\UseImportsResolver::resolveForNode() instead
* @var string
*/
public const USE_NODES = 'useNodes';
/**
* Internal php-parser name.
* Do not change this even if you want!

View File

@ -36,8 +36,9 @@ final class NodeByTypeAndPositionCollector
{
$nodesByTypeAndPosition = [];
foreach ($assignedVariables as $assignedVariable) {
$startTokenPos = $assignedVariable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::START_TOKEN_POSITION);
if ($startTokenPos === null) {
$startTokenPos = $assignedVariable->getStartTokenPos();
// "-1" is empty value default
if ($startTokenPos === -1) {
continue;
}
// not in different scope, than previous one - e.g. if/while/else...
@ -50,9 +51,9 @@ final class NodeByTypeAndPositionCollector
$nodesByTypeAndPosition[] = new \Rector\DeadCode\ValueObject\VariableNodeUse($startTokenPos, $variableName, \Rector\DeadCode\ValueObject\VariableNodeUse::TYPE_ASSIGN, $assignedVariable, $nestingHash);
}
foreach ($assignedVariablesUse as $assignedVariableUse) {
/** @var int|null $startTokenPos */
$startTokenPos = $assignedVariableUse->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::START_TOKEN_POSITION);
if ($startTokenPos === null) {
$startTokenPos = $assignedVariableUse->getStartTokenPos();
// "-1" is empty value default
if ($startTokenPos === -1) {
continue;
}
/** @var string $variableName */

View File

@ -117,10 +117,9 @@ CODE_SAMPLE
*/
private function shouldSkip($node, string $numericValueAsString) : bool
{
/** @var int $startToken */
$startToken = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::START_TOKEN_POSITION);
$startTokenPos = $node->getStartTokenPos();
$oldTokens = $this->file->getOldTokens();
$tokenValue = $oldTokens[$startToken][1] ?? null;
$tokenValue = $oldTokens[$startTokenPos][1] ?? null;
if (!\is_string($tokenValue)) {
return \true;
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'fcadc67328afe2b040fb7eaebe382000b1e22034';
public const PACKAGE_VERSION = 'b4120a885084c5e15814aceae41b2e0a1bdb66e0';
/**
* @var string
*/
public const RELEASE_DATE = '2022-05-21 08:42:08';
public const RELEASE_DATE = '2022-05-21 08:43:58';
/**
* @var string
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit7e3df0957f8163e481ede69107667719
class ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit7e3df0957f8163e481ede69107667719
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7e3df0957f8163e481ede69107667719', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit7e3df0957f8163e481ede69107667719', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7e3df0957f8163e481ede69107667719::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit2beaa090966f2b6e34886cf041a5520d::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit7e3df0957f8163e481ede69107667719::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit2beaa090966f2b6e34886cf041a5520d::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire7e3df0957f8163e481ede69107667719($fileIdentifier, $file);
composerRequire2beaa090966f2b6e34886cf041a5520d($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit7e3df0957f8163e481ede69107667719
* @param string $file
* @return void
*/
function composerRequire7e3df0957f8163e481ede69107667719($fileIdentifier, $file)
function composerRequire2beaa090966f2b6e34886cf041a5520d($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 ComposerStaticInit7e3df0957f8163e481ede69107667719
class ComposerStaticInit2beaa090966f2b6e34886cf041a5520d
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3908,9 +3908,9 @@ class ComposerStaticInit7e3df0957f8163e481ede69107667719
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7e3df0957f8163e481ede69107667719::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7e3df0957f8163e481ede69107667719::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7e3df0957f8163e481ede69107667719::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2beaa090966f2b6e34886cf041a5520d::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2beaa090966f2b6e34886cf041a5520d::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2beaa090966f2b6e34886cf041a5520d::$classMap;
}, null, ClassLoader::class);
}

View File

@ -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('RectorPrefix20220521\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit7e3df0957f8163e481ede69107667719', false) && !interface_exists('ComposerAutoloaderInit7e3df0957f8163e481ede69107667719', false) && !trait_exists('ComposerAutoloaderInit7e3df0957f8163e481ede69107667719', false)) {
spl_autoload_call('RectorPrefix20220521\ComposerAutoloaderInit7e3df0957f8163e481ede69107667719');
if (!class_exists('ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d', false) && !interface_exists('ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d', false) && !trait_exists('ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d', false)) {
spl_autoload_call('RectorPrefix20220521\ComposerAutoloaderInit2beaa090966f2b6e34886cf041a5520d');
}
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('RectorPrefix20220521\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220521\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire7e3df0957f8163e481ede69107667719')) {
function composerRequire7e3df0957f8163e481ede69107667719() {
return \RectorPrefix20220521\composerRequire7e3df0957f8163e481ede69107667719(...func_get_args());
if (!function_exists('composerRequire2beaa090966f2b6e34886cf041a5520d')) {
function composerRequire2beaa090966f2b6e34886cf041a5520d() {
return \RectorPrefix20220521\composerRequire2beaa090966f2b6e34886cf041a5520d(...func_get_args());
}
}
if (!function_exists('scanPath')) {