mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit 0fb4f5bfbb
0fb4f5bfbb
[Core] Apply Scope Refresh on Enum_ (#2549)
This commit is contained in:
parent
7e8b6a22aa
commit
c9b4c3f38d
|
@ -48,7 +48,7 @@ final class WorkerCommandLineFactory
|
|||
if (\in_array($arg, $mainCommandNames, \true)) {
|
||||
break;
|
||||
}
|
||||
$workerCommandArray[] = \escapeshellarg($arg);
|
||||
$workerCommandArray[] = \escapeshellarg((string) $arg);
|
||||
}
|
||||
$workerCommandArray[] = $workerCommandName;
|
||||
$mainCommandOptionNames = $this->getCommandOptionNames($mainCommand);
|
||||
|
@ -89,7 +89,7 @@ final class WorkerCommandLineFactory
|
|||
*
|
||||
* tested in macOS and Ubuntu (github action)
|
||||
*/
|
||||
$workerCommandArray[] = \escapeshellarg($input->getOption(Option::CONFIG));
|
||||
$workerCommandArray[] = \escapeshellarg((string) $input->getOption(Option::CONFIG));
|
||||
}
|
||||
return \implode(' ', $workerCommandArray);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ final class PropertyNaming
|
|||
if ($matches === null) {
|
||||
return null;
|
||||
}
|
||||
$originalName = \lcfirst($matches['root_name']);
|
||||
$originalName = \lcfirst((string) $matches['root_name']);
|
||||
return new ExpectedName($originalName, $this->rectorNamingInflector->singularize($originalName));
|
||||
}
|
||||
public function getExpectedNameFromType(Type $type) : ?ExpectedName
|
||||
|
@ -118,11 +118,7 @@ final class PropertyNaming
|
|||
$objectType = $objectType->getStaticObjectType();
|
||||
}
|
||||
$className = $this->resolveClassName($objectType);
|
||||
if (\strpos($className, '\\') !== \false) {
|
||||
$shortClassName = (string) Strings::after($className, '\\', -1);
|
||||
} else {
|
||||
$shortClassName = $className;
|
||||
}
|
||||
$shortClassName = \strpos($className, '\\') !== \false ? (string) Strings::after($className, '\\', -1) : $className;
|
||||
$variableName = $this->removeInterfaceSuffixPrefix($shortClassName, 'interface');
|
||||
$variableName = $this->removeInterfaceSuffixPrefix($variableName, 'abstract');
|
||||
$variableName = $this->fqnToShortName($variableName);
|
||||
|
|
|
@ -48,6 +48,7 @@ final class EnumFactory
|
|||
{
|
||||
$shortClassName = $this->nodeNameResolver->getShortName($class);
|
||||
$enum = new Enum_($shortClassName);
|
||||
$enum->namespacedName = $class->namespacedName;
|
||||
$constants = $class->getConstants();
|
||||
if ($constants !== []) {
|
||||
$value = $this->valueResolver->getValue($constants[0]->consts[0]->value);
|
||||
|
@ -63,6 +64,7 @@ final class EnumFactory
|
|||
{
|
||||
$shortClassName = $this->nodeNameResolver->getShortName($class);
|
||||
$enum = new Enum_($shortClassName);
|
||||
$enum->namespacedName = $class->namespacedName;
|
||||
// constant to cases
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
|
||||
$docBlockMethods = $phpDocInfo->getTagsByName('@method');
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'e8ca23fd1592e9a0e6587d0ecddc6199a5c219d3';
|
||||
public const PACKAGE_VERSION = '0fb4f5bfbbf4460ddb40b168cf40555f089d3a45';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-06-21 10:21:43';
|
||||
public const RELEASE_DATE = '2022-06-21 16:54:05';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ final class VersionResolver
|
|||
if ($commitHashResultCode !== 0) {
|
||||
throw new VersionException('Ensure to run compile from composer git repository clone and that git binary is available.');
|
||||
}
|
||||
$version = \trim($commitHashExecOutput[0]);
|
||||
$version = \trim((string) $commitHashExecOutput[0]);
|
||||
return \trim($version, '"');
|
||||
}
|
||||
public static function resolverReleaseDateTime() : DateTime
|
||||
|
@ -51,6 +51,6 @@ final class VersionResolver
|
|||
if ($resultCode !== self::SUCCESS_CODE) {
|
||||
throw new VersionException('You must ensure to run compile from composer git repository clone and that git binary is available.');
|
||||
}
|
||||
return new DateTime(\trim($output[0]));
|
||||
return new DateTime(\trim((string) $output[0]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ use PhpParser\Node\Arg;
|
|||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Enum_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
final class ScopeAnalyzer
|
||||
|
@ -16,7 +15,7 @@ final class ScopeAnalyzer
|
|||
/**
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const NO_SCOPE_NODES = [Name::class, Namespace_::class, FileWithoutNamespace::class, Identifier::class, Enum_::class, Param::class, Arg::class];
|
||||
private const NO_SCOPE_NODES = [Name::class, Namespace_::class, FileWithoutNamespace::class, Identifier::class, Param::class, Arg::class];
|
||||
public function hasScope(Node $node) : bool
|
||||
{
|
||||
foreach (self::NO_SCOPE_NODES as $noScopeNode) {
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336::getLoader();
|
||||
return ComposerAutoloaderInitac80dd3f96317ef2ed4178b809982462::getLoader();
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336
|
||||
class ComposerAutoloaderInitac80dd3f96317ef2ed4178b809982462
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitac80dd3f96317ef2ed4178b809982462', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitac80dd3f96317ef2ed4178b809982462', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitac80dd3f96317ef2ed4178b809982462::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitac80dd3f96317ef2ed4178b809982462::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire7482d1e410f5a1f00d4671b7483d3336($fileIdentifier, $file);
|
||||
composerRequireac80dd3f96317ef2ed4178b809982462($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit7482d1e410f5a1f00d4671b7483d3336
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire7482d1e410f5a1f00d4671b7483d3336($fileIdentifier, $file)
|
||||
function composerRequireac80dd3f96317ef2ed4178b809982462($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 ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336
|
||||
class ComposerStaticInitac80dd3f96317ef2ed4178b809982462
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -3401,9 +3401,9 @@ class ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7482d1e410f5a1f00d4671b7483d3336::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitac80dd3f96317ef2ed4178b809982462::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitac80dd3f96317ef2ed4178b809982462::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitac80dd3f96317ef2ed4178b809982462::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user