mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 914171511561fab6062f5df923b12c276725c0b5
9141715115
Add failing test case for STOP_TRAVERSAL directly on refactor (#4185)
This commit is contained in:
parent
a10a55f5b9
commit
a6399d5acf
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php55\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
final class ClassConstStringValueNodeVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const IS_UNDER_CLASS_CONST = 'is_under_class_const';
|
||||
public function enterNode(Node $node)
|
||||
{
|
||||
if ($node instanceof String_) {
|
||||
$node->setAttribute(self::IS_UNDER_CLASS_CONST, \true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@ use PHPStan\Reflection\ReflectionProvider;
|
|||
use Rector\Core\Contract\Rector\AllowEmptyConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractScopeAwareRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php55\NodeVisitor\ClassConstStringValueNodeVisitor;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -90,7 +89,12 @@ CODE_SAMPLE
|
|||
{
|
||||
// allow class strings to be part of class const arrays, as probably on purpose
|
||||
if ($node instanceof ClassConst) {
|
||||
$this->fillIsUnderClassConstAttribute($node);
|
||||
$this->traverseNodesWithCallable($node->consts, static function (Node $subNode) {
|
||||
if ($subNode instanceof String_) {
|
||||
$subNode->setAttribute(self::IS_UNDER_CLASS_CONST, \true);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
}
|
||||
// keep allowed string as condition
|
||||
|
@ -134,12 +138,6 @@ CODE_SAMPLE
|
|||
{
|
||||
return PhpVersionFeature::CLASSNAME_CONSTANT;
|
||||
}
|
||||
private function fillIsUnderClassConstAttribute(ClassConst $classConst) : void
|
||||
{
|
||||
$nodeTraverser = new NodeTraverser();
|
||||
$nodeTraverser->addVisitor(new ClassConstStringValueNodeVisitor());
|
||||
$nodeTraverser->traverse([$classConst]);
|
||||
}
|
||||
private function shouldSkip(string $classLikeName) : bool
|
||||
{
|
||||
// skip short class names, mostly invalid use of strings
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '69689c705ac2ae72961864a25332f213721983a4';
|
||||
public const PACKAGE_VERSION = '914171511561fab6062f5df923b12c276725c0b5';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-12 02:09:54';
|
||||
public const RELEASE_DATE = '2023-06-12 00:45:32';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitada10db70b3c4f0558502c20ca48a606::getLoader();
|
||||
return ComposerAutoloaderInitad21f89ac4119c2c0f1e443e6d4079bc::getLoader();
|
||||
|
|
|
@ -2219,7 +2219,6 @@ return array(
|
|||
'Rector\\Php54\\Rector\\Array_\\LongArrayToShortArrayRector' => $baseDir . '/rules/Php54/Rector/Array_/LongArrayToShortArrayRector.php',
|
||||
'Rector\\Php54\\Rector\\Break_\\RemoveZeroBreakContinueRector' => $baseDir . '/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php',
|
||||
'Rector\\Php54\\Rector\\FuncCall\\RemoveReferenceFromCallRector' => $baseDir . '/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php',
|
||||
'Rector\\Php55\\NodeVisitor\\ClassConstStringValueNodeVisitor' => $baseDir . '/rules/Php55/NodeVisitor/ClassConstStringValueNodeVisitor.php',
|
||||
'Rector\\Php55\\Rector\\ClassConstFetch\\StaticToSelfOnFinalClassRector' => $baseDir . '/rules/Php55/Rector/ClassConstFetch/StaticToSelfOnFinalClassRector.php',
|
||||
'Rector\\Php55\\Rector\\Class_\\ClassConstantToSelfClassRector' => $baseDir . '/rules/Php55/Rector/Class_/ClassConstantToSelfClassRector.php',
|
||||
'Rector\\Php55\\Rector\\FuncCall\\GetCalledClassToSelfClassRector' => $baseDir . '/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitada10db70b3c4f0558502c20ca48a606
|
||||
class ComposerAutoloaderInitad21f89ac4119c2c0f1e443e6d4079bc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitada10db70b3c4f0558502c20ca48a606
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitada10db70b3c4f0558502c20ca48a606', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitad21f89ac4119c2c0f1e443e6d4079bc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitada10db70b3c4f0558502c20ca48a606', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitad21f89ac4119c2c0f1e443e6d4079bc', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitada10db70b3c4f0558502c20ca48a606::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitada10db70b3c4f0558502c20ca48a606::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitada10db70b3c4f0558502c20ca48a606
|
||||
class ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -2470,7 +2470,6 @@ class ComposerStaticInitada10db70b3c4f0558502c20ca48a606
|
|||
'Rector\\Php54\\Rector\\Array_\\LongArrayToShortArrayRector' => __DIR__ . '/../..' . '/rules/Php54/Rector/Array_/LongArrayToShortArrayRector.php',
|
||||
'Rector\\Php54\\Rector\\Break_\\RemoveZeroBreakContinueRector' => __DIR__ . '/../..' . '/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php',
|
||||
'Rector\\Php54\\Rector\\FuncCall\\RemoveReferenceFromCallRector' => __DIR__ . '/../..' . '/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php',
|
||||
'Rector\\Php55\\NodeVisitor\\ClassConstStringValueNodeVisitor' => __DIR__ . '/../..' . '/rules/Php55/NodeVisitor/ClassConstStringValueNodeVisitor.php',
|
||||
'Rector\\Php55\\Rector\\ClassConstFetch\\StaticToSelfOnFinalClassRector' => __DIR__ . '/../..' . '/rules/Php55/Rector/ClassConstFetch/StaticToSelfOnFinalClassRector.php',
|
||||
'Rector\\Php55\\Rector\\Class_\\ClassConstantToSelfClassRector' => __DIR__ . '/../..' . '/rules/Php55/Rector/Class_/ClassConstantToSelfClassRector.php',
|
||||
'Rector\\Php55\\Rector\\FuncCall\\GetCalledClassToSelfClassRector' => __DIR__ . '/../..' . '/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php',
|
||||
|
@ -3124,9 +3123,9 @@ class ComposerStaticInitada10db70b3c4f0558502c20ca48a606
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitada10db70b3c4f0558502c20ca48a606::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitada10db70b3c4f0558502c20ca48a606::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitada10db70b3c4f0558502c20ca48a606::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitad21f89ac4119c2c0f1e443e6d4079bc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue