Updated Rector to commit c4bab4a7778e11715d720391c5daaa7a89e975ce

c4bab4a777 Remove next from ExplicitBoolCompareRector (#3857)
This commit is contained in:
Tomas Votruba 2023-05-15 12:33:28 +00:00
parent dca2603280
commit 8dce3beed1
6 changed files with 14 additions and 30 deletions

View File

@ -6,6 +6,7 @@ namespace Rector\NodeNestingScope\ValueObject;
use PhpParser\Node;
use PhpParser\Node\Expr\Match_;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Case_;
use PhpParser\Node\Stmt\Catch_;
use PhpParser\Node\Stmt\Do_;
@ -28,7 +29,7 @@ final class ControlStructure
*/
public const CONDITIONAL_NODE_SCOPE_TYPES = [If_::class, While_::class, Do_::class, Else_::class, ElseIf_::class, Catch_::class, Case_::class, Match_::class, Switch_::class, Foreach_::class];
/**
* @var array<class-string<Node>>
* @var array<class-string<Stmt>>
*/
public const LOOP_NODES = [For_::class, Foreach_::class, While_::class, Do_::class];
}

View File

@ -23,9 +23,7 @@ use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\ElseIf_;
use PhpParser\Node\Stmt\If_;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer;
use Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -113,24 +111,9 @@ CODE_SAMPLE
if (!$binaryOp instanceof BinaryOp) {
return null;
}
$nextNode = $node->getAttribute(AttributeKey::NEXT_NODE);
// avoid duplicated ifs when combined with ChangeOrIfReturnToEarlyReturnRector
if ($this->shouldSkip($conditionStaticType, $binaryOp, $nextNode)) {
return null;
}
$node->cond = $binaryOp;
return $node;
}
private function shouldSkip(Type $conditionStaticType, BinaryOp $binaryOp, ?Node $nextNode) : bool
{
if (!$conditionStaticType->isString()->yes()) {
return \false;
}
if (!$binaryOp instanceof BooleanOr) {
return \false;
}
return !$nextNode instanceof Node;
}
private function resolveNewConditionNode(Expr $expr, bool $isNegated) : ?BinaryOp
{
if ($expr instanceof FuncCall && $this->nodeNameResolver->isName($expr, 'count')) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'f5d809ca431215d512bb0ba3894bab4543afb396';
public const PACKAGE_VERSION = 'c4bab4a7778e11715d720391c5daaa7a89e975ce';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-15 12:15:45';
public const RELEASE_DATE = '2023-05-15 12:29:37';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0b1c1df6018da3caffb4cb03f14fa863
class ComposerAutoloaderInitcecd15babe98801de8f382510ac3b5f9
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0b1c1df6018da3caffb4cb03f14fa863
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0b1c1df6018da3caffb4cb03f14fa863', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitcecd15babe98801de8f382510ac3b5f9', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit0b1c1df6018da3caffb4cb03f14fa863', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitcecd15babe98801de8f382510ac3b5f9', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitcecd15babe98801de8f382510ac3b5f9::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitcecd15babe98801de8f382510ac3b5f9::$files;
$requireFile = \Closure::bind(static function ($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 ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863
class ComposerStaticInitcecd15babe98801de8f382510ac3b5f9
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3105,9 +3105,9 @@ class ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0b1c1df6018da3caffb4cb03f14fa863::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitcecd15babe98801de8f382510ac3b5f9::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcecd15babe98801de8f382510ac3b5f9::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcecd15babe98801de8f382510ac3b5f9::$classMap;
}, null, ClassLoader::class);
}