mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 58273de24474dee2a5463949ad127a86526c4e3a
58273de244
[CodingStyle][Php80][Privatization] Handle SeparateMultiUseImportsRector+ClassPropertyAssignToConstructorPromotionRector+FinalizeClassesWithoutChildrenRector cause invalid removal (#4649)
This commit is contained in:
parent
b2fa3fba80
commit
420f332cf3
@ -4,8 +4,11 @@ declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Rector\Use_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\TraitUse;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -41,18 +44,38 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Use_::class, TraitUse::class];
|
||||
return [FileWithoutNamespace::class, Namespace_::class, Class_::class];
|
||||
}
|
||||
/**
|
||||
* @param Use_|TraitUse $node
|
||||
* @return Use_[]|TraitUse[]|null
|
||||
* @param FileWithoutNamespace|Namespace_|Class_ $node
|
||||
* @return \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\Namespace_|\PhpParser\Node\Stmt\Class_|null
|
||||
*/
|
||||
public function refactor(Node $node) : ?array
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
if ($node instanceof Use_) {
|
||||
return $this->refactorUseImport($node);
|
||||
$hasChanged = \false;
|
||||
foreach ($node->stmts as $key => $stmt) {
|
||||
if ($stmt instanceof Use_) {
|
||||
$refactorUseImport = $this->refactorUseImport($stmt);
|
||||
if ($refactorUseImport !== null) {
|
||||
unset($node->stmts[$key]);
|
||||
\array_splice($node->stmts, $key, 0, $refactorUseImport);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ($stmt instanceof TraitUse) {
|
||||
$refactorTraitUse = $this->refactorTraitUse($stmt);
|
||||
if ($refactorTraitUse !== null) {
|
||||
unset($node->stmts[$key]);
|
||||
\array_splice($node->stmts, $key, 0, $refactorTraitUse);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->refactorTraitUse($node);
|
||||
if (!$hasChanged) {
|
||||
return null;
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @return Use_[]|null $use
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '529defd2de2b8ea122d0d7326ca0b054a22a030d';
|
||||
public const PACKAGE_VERSION = '58273de24474dee2a5463949ad127a86526c4e3a';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-04 21:07:35';
|
||||
public const RELEASE_DATE = '2023-08-04 22:22:48';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitaed1c703ebc52bf0bfb9c0829d01beb1::getLoader();
|
||||
return ComposerAutoloaderIniteba2d00fce57247563ebbdd0a16175fc::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitaed1c703ebc52bf0bfb9c0829d01beb1
|
||||
class ComposerAutoloaderIniteba2d00fce57247563ebbdd0a16175fc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitaed1c703ebc52bf0bfb9c0829d01beb1
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitaed1c703ebc52bf0bfb9c0829d01beb1', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderIniteba2d00fce57247563ebbdd0a16175fc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitaed1c703ebc52bf0bfb9c0829d01beb1', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderIniteba2d00fce57247563ebbdd0a16175fc', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1
|
||||
class ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3014,9 +3014,9 @@ class ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitaed1c703ebc52bf0bfb9c0829d01beb1::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticIniteba2d00fce57247563ebbdd0a16175fc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user