From 785ac22e3387abd84f9f7976621a9403b8ea29d8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 17 Dec 2023 06:37:00 +0000 Subject: [PATCH] Updated Rector to commit 89d2c9c4eb2bfddc226136899b1fdb0a99d19a8a https://github.com/rectorphp/rector-src/commit/89d2c9c4eb2bfddc226136899b1fdb0a99d19a8a [Php72] Remove usage on PrivatesAccessor on AnonymousFunctionFactory (#5367) --- .../NodeFactory/AnonymousFunctionFactory.php | 18 ++---------------- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php index 8508d4411107..7e25aea86d1c 100644 --- a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php @@ -38,13 +38,11 @@ use Rector\Core\PhpParser\Node\NodeFactory; use Rector\Core\PhpParser\Parser\InlineCodeParser; use Rector\Core\PhpParser\Parser\SimplePhpParser; -use Rector\Core\Util\Reflection\PrivatesAccessor; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\StaticTypeMapper\StaticTypeMapper; -use ReflectionParameter; final class AnonymousFunctionFactory { /** @@ -82,11 +80,6 @@ final class AnonymousFunctionFactory * @var \Rector\Core\PhpParser\AstResolver */ private $astResolver; - /** - * @readonly - * @var \Rector\Core\Util\Reflection\PrivatesAccessor - */ - private $privatesAccessor; /** * @readonly * @var \Rector\Core\PhpParser\Parser\InlineCodeParser @@ -97,7 +90,7 @@ final class AnonymousFunctionFactory * @see https://regex101.com/r/jkLLlM/2 */ private const DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?\\d+)#'; - public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, NodeFactory $nodeFactory, StaticTypeMapper $staticTypeMapper, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, SimplePhpParser $simplePhpParser, AstResolver $astResolver, PrivatesAccessor $privatesAccessor, InlineCodeParser $inlineCodeParser) + public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, NodeFactory $nodeFactory, StaticTypeMapper $staticTypeMapper, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, SimplePhpParser $simplePhpParser, AstResolver $astResolver, InlineCodeParser $inlineCodeParser) { $this->nodeNameResolver = $nodeNameResolver; $this->betterNodeFinder = $betterNodeFinder; @@ -106,7 +99,6 @@ public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; $this->simplePhpParser = $simplePhpParser; $this->astResolver = $astResolver; - $this->privatesAccessor = $privatesAccessor; $this->inlineCodeParser = $inlineCodeParser; } /** @@ -245,7 +237,7 @@ private function createParams(PhpMethodReflection $phpMethodReflection, array $p $variable = new Variable($parameterReflection->getName()); $defaultExpr = $this->resolveParamDefaultExpr($parameterReflection, $key, $classMethod); $type = $this->resolveParamType($parameterReflection); - $byRef = $this->isParamByReference($parameterReflection); + $byRef = $parameterReflection->passedByReference()->yes(); $params[] = new Param($variable, $defaultExpr, $type, $byRef); } return $params; @@ -260,12 +252,6 @@ private function resolveParamType(ParameterReflection $parameterReflection) } return $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($parameterReflection->getType(), TypeKind::PARAM); } - private function isParamByReference(ParameterReflection $parameterReflection) : bool - { - /** @var ReflectionParameter $reflection */ - $reflection = $this->privatesAccessor->getPrivateProperty($parameterReflection, 'reflection'); - return $reflection->isPassedByReference(); - } private function resolveParamDefaultExpr(ParameterReflection $parameterReflection, int $key, ClassMethod $classMethod) : ?Expr { if (!$parameterReflection->getDefaultValue() instanceof Type) { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 1561b6a38d52..9b4089664b87 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 = 'aa52c4ecedb83773b12c4d3b2906ba36601057ba'; + public const PACKAGE_VERSION = '89d2c9c4eb2bfddc226136899b1fdb0a99d19a8a'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-12-17 13:05:17'; + public const RELEASE_DATE = '2023-12-17 13:34:46'; /** * @var int */