From 314c192af39cadc2286d497cae8043c74cb9b060 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 17 Aug 2023 10:13:30 +0000 Subject: [PATCH] Updated Rector to commit bbd2e81b171f50d05ef73d63518cb1a31fdd7cd5 https://github.com/rectorphp/rector-src/commit/bbd2e81b171f50d05ef73d63518cb1a31fdd7cd5 Merge many Skipper tests to one, cleanup phpstan errors (#4806) --- .../Caching/ValueObject/Storage/FileCacheStorage.php | 3 +++ .../PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php | 2 +- .../PhpDocParser/NodeVisitor/CallableNodeVisitor.php | 3 +++ packages/Skipper/Skipper/Skipper.php | 2 +- .../ParentClassMethodTypeOverrideGuard.php | 1 - ...rnTypeDeclarationBasedOnParentClassMethodRector.php | 1 - src/Application/VersionResolver.php | 4 ++-- src/PhpParser/NodeTraverser/RectorNodeTraverser.php | 5 ++--- src/Rector/AbstractRector.php | 4 ++++ src/ValueObject/Application/File.php | 6 +++--- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++++----- vendor/composer/autoload_static.php | 8 ++++---- 13 files changed, 29 insertions(+), 22 deletions(-) diff --git a/packages/Caching/ValueObject/Storage/FileCacheStorage.php b/packages/Caching/ValueObject/Storage/FileCacheStorage.php index 7737d5f3af14..4484beb7c279 100644 --- a/packages/Caching/ValueObject/Storage/FileCacheStorage.php +++ b/packages/Caching/ValueObject/Storage/FileCacheStorage.php @@ -31,6 +31,9 @@ public function __construct(string $directory, \RectorPrefix202308\Symfony\Compo $this->directory = $directory; $this->filesystem = $filesystem; } + /** + * @return mixed + */ public function load(string $key, string $variableKey) { return (function (string $key, string $variableKey) { diff --git a/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php b/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php index a27d9d58ab20..1d6e6b324290 100644 --- a/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php +++ b/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php @@ -16,7 +16,7 @@ final class StmtKeyNodeVisitor extends NodeVisitorAbstract implements ScopeResol /** * @param Node[] $nodes */ - public function beforeTraverse(array $nodes) + public function beforeTraverse(array $nodes) : ?array { if ($nodes === []) { return null; diff --git a/packages/PhpDocParser/NodeVisitor/CallableNodeVisitor.php b/packages/PhpDocParser/NodeVisitor/CallableNodeVisitor.php index 32e8f68cd703..fe0b4045eba5 100644 --- a/packages/PhpDocParser/NodeVisitor/CallableNodeVisitor.php +++ b/packages/PhpDocParser/NodeVisitor/CallableNodeVisitor.php @@ -26,6 +26,9 @@ public function __construct(callable $callable) { $this->callable = $callable; } + /** + * @return int|\PhpParser\Node|null + */ public function enterNode(Node $node) { $originalNode = $node; diff --git a/packages/Skipper/Skipper/Skipper.php b/packages/Skipper/Skipper/Skipper.php index a0991cd15273..35ef34a36182 100644 --- a/packages/Skipper/Skipper/Skipper.php +++ b/packages/Skipper/Skipper/Skipper.php @@ -11,7 +11,7 @@ use Rector\Skipper\SkipVoter\PathSkipVoter; /** * @api - * @see \Rector\Tests\Skipper\Skipper\Skipper\SkipperTest + * @see \Rector\Tests\Skipper\Skipper\SkipperTest */ final class Skipper { diff --git a/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php b/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php index dfbe331ce67f..b982aa492d5e 100644 --- a/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php +++ b/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php @@ -12,7 +12,6 @@ use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\TypeComparator\TypeComparator; use Rector\StaticTypeMapper\StaticTypeMapper; -use Rector\Tests\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector\Source\Method; use Rector\VendorLocker\Exception\UnresolvableClassException; final class ParentClassMethodTypeOverrideGuard { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php index 196b3e7dfe3b..5215b6138dc9 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php @@ -12,7 +12,6 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use Rector\Core\Php\PhpVersionProvider; -use Rector\Core\PhpParser\AstResolver; use Rector\Core\Rector\AbstractRector; use Rector\Core\ValueObject\MethodName; use Rector\Core\ValueObject\PhpVersionFeature; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 55131d91694d..1c2d25dc7f83 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 = '0.17.14'; + public const PACKAGE_VERSION = 'bbd2e81b171f50d05ef73d63518cb1a31fdd7cd5'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-08-17 16:03:24'; + public const RELEASE_DATE = '2023-08-17 10:10:32'; /** * @var int */ diff --git a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php index 4c6ae898486a..2560435361ae 100644 --- a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php +++ b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php @@ -32,9 +32,8 @@ public function __construct(array $phpRectors, PhpVersionedFilter $phpVersionedF parent::__construct(); } /** - * @template TNode as Node - * @param TNode[] $nodes - * @return TNode[] + * @param Node[] $nodes + * @return Node[] */ public function traverse(array $nodes) : array { diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index a42f156432ed..1fc239d78db3 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -161,6 +161,9 @@ public function beforeTraverse(array $nodes) : ?array $this->file = $file; return parent::beforeTraverse($nodes); } + /** + * @return int|\PhpParser\Node|null + */ public final function enterNode(Node $node) { if (!$this->isMatchingNodeType($node)) { @@ -215,6 +218,7 @@ public final function enterNode(Node $node) /** * Replacing nodes in leaveNode() method avoids infinite recursion * see"infinite recursion" in https://github.com/nikic/PHP-Parser/blob/master/doc/component/Walking_the_AST.markdown + * @return mixed[]|int|\PhpParser\Node|null */ public function leaveNode(Node $node) { diff --git a/src/ValueObject/Application/File.php b/src/ValueObject/Application/File.php index 37b6fe43f0a1..f3c575513c54 100644 --- a/src/ValueObject/Application/File.php +++ b/src/ValueObject/Application/File.php @@ -35,11 +35,11 @@ final class File */ private $fileDiff; /** - * @var Stmt[] + * @var \PhpParser\Node[] */ private $oldStmts = []; /** - * @var Stmt[] + * @var \PhpParser\Node[] */ private $newStmts = []; /** @@ -128,7 +128,7 @@ public function getOldTokens() : array return $this->oldTokens; } /** - * @param Stmt[] $newStmts + * @param \PhpParser\Node[] $newStmts */ public function changeNewStmts(array $newStmts) : void { diff --git a/vendor/autoload.php b/vendor/autoload.php index 42362f7ee31c..44af3afe67c0 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit505621b1b429be9011c68653da82e274::getLoader(); +return ComposerAutoloaderInitc928f94e7958d7191efcf30da806357c::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 75fb607638cc..d14503631c03 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit505621b1b429be9011c68653da82e274 +class ComposerAutoloaderInitc928f94e7958d7191efcf30da806357c { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit505621b1b429be9011c68653da82e274', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc928f94e7958d7191efcf30da806357c', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit505621b1b429be9011c68653da82e274', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc928f94e7958d7191efcf30da806357c', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit505621b1b429be9011c68653da82e274::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc928f94e7958d7191efcf30da806357c::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit505621b1b429be9011c68653da82e274::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitc928f94e7958d7191efcf30da806357c::$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 34435f0b7980..cd6632c63c6c 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit505621b1b429be9011c68653da82e274 +class ComposerStaticInitc928f94e7958d7191efcf30da806357c { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2637,9 +2637,9 @@ class ComposerStaticInit505621b1b429be9011c68653da82e274 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit505621b1b429be9011c68653da82e274::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit505621b1b429be9011c68653da82e274::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit505621b1b429be9011c68653da82e274::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc928f94e7958d7191efcf30da806357c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc928f94e7958d7191efcf30da806357c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc928f94e7958d7191efcf30da806357c::$classMap; }, null, ClassLoader::class); }