From ed1dba1541fa2167c8fd3b89aef36e2304152a59 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 3 Aug 2023 17:04:00 +0000 Subject: [PATCH] Updated Rector to commit 8f6b3660d0aeee1c44fd9726c97429900863d460 https://github.com/rectorphp/rector-src/commit/8f6b3660d0aeee1c44fd9726c97429900863d460 [Strict] Skip docblock on DisallowedShortTernaryRuleFixerRector (#4639) --- .../DisallowedShortTernaryRuleFixerRector.php | 13 +++++++++++-- src/Application/VersionResolver.php | 4 ++-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++++----- vendor/composer/autoload_static.php | 8 ++++---- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php b/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php index 6d37301ddb02..8c62c7153a38 100644 --- a/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php +++ b/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php @@ -25,6 +25,10 @@ final class DisallowedShortTernaryRuleFixerRector extends AbstractFalsyScalarRul * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ private $exactCompareFactory; + /** + * @var bool + */ + private $hasChanged = \false; public function __construct(ExactCompareFactory $exactCompareFactory) { $this->exactCompareFactory = $exactCompareFactory; @@ -64,6 +68,7 @@ public function getNodeTypes() : array */ public function refactorWithScope(Node $node, Scope $scope) : ?Ternary { + $this->hasChanged = \false; // skip non-short ternary if ($node->if instanceof Expr) { return null; @@ -71,9 +76,12 @@ public function refactorWithScope(Node $node, Scope $scope) : ?Ternary // special case for reset() function if ($node->cond instanceof FuncCall && $this->isName($node->cond, 'reset')) { $this->refactorResetFuncCall($node, $node->cond, $scope); + if (!$this->hasChanged) { + return null; + } return $node; } - $exprType = $scope->getType($node->cond); + $exprType = $scope->getNativeType($node->cond); $compareExpr = $this->exactCompareFactory->createNotIdenticalFalsyCompare($exprType, $node->cond, $this->treatAsNonEmpty); if (!$compareExpr instanceof Expr) { return null; @@ -89,11 +97,12 @@ private function refactorResetFuncCall(Ternary $ternary, FuncCall $resetFuncCall return; } $firstArgValue = $resetFuncCall->getArgs()[0]->value; - $firstArgType = $scope->getType($firstArgValue); + $firstArgType = $scope->getNativeType($firstArgValue); $falsyCompareExpr = $this->exactCompareFactory->createNotIdenticalFalsyCompare($firstArgType, $firstArgValue, $this->treatAsNonEmpty); if (!$falsyCompareExpr instanceof Expr) { return; } $ternary->cond = $falsyCompareExpr; + $this->hasChanged = \true; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index fccfc1c9dfef..e0e6e15c7658 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '3c2fab22122dbab967154f433c93c61ec5532de5'; + public const PACKAGE_VERSION = '8f6b3660d0aeee1c44fd9726c97429900863d460'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-08-03 23:52:42'; + public const RELEASE_DATE = '2023-08-03 23:59:42'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 2c57adc374e2..fca9a10ebdf7 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitfc6ab4c5bef69bf42aa1c48df22fadef::getLoader(); +return ComposerAutoloaderInit7821f85399c2831bc3d31048dd9e8c2c::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index ef23f80fecd9..d7634ceb9c29 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitfc6ab4c5bef69bf42aa1c48df22fadef +class ComposerAutoloaderInit7821f85399c2831bc3d31048dd9e8c2c { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitfc6ab4c5bef69bf42aa1c48df22fadef', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit7821f85399c2831bc3d31048dd9e8c2c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitfc6ab4c5bef69bf42aa1c48df22fadef', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit7821f85399c2831bc3d31048dd9e8c2c', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 8118f13fb04a..8badfdc9f528 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef +class ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3025,9 +3025,9 @@ class ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitfc6ab4c5bef69bf42aa1c48df22fadef::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit7821f85399c2831bc3d31048dd9e8c2c::$classMap; }, null, ClassLoader::class); }