mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
Updated Rector to commit 3b47c3a8179f27def6ee602b97024f89b3847352
3b47c3a817
[Php80] Fix NullsafeOperatorRector on no result usage (#838)
This commit is contained in:
parent
3ce615d525
commit
e0d2b3e720
@ -9,6 +9,7 @@ use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\Coalesce;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\NullsafeMethodCall;
|
||||
use PhpParser\Node\Expr\NullsafePropertyFetch;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
@ -30,10 +31,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class NullsafeOperatorRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const NAME = 'name';
|
||||
/**
|
||||
* @var \Rector\Core\NodeManipulator\IfManipulator
|
||||
*/
|
||||
@ -200,16 +197,25 @@ CODE_SAMPLE
|
||||
}
|
||||
private function shouldProcessAssignInCurrentNode(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node $nextNode) : bool
|
||||
{
|
||||
if (!\property_exists($assign->expr, self::NAME)) {
|
||||
if (!$nextNode instanceof \PhpParser\Node\Stmt\Return_ && !$nextNode instanceof \PhpParser\Node\Stmt\Expression) {
|
||||
return \false;
|
||||
}
|
||||
if (!\property_exists($nextNode, 'expr')) {
|
||||
if ($nextNode->expr instanceof \PhpParser\Node\Expr\Assign) {
|
||||
return \false;
|
||||
}
|
||||
if (!\property_exists($nextNode->expr, self::NAME)) {
|
||||
if (!$nextNode->expr instanceof \PhpParser\Node) {
|
||||
return \false;
|
||||
}
|
||||
return !$this->valueResolver->isNull($nextNode->expr);
|
||||
if (!$assign->expr instanceof \PhpParser\Node\Expr\MethodCall && !$assign->expr instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
return !$this->valueResolver->isNull($nextNode->expr);
|
||||
}
|
||||
if (!$nextNode->expr instanceof \PhpParser\Node\Expr\MethodCall && !$nextNode->expr instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
return !$this->valueResolver->isNull($nextNode->expr);
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($assign->expr->var, $nextNode->expr->var)) {
|
||||
return !$this->valueResolver->isNull($nextNode->expr);
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function processIfMayInNextNode(?\PhpParser\Node $nextNode = null) : ?\PhpParser\Node
|
||||
{
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'df9246c6094f472f9a889104ccf173f7008fc90a';
|
||||
public const PACKAGE_VERSION = '3b47c3a8179f27def6ee602b97024f89b3847352';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-09-06 05:46:19';
|
||||
public const RELEASE_DATE = '2021-09-06 09:08:38';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210906\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5::getLoader();
|
||||
return ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8::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 ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5
|
||||
class ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireae62d22a47f1b1d9ddb7fa41f794d3b5($fileIdentifier, $file);
|
||||
composerRequire280f242eda43f5768d6d4f4a2cfb37a8($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequireae62d22a47f1b1d9ddb7fa41f794d3b5($fileIdentifier, $file)
|
||||
function composerRequire280f242eda43f5768d6d4f4a2cfb37a8($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5
|
||||
class ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -3856,9 +3856,9 @@ class ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitae62d22a47f1b1d9ddb7fa41f794d3b5::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit280f242eda43f5768d6d4f4a2cfb37a8::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20210906\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5', false) && !interface_exists('ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5', false) && !trait_exists('ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5', false)) {
|
||||
spl_autoload_call('RectorPrefix20210906\ComposerAutoloaderInitae62d22a47f1b1d9ddb7fa41f794d3b5');
|
||||
if (!class_exists('ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8', false) && !interface_exists('ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8', false) && !trait_exists('ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8', false)) {
|
||||
spl_autoload_call('RectorPrefix20210906\ComposerAutoloaderInit280f242eda43f5768d6d4f4a2cfb37a8');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20210906\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210906\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequireae62d22a47f1b1d9ddb7fa41f794d3b5')) {
|
||||
function composerRequireae62d22a47f1b1d9ddb7fa41f794d3b5() {
|
||||
return \RectorPrefix20210906\composerRequireae62d22a47f1b1d9ddb7fa41f794d3b5(...func_get_args());
|
||||
if (!function_exists('composerRequire280f242eda43f5768d6d4f4a2cfb37a8')) {
|
||||
function composerRequire280f242eda43f5768d6d4f4a2cfb37a8() {
|
||||
return \RectorPrefix20210906\composerRequire280f242eda43f5768d6d4f4a2cfb37a8(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user