Updated Rector to commit 7842486329539de6901544f0e50707b6a2aea29e

7842486329 Fix few rules reporting in case of no change (#3090)
This commit is contained in:
Tomas Votruba 2022-11-24 14:41:27 +00:00
parent 4a64f39171
commit d446f7302b
8 changed files with 45 additions and 28 deletions

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit16909d68f5b1c4b446753963fc2bc097
class ComposerAutoloaderInit5431ef5b65d8564ec5c79889cedc4fad
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit16909d68f5b1c4b446753963fc2bc097
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit16909d68f5b1c4b446753963fc2bc097', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit5431ef5b65d8564ec5c79889cedc4fad', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit16909d68f5b1c4b446753963fc2bc097', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit5431ef5b65d8564ec5c79889cedc4fad', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit16909d68f5b1c4b446753963fc2bc097::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit16909d68f5b1c4b446753963fc2bc097::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire16909d68f5b1c4b446753963fc2bc097($fileIdentifier, $file);
composerRequire5431ef5b65d8564ec5c79889cedc4fad($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit16909d68f5b1c4b446753963fc2bc097
* @param string $file
* @return void
*/
function composerRequire16909d68f5b1c4b446753963fc2bc097($fileIdentifier, $file)
function composerRequire5431ef5b65d8564ec5c79889cedc4fad($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 ComposerStaticInit16909d68f5b1c4b446753963fc2bc097
class ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3037,9 +3037,9 @@ class ComposerStaticInit16909d68f5b1c4b446753963fc2bc097
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit16909d68f5b1c4b446753963fc2bc097::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit16909d68f5b1c4b446753963fc2bc097::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit16909d68f5b1c4b446753963fc2bc097::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5431ef5b65d8564ec5c79889cedc4fad::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2061,12 +2061,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "26c3b12fc7a444cab6d1805fe278d081ca92a505"
"reference": "32267bc92852020356dcf6c886e5ec3cf82aacc1"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/26c3b12fc7a444cab6d1805fe278d081ca92a505",
"reference": "26c3b12fc7a444cab6d1805fe278d081ca92a505",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/32267bc92852020356dcf6c886e5ec3cf82aacc1",
"reference": "32267bc92852020356dcf6c886e5ec3cf82aacc1",
"shasum": ""
},
"require": {
@ -2097,7 +2097,7 @@
"symplify\/rule-doc-generator": "^11.1",
"symplify\/vendor-patches": "^11.1"
},
"time": "2022-11-23T07:25:05+00:00",
"time": "2022-11-24T14:26:16+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a09528'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 769064f'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 26c3b12'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a09528'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 769064f'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 32267bc'));
private function __construct()
{
}

View File

@ -76,21 +76,29 @@ CODE_SAMPLE
if (!$this->nodeNameResolver->isName($node, 'execute')) {
return null;
}
foreach ($this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($node, [Return_::class]) as $returnNode) {
if (!$returnNode->expr instanceof LNumber) {
$hasChanged = \false;
/** @var Return_[] $returns */
$returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($node, [Return_::class]);
foreach ($returns as $return) {
if (!$return->expr instanceof LNumber) {
continue;
}
$returnNode->expr = $this->convertNumberToConstant($returnNode->expr);
$classConstFetch = $this->convertNumberToConstant($return->expr);
if (!$classConstFetch instanceof ClassConstFetch) {
continue;
}
$hasChanged = \true;
$return->expr = $classConstFetch;
}
return $node;
if ($hasChanged) {
return $node;
}
return null;
}
/**
* @return \PhpParser\Node\Expr\ClassConstFetch|\PhpParser\Node\Scalar\LNumber
*/
private function convertNumberToConstant(LNumber $lNumber)
private function convertNumberToConstant(LNumber $lNumber) : ?ClassConstFetch
{
if (!isset(SymfonyCommandConstantMap::RETURN_TO_CONST[$lNumber->value])) {
return $lNumber;
return null;
}
return $this->nodeFactory->createShortClassConstFetch('Command', SymfonyCommandConstantMap::RETURN_TO_CONST[$lNumber->value]);
}

View File

@ -28,6 +28,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
*/
final class ConsoleExecuteReturnIntRector extends AbstractRector
{
/**
* @var bool
*/
private $hasChanged = \false;
/**
* @readonly
* @var \Rector\Core\NodeAnalyzer\TerminatedNodeAnalyzer
@ -83,7 +87,10 @@ CODE_SAMPLE
}
$this->refactorReturnTypeDeclaration($node);
$this->addReturn0ToMethod($node);
return $node;
if ($this->hasChanged) {
return $node;
}
return null;
}
private function refactorReturnTypeDeclaration(ClassMethod $classMethod) : void
{
@ -92,6 +99,7 @@ CODE_SAMPLE
return;
}
$classMethod->returnType = new Identifier('int');
$this->hasChanged = \true;
}
private function addReturn0ToMethod(ClassMethod $classMethod) : void
{
@ -120,6 +128,7 @@ CODE_SAMPLE
$hasReturn = \true;
}
$this->setReturnTo0InsteadOfNull($node);
$this->hasChanged = \true;
return null;
});
$this->processReturn0ToMethod($hasReturn, $classMethod);