Skip to content

Commit

Permalink
Updated Rector to commit 89d2c9c4eb2bfddc226136899b1fdb0a99d19a8a
Browse files Browse the repository at this point in the history
rectorphp/rector-src@89d2c9c [Php72] Remove usage on PrivatesAccessor on AnonymousFunctionFactory (#5367)
  • Loading branch information
TomasVotruba committed Dec 17, 2023
1 parent aba5aec commit 785ac22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
18 changes: 2 additions & 16 deletions rules/Php72/NodeFactory/AnonymousFunctionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand Down Expand Up @@ -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
Expand All @@ -97,7 +90,7 @@ final class AnonymousFunctionFactory
* @see https://regex101.com/r/jkLLlM/2
*/
private const DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?<number>\\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;
Expand All @@ -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;
}
/**
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 785ac22

Please sign in to comment.