From d495dc4fe7b295f90b067cf939dff0704174b753 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 8 Apr 2024 13:35:12 +0000 Subject: [PATCH] Updated Rector to commit a67952f6d15ef954da70898c58aa10567b51c11e https://github.com/rectorphp/rector-src/commit/a67952f6d15ef954da70898c58aa10567b51c11e [Php81] Skip on property and class const on FirstClassCallableRector (#5813) --- .../Php81/Rector/Array_/FirstClassCallableRector.php | 12 +++++++++--- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/rules/Php81/Rector/Array_/FirstClassCallableRector.php b/rules/Php81/Rector/Array_/FirstClassCallableRector.php index a89e8bea4ae..38670f99312 100644 --- a/rules/Php81/Rector/Array_/FirstClassCallableRector.php +++ b/rules/Php81/Rector/Array_/FirstClassCallableRector.php @@ -10,7 +10,10 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\Property; use PhpParser\Node\VariadicPlaceholder; +use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; @@ -79,14 +82,17 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [Array_::class]; + return [Property::class, ClassConst::class, Array_::class]; } /** - * @param Array_ $node - * @return null|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall + * @param Property|ClassConst|Array_ $node + * @return int|null|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall */ public function refactorWithScope(Node $node, Scope $scope) { + if ($node instanceof Property || $node instanceof ClassConst) { + return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + } $arrayCallable = $this->arrayCallableMethodMatcher->match($node, $scope); if (!$arrayCallable instanceof ArrayCallable) { return null; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index af9af09b87b..cb0f236e708 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 = '1bbb3faaed01bd234f8e53564d1686529551e75a'; + public const PACKAGE_VERSION = 'a67952f6d15ef954da70898c58aa10567b51c11e'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-04-08 20:16:33'; + public const RELEASE_DATE = '2024-04-08 20:32:48'; /** * @var int */