Skip to content

Commit

Permalink
[Php72] Remove usage on PrivatesAccessor on AnonymousFunctionFactory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik authored Dec 17, 2023
1 parent aa52c4e commit 89d2c9c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions rules/Php72/NodeFactory/AnonymousFunctionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,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 All @@ -63,7 +61,6 @@ public function __construct(
private readonly SimpleCallableNodeTraverser $simpleCallableNodeTraverser,
private readonly SimplePhpParser $simplePhpParser,
private readonly AstResolver $astResolver,
private readonly PrivatesAccessor $privatesAccessor,
private readonly InlineCodeParser $inlineCodeParser
) {
}
Expand Down Expand Up @@ -260,7 +257,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);
}
Expand All @@ -280,13 +277,6 @@ private function resolveParamType(ParameterReflection $parameterReflection): Nam
);
}

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,
Expand Down

0 comments on commit 89d2c9c

Please sign in to comment.