mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 15:00:50 +00:00
Updated Rector to commit d2459d13d512d780cc22f7822bf630717d888969
d2459d13d5
[CodeQuality] Remove next node attribute usage on SimplifyIfNotNullReturnRector (#3517)
This commit is contained in:
parent
4218f60ee4
commit
4e1a8b2170
|
@ -5,12 +5,11 @@ namespace Rector\CodeQuality\Rector\If_;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||
use Rector\Core\NodeManipulator\IfManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -48,28 +47,38 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [If_::class];
|
||||
return [StmtsAwareInterface::class];
|
||||
}
|
||||
/**
|
||||
* @param If_ $node
|
||||
* @param StmtsAwareInterface $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Stmt
|
||||
public function refactor(Node $node) : ?StmtsAwareInterface
|
||||
{
|
||||
$expr = $this->ifManipulator->matchIfNotNullReturnValue($node);
|
||||
if ($expr instanceof Expr) {
|
||||
$insideIfNode = $node->stmts[0];
|
||||
$nextNode = $node->getAttribute(AttributeKey::NEXT_NODE);
|
||||
if (!$nextNode instanceof Return_) {
|
||||
foreach ((array) $node->stmts as $key => $stmt) {
|
||||
if (!$stmt instanceof If_) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($node->stmts[$key + 1])) {
|
||||
return null;
|
||||
}
|
||||
$nextNode = $node->stmts[$key + 1];
|
||||
if (!$nextNode instanceof Return_) {
|
||||
continue;
|
||||
}
|
||||
$expr = $this->ifManipulator->matchIfNotNullReturnValue($stmt);
|
||||
if (!$expr instanceof Expr) {
|
||||
continue;
|
||||
}
|
||||
$insideIfNode = $stmt->stmts[0];
|
||||
if (!$nextNode->expr instanceof Expr) {
|
||||
return null;
|
||||
continue;
|
||||
}
|
||||
if (!$this->valueResolver->isNull($nextNode->expr)) {
|
||||
return null;
|
||||
continue;
|
||||
}
|
||||
$this->removeNode($nextNode);
|
||||
return $insideIfNode;
|
||||
unset($node->stmts[$key]);
|
||||
$node->stmts[$key + 1] = $insideIfNode;
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'da3eb400a7a88c180869590fc6cbbcf0ba30ce11';
|
||||
public const PACKAGE_VERSION = 'd2459d13d512d780cc22f7822bf630717d888969';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-03-24 08:04:18';
|
||||
public const RELEASE_DATE = '2023-03-25 12:11:51';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInitcfc64ce27cb9dee1ff74afed2cee5d57::getLoader();
|
||||
return ComposerAutoloaderInit8ebb5e75f6329cc4bc62f8b010d9b326::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 ComposerAutoloaderInitcfc64ce27cb9dee1ff74afed2cee5d57
|
||||
class ComposerAutoloaderInit8ebb5e75f6329cc4bc62f8b010d9b326
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcfc64ce27cb9dee1ff74afed2cee5d57
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitcfc64ce27cb9dee1ff74afed2cee5d57', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8ebb5e75f6329cc4bc62f8b010d9b326', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitcfc64ce27cb9dee1ff74afed2cee5d57', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8ebb5e75f6329cc4bc62f8b010d9b326', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326::$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 ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57
|
||||
class ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3127,9 +3127,9 @@ class ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitcfc64ce27cb9dee1ff74afed2cee5d57::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8ebb5e75f6329cc4bc62f8b010d9b326::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
12
vendor/composer/installed.json
vendored
12
vendor/composer/installed.json
vendored
|
@ -869,17 +869,17 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan\/phpstan",
|
||||
"version": "1.10.7",
|
||||
"version_normalized": "1.10.7.0",
|
||||
"version": "1.10.8",
|
||||
"version_normalized": "1.10.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
|
||||
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975"
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/b10ceb526d9607903c5b2673f1fc8775dbe48975",
|
||||
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975",
|
||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -888,7 +888,7 @@
|
|||
"conflict": {
|
||||
"phpstan\/phpstan-shim": "*"
|
||||
},
|
||||
"time": "2023-03-16T15:24:20+00:00",
|
||||
"time": "2023-03-24T10:28:16+00:00",
|
||||
"bin": [
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
BIN
vendor/phpstan/phpstan/phpstan.phar
vendored
BIN
vendor/phpstan/phpstan/phpstan.phar
vendored
Binary file not shown.
26
vendor/phpstan/phpstan/phpstan.phar.asc
vendored
26
vendor/phpstan/phpstan/phpstan.phar.asc
vendored
|
@ -1,16 +1,16 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmQTNIwACgkQUcZzBf/C
|
||||
5cAd6w/+Kl1H07bQZ8QT076zFPtXpotRz3t3/CSXcpbrKXKIELBVN5StS6jSCQFb
|
||||
Kt5ef5QBoTk368Da3dC97VwEmex4eJ9zgaRfT+yjc13fVaqhEOx0NXNydRW2rZ1a
|
||||
QEkIDOydqk8hQYvNOaIN6g/I0V9SjJ5yxwquCM8oL555ofP8O5YJIYrPKPuAZn1x
|
||||
UonxEfwDytN71nc9PjGQeDG7SAr2gngjB1mg8ZFzyfcoMWmi0OUzvVMfI+HzhxvW
|
||||
Tja3NOKk1b187Jxoa01xZDrb4y+1AQbRzWs74bjP/5xnMABowaBRQoVL8DxNdlis
|
||||
Cct0PXFbSAVXpk4nkSejhhln2XCvVy958qZzNSt3Hw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Ixgp2a6IUVeeQSrL4kjeHYQDBMzG0P78ZXjXdUl3kYG3TJHmb
|
||||
QNWgYcz3jJJd/F5YSMPpAPT/gpcD4FBnHZ+mlLnGvXvuuGh+MyU=
|
||||
=vW1l
|
||||
-----END PGP SIGNATURE-----
|
||||
|
|
Loading…
Reference in New Issue
Block a user