From eae5c53485a0586caebe032c6d1e38a3b06abc79 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 May 2023 16:35:30 +0000 Subject: [PATCH] Updated Rector to commit 265d627ddf7663fe65bfda2aa4cf32fc4a3ba95d https://github.com/rectorphp/rector-src/commit/265d627ddf7663fe65bfda2aa4cf32fc4a3ba95d Remove IsObjectOnIncompleteClassRector as blindly turns all incomplete checks to negated, better examine manually (#3969) --- config/set/php72.php | 12 +--- .../ReturnArrayClassMethodToYieldRector.php | 7 -- .../Stmt/NewlineAfterStatementRector.php | 1 - .../IsObjectOnIncompleteClassRector.php | 72 ------------------- src/Application/VersionResolver.php | 4 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_real.php | 10 +-- vendor/composer/autoload_static.php | 9 ++- 9 files changed, 13 insertions(+), 105 deletions(-) delete mode 100644 rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php diff --git a/config/set/php72.php b/config/set/php72.php index 5c45711328f..db55178c41a 100644 --- a/config/set/php72.php +++ b/config/set/php72.php @@ -8,7 +8,6 @@ use Rector\Php72\Rector\Assign\ListEachRector; use Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector; use Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector; use Rector\Php72\Rector\FuncCall\GetClassOnNullRector; -use Rector\Php72\Rector\FuncCall\IsObjectOnIncompleteClassRector; use Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector; use Rector\Php72\Rector\FuncCall\StringifyDefineRector; use Rector\Php72\Rector\FuncCall\StringsAssertNakedRector; @@ -16,10 +15,6 @@ use Rector\Php72\Rector\Unset_\UnsetCastRector; use Rector\Php72\Rector\While_\WhileEachToForeachRector; use Rector\Renaming\Rector\FuncCall\RenameFunctionRector; return static function (RectorConfig $rectorConfig) : void { - $rectorConfig->rule(WhileEachToForeachRector::class); - $rectorConfig->rule(ListEachRector::class); - $rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class); - $rectorConfig->rule(UnsetCastRector::class); $rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [ # and imagewbmp 'jpeg2wbmp' => 'imagecreatefromjpeg', @@ -31,10 +26,5 @@ return static function (RectorConfig $rectorConfig) : void { 'gmp_random' => 'gmp_random_bits', 'read_exif_data' => 'exif_read_data', ]); - $rectorConfig->rule(GetClassOnNullRector::class); - $rectorConfig->rule(IsObjectOnIncompleteClassRector::class); - $rectorConfig->rule(ParseStrWithResultArgumentRector::class); - $rectorConfig->rule(StringsAssertNakedRector::class); - $rectorConfig->rule(CreateFunctionToAnonymousFunctionRector::class); - $rectorConfig->rule(StringifyDefineRector::class); + $rectorConfig->rules([GetClassOnNullRector::class, ParseStrWithResultArgumentRector::class, StringsAssertNakedRector::class, CreateFunctionToAnonymousFunctionRector::class, StringifyDefineRector::class, WhileEachToForeachRector::class, ListEachRector::class, ReplaceEachAssignmentWithKeyCurrentRector::class, UnsetCastRector::class]); }; diff --git a/rules/CodingStyle/Rector/ClassMethod/ReturnArrayClassMethodToYieldRector.php b/rules/CodingStyle/Rector/ClassMethod/ReturnArrayClassMethodToYieldRector.php index 70a226c2956..5b8c5c1e36f 100644 --- a/rules/CodingStyle/Rector/ClassMethod/ReturnArrayClassMethodToYieldRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/ReturnArrayClassMethodToYieldRector.php @@ -12,10 +12,8 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; use Rector\BetterPhpDocParser\Comment\CommentsMerger; use Rector\CodingStyle\ValueObject\ReturnArrayClassMethodToYield; use Rector\Core\Contract\Rector\ConfigurableRectorInterface; -use Rector\Core\Exception\ShouldNotHappenException; use Rector\Core\PhpParser\NodeTransformer; use Rector\Core\Rector\AbstractRector; -use Rector\NodeTypeResolver\Node\AttributeKey; use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use RectorPrefix202305\Webmozart\Assert\Assert; @@ -132,11 +130,6 @@ CODE_SAMPLE private function transformArrayToYieldsOnMethodNode(ClassMethod $classMethod, Array_ $array) : void { $yieldNodes = $this->nodeTransformer->transformArrayToYields($array); - // remove whole return node - $parentNode = $array->getAttribute(AttributeKey::PARENT_NODE); - if (!$parentNode instanceof Node) { - throw new ShouldNotHappenException(); - } $this->removeReturnTag($classMethod); // change return typehint $classMethod->returnType = new FullyQualified('Iterator'); diff --git a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php index aece66d98e7..656ca07f734 100644 --- a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php +++ b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php @@ -11,7 +11,6 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Do_; -use PhpParser\Node\Stmt\ElseIf_; use PhpParser\Node\Stmt\For_; use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\Function_; diff --git a/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php b/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php deleted file mode 100644 index 0cc42be4f9e..00000000000 --- a/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php +++ /dev/null @@ -1,72 +0,0 @@ -> - */ - public function getNodeTypes() : array - { - return [FuncCall::class]; - } - /** - * @param FuncCall $node - */ - public function refactor(Node $node) : ?Node - { - if (!$this->isName($node, 'is_object')) { - return null; - } - $incompleteClassObjectType = new ObjectType('__PHP_Incomplete_Class'); - if (!isset($node->getArgs()[0])) { - return null; - } - if ($this->shouldSkip($node)) { - return null; - } - $firstArg = $node->getArgs()[0]; - if (!$this->isObjectType($firstArg->value, $incompleteClassObjectType)) { - return null; - } - return new BooleanNot($node); - } - private function shouldSkip(FuncCall $funcCall) : bool - { - $parentNode = $funcCall->getAttribute(AttributeKey::PARENT_NODE); - return $parentNode instanceof BooleanNot; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 1707296c11d..da08ed651d9 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 = 'd99713c7d55f25612440948b8a85b5b99e0b0e11'; + public const PACKAGE_VERSION = '265d627ddf7663fe65bfda2aa4cf32fc4a3ba95d'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-05-25 15:35:39'; + public const RELEASE_DATE = '2023-05-25 16:30:45'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index ad0d7f53467..52476b8d925 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit1f089665787b0dbf2a8505138aab450d::getLoader(); +return ComposerAutoloaderInitcac939f8e7bc0f49a57b3d0f2b1e892c::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 31489f2929d..46bb035e17e 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2207,7 +2207,6 @@ return array( 'Rector\\Php72\\Rector\\Assign\\ReplaceEachAssignmentWithKeyCurrentRector' => $baseDir . '/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php', 'Rector\\Php72\\Rector\\FuncCall\\CreateFunctionToAnonymousFunctionRector' => $baseDir . '/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php', 'Rector\\Php72\\Rector\\FuncCall\\GetClassOnNullRector' => $baseDir . '/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php', - 'Rector\\Php72\\Rector\\FuncCall\\IsObjectOnIncompleteClassRector' => $baseDir . '/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php', 'Rector\\Php72\\Rector\\FuncCall\\ParseStrWithResultArgumentRector' => $baseDir . '/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php', 'Rector\\Php72\\Rector\\FuncCall\\StringifyDefineRector' => $baseDir . '/rules/Php72/Rector/FuncCall/StringifyDefineRector.php', 'Rector\\Php72\\Rector\\FuncCall\\StringsAssertNakedRector' => $baseDir . '/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 1afdf1ce004..50577658989 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit1f089665787b0dbf2a8505138aab450d +class ComposerAutoloaderInitcac939f8e7bc0f49a57b3d0f2b1e892c { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit1f089665787b0dbf2a8505138aab450d return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit1f089665787b0dbf2a8505138aab450d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitcac939f8e7bc0f49a57b3d0f2b1e892c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit1f089665787b0dbf2a8505138aab450d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitcac939f8e7bc0f49a57b3d0f2b1e892c', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit1f089665787b0dbf2a8505138aab450d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit1f089665787b0dbf2a8505138aab450d::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c::$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 d47eb8a7103..5dee6670da7 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit1f089665787b0dbf2a8505138aab450d +class ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2449,7 +2449,6 @@ class ComposerStaticInit1f089665787b0dbf2a8505138aab450d 'Rector\\Php72\\Rector\\Assign\\ReplaceEachAssignmentWithKeyCurrentRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php', 'Rector\\Php72\\Rector\\FuncCall\\CreateFunctionToAnonymousFunctionRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php', 'Rector\\Php72\\Rector\\FuncCall\\GetClassOnNullRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php', - 'Rector\\Php72\\Rector\\FuncCall\\IsObjectOnIncompleteClassRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php', 'Rector\\Php72\\Rector\\FuncCall\\ParseStrWithResultArgumentRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php', 'Rector\\Php72\\Rector\\FuncCall\\StringifyDefineRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/StringifyDefineRector.php', 'Rector\\Php72\\Rector\\FuncCall\\StringsAssertNakedRector' => __DIR__ . '/../..' . '/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php', @@ -3096,9 +3095,9 @@ class ComposerStaticInit1f089665787b0dbf2a8505138aab450d public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit1f089665787b0dbf2a8505138aab450d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit1f089665787b0dbf2a8505138aab450d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit1f089665787b0dbf2a8505138aab450d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitcac939f8e7bc0f49a57b3d0f2b1e892c::$classMap; }, null, ClassLoader::class); }