mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-02 01:10:53 +00:00
Updated Rector to commit e0d7483c6257a772829bc28ca76c8237cabb6435
e0d7483c62
Make use of stmts assign in StringableForToStringRector (#4025)
This commit is contained in:
parent
fed7beb412
commit
01ece07757
|
@ -91,6 +91,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($this->classAnalyzer->isAnonymousClass($node)) {
|
||||
return null;
|
||||
}
|
||||
$toStringClassMethod = $node->getMethod(MethodName::TO_STRING);
|
||||
if (!$toStringClassMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
|
@ -101,9 +104,6 @@ CODE_SAMPLE
|
|||
if (\in_array(self::STRINGABLE, $classLikeAncestorNames, \true)) {
|
||||
return null;
|
||||
}
|
||||
if ($this->classAnalyzer->isAnonymousClass($node)) {
|
||||
return null;
|
||||
}
|
||||
$returnType = $this->returnTypeInferer->inferFunctionLike($toStringClassMethod);
|
||||
if (!$returnType->isString()->yes()) {
|
||||
$this->processNotStringType($toStringClassMethod);
|
||||
|
@ -123,10 +123,8 @@ CODE_SAMPLE
|
|||
}
|
||||
$hasReturn = $this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($toStringClassMethod, Return_::class);
|
||||
if (!$hasReturn) {
|
||||
\end($stmts);
|
||||
$lastKey = \key($stmts);
|
||||
$lastKey = $lastKey === null ? 0 : (int) $lastKey + 1;
|
||||
$toStringClassMethod->stmts[$lastKey] = new Return_(new String_(''));
|
||||
$emptyStringReturn = new Return_(new String_(''));
|
||||
$toStringClassMethod->stmts[] = $emptyStringReturn;
|
||||
return;
|
||||
}
|
||||
$this->traverseNodesWithCallable((array) $toStringClassMethod->stmts, function (Node $subNode) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '5bae1ebdcee327ac3dcf4a25175f9013af54ec3d';
|
||||
public const PACKAGE_VERSION = 'e0d7483c6257a772829bc28ca76c8237cabb6435';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-30 12:29:26';
|
||||
public const RELEASE_DATE = '2023-05-30 12:26:42';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInit6360d2ddab46ca3a5bfdee041076ce29::getLoader();
|
||||
return ComposerAutoloaderInit0a3d454651d6deff44f80df71299afa8::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 ComposerAutoloaderInit6360d2ddab46ca3a5bfdee041076ce29
|
||||
class ComposerAutoloaderInit0a3d454651d6deff44f80df71299afa8
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit6360d2ddab46ca3a5bfdee041076ce29
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6360d2ddab46ca3a5bfdee041076ce29', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0a3d454651d6deff44f80df71299afa8', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6360d2ddab46ca3a5bfdee041076ce29', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0a3d454651d6deff44f80df71299afa8', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0a3d454651d6deff44f80df71299afa8::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit0a3d454651d6deff44f80df71299afa8::$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 ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29
|
||||
class ComposerStaticInit0a3d454651d6deff44f80df71299afa8
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3085,9 +3085,9 @@ class ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6360d2ddab46ca3a5bfdee041076ce29::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0a3d454651d6deff44f80df71299afa8::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0a3d454651d6deff44f80df71299afa8::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0a3d454651d6deff44f80df71299afa8::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user