mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 824df97e93bb43baca8f22a6f6a0f537a0049dd6
824df97e93
[DX] Move from CLASS_METHOD node attribute to parent finder (#1167)
This commit is contained in:
parent
a42ac7439f
commit
b5ad3a2e08
@ -34,7 +34,7 @@ final class AttributeKey
|
|||||||
public const CLASS_NAME = 'className';
|
public const CLASS_NAME = 'className';
|
||||||
/**
|
/**
|
||||||
* @deprecated Use
|
* @deprecated Use
|
||||||
* @see BetterNodeFinder to find your parent nodes.
|
* @see BetterNodeFinder::findParentType($node, ClassLike::class) to find your parent nodes.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -44,6 +44,9 @@ final class AttributeKey
|
|||||||
*/
|
*/
|
||||||
public const METHOD_NAME = 'methodName';
|
public const METHOD_NAME = 'methodName';
|
||||||
/**
|
/**
|
||||||
|
* @deprecated Use
|
||||||
|
* @see BetterNodeFinder::findParentType($node, ClassMethod::class) to find your parent nodes.
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const METHOD_NODE = 'methodNode';
|
public const METHOD_NODE = 'methodNode';
|
||||||
|
@ -15,6 +15,7 @@ use PHPStan\Type\Type;
|
|||||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||||
use Rector\Core\Exception\ShouldNotHappenException;
|
use Rector\Core\Exception\ShouldNotHappenException;
|
||||||
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
use Rector\NodeNameResolver\NodeNameResolver;
|
use Rector\NodeNameResolver\NodeNameResolver;
|
||||||
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
|
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
@ -47,11 +48,16 @@ final class ParamTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeT
|
|||||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||||
*/
|
*/
|
||||||
private $phpDocInfoFactory;
|
private $phpDocInfoFactory;
|
||||||
public function __construct(\RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
|
/**
|
||||||
|
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||||
|
*/
|
||||||
|
private $betterNodeFinder;
|
||||||
|
public function __construct(\RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||||
{
|
{
|
||||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||||
$this->nodeNameResolver = $nodeNameResolver;
|
$this->nodeNameResolver = $nodeNameResolver;
|
||||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||||
|
$this->betterNodeFinder = $betterNodeFinder;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @required
|
* @required
|
||||||
@ -95,7 +101,7 @@ final class ParamTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeT
|
|||||||
}
|
}
|
||||||
private function resolveFromFirstVariableUse(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
|
private function resolveFromFirstVariableUse(\PhpParser\Node\Param $param) : \PHPStan\Type\Type
|
||||||
{
|
{
|
||||||
$classMethod = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return new \PHPStan\Type\MixedType();
|
return new \PHPStan\Type\MixedType();
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,6 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
|||||||
*/
|
*/
|
||||||
final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface
|
final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
private const PARENT_NODE_ATTRIBUTES = [\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE, \Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE];
|
|
||||||
/**
|
/**
|
||||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||||
*/
|
*/
|
||||||
@ -73,26 +69,18 @@ final class VariableTypeResolver implements \Rector\NodeTypeResolver\Contract\No
|
|||||||
}
|
}
|
||||||
private function resolveNodeScope(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
|
private function resolveNodeScope(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
|
||||||
{
|
{
|
||||||
/** @var Scope|null $nodeScope */
|
$scope = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||||
$nodeScope = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
if ($scope instanceof \PHPStan\Analyser\Scope) {
|
||||||
if ($nodeScope !== null) {
|
return $scope;
|
||||||
return $nodeScope;
|
|
||||||
}
|
}
|
||||||
return $this->resolveFromParentNodes($variable);
|
return $this->resolveFromParentNodes($variable);
|
||||||
}
|
}
|
||||||
private function resolveFromParentNodes(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
|
private function resolveFromParentNodes(\PhpParser\Node\Expr\Variable $variable) : ?\PHPStan\Analyser\Scope
|
||||||
{
|
{
|
||||||
foreach (self::PARENT_NODE_ATTRIBUTES as $parentNodeAttribute) {
|
$parent = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||||
$parentNode = $variable->getAttribute($parentNodeAttribute);
|
if (!$parent instanceof \PhpParser\Node) {
|
||||||
if (!$parentNode instanceof \PhpParser\Node) {
|
return null;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$parentNodeScope = $parentNode->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
|
||||||
if (!$parentNodeScope instanceof \PHPStan\Analyser\Scope) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return $parentNodeScope;
|
|
||||||
}
|
}
|
||||||
return null;
|
return $parent->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\PropertyFetch;
|
|||||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||||
use PhpParser\Node\Expr\Ternary;
|
use PhpParser\Node\Expr\Ternary;
|
||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PhpParser\Node\Stmt\Expression;
|
use PhpParser\Node\Stmt\Expression;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\DeadCode\SideEffect\SideEffectNodeDetector;
|
use Rector\DeadCode\SideEffect\SideEffectNodeDetector;
|
||||||
@ -108,6 +109,8 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
private function areInSameClassMethod(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Stmt\Expression $previousExpression) : bool
|
private function areInSameClassMethod(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Stmt\Expression $previousExpression) : bool
|
||||||
{
|
{
|
||||||
return $this->nodeComparator->areNodesEqual($assign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE), $previousExpression->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE));
|
$assignClassMethod = $this->betterNodeFinder->findParentType($assign, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
|
$previousExpressionClassMethod = $this->betterNodeFinder->findParentType($previousExpression, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
|
return $this->nodeComparator->areNodesEqual($assignClassMethod, $previousExpressionClassMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ use PhpParser\Node\Expr\NullsafeMethodCall;
|
|||||||
use PhpParser\Node\Expr\StaticCall;
|
use PhpParser\Node\Expr\StaticCall;
|
||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\FunctionLike;
|
use PhpParser\Node\FunctionLike;
|
||||||
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PhpParser\Node\Stmt\Expression;
|
use PhpParser\Node\Stmt\Expression;
|
||||||
use PhpParser\Node\Stmt\If_;
|
use PhpParser\Node\Stmt\If_;
|
||||||
use Rector\Core\Php\ReservedKeywordAnalyzer;
|
use Rector\Core\Php\ReservedKeywordAnalyzer;
|
||||||
@ -118,7 +119,7 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
private function shouldSkip(\PhpParser\Node\Expr\Assign $assign) : bool
|
private function shouldSkip(\PhpParser\Node\Expr\Assign $assign) : bool
|
||||||
{
|
{
|
||||||
$classMethod = $assign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($assign, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\FunctionLike) {
|
if (!$classMethod instanceof \PhpParser\Node\FunctionLike) {
|
||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ CODE_SAMPLE
|
|||||||
$this->removeNode($node);
|
$this->removeNode($node);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,18 @@ namespace Rector\DependencyInjection\NodeAnalyzer;
|
|||||||
|
|
||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
final class ControllerClassMethodAnalyzer
|
final class ControllerClassMethodAnalyzer
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||||
|
*/
|
||||||
|
private $betterNodeFinder;
|
||||||
|
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||||
|
{
|
||||||
|
$this->betterNodeFinder = $betterNodeFinder;
|
||||||
|
}
|
||||||
public function isInControllerActionMethod(\PhpParser\Node\Expr\Variable $variable) : bool
|
public function isInControllerActionMethod(\PhpParser\Node\Expr\Variable $variable) : bool
|
||||||
{
|
{
|
||||||
/** @var string|null $className */
|
/** @var string|null $className */
|
||||||
@ -18,7 +27,7 @@ final class ControllerClassMethodAnalyzer
|
|||||||
if (\substr_compare($className, 'Controller', -\strlen('Controller')) !== 0) {
|
if (\substr_compare($className, 'Controller', -\strlen('Controller')) !== 0) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
$classMethod = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($variable, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\Property;
|
|||||||
use PHPStan\Type\MixedType;
|
use PHPStan\Type\MixedType;
|
||||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||||
|
use Rector\Core\Exception\ShouldNotHappenException;
|
||||||
use Rector\Core\NodeManipulator\ClassInsertManipulator;
|
use Rector\Core\NodeManipulator\ClassInsertManipulator;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\Core\ValueObject\MethodName;
|
use Rector\Core\ValueObject\MethodName;
|
||||||
@ -184,8 +185,11 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
private function decoratePropertyWithParamDocInfo(\PhpParser\Node\Param $param, \PhpParser\Node\Stmt\Property $property) : void
|
private function decoratePropertyWithParamDocInfo(\PhpParser\Node\Param $param, \PhpParser\Node\Stmt\Property $property) : void
|
||||||
{
|
{
|
||||||
$constructor = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$constructorClassMethod = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($constructor);
|
if (!$constructorClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
|
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||||
|
}
|
||||||
|
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($constructorClassMethod);
|
||||||
if (!$phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
if (!$phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ use PhpParser\Node\Param;
|
|||||||
use PhpParser\Node\Stmt\Class_;
|
use PhpParser\Node\Stmt\Class_;
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use Rector\Core\Exception\ShouldNotHappenException;
|
use Rector\Core\Exception\ShouldNotHappenException;
|
||||||
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
use Rector\NodeNameResolver\NodeNameResolver;
|
use Rector\NodeNameResolver\NodeNameResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
use RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
use RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
||||||
@ -34,10 +35,15 @@ final class PhpSpecMockCollector
|
|||||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||||
*/
|
*/
|
||||||
private $nodeNameResolver;
|
private $nodeNameResolver;
|
||||||
public function __construct(\RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
/**
|
||||||
|
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||||
|
*/
|
||||||
|
private $betterNodeFinder;
|
||||||
|
public function __construct(\RectorPrefix20211106\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||||
{
|
{
|
||||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||||
$this->nodeNameResolver = $nodeNameResolver;
|
$this->nodeNameResolver = $nodeNameResolver;
|
||||||
|
$this->betterNodeFinder = $betterNodeFinder;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
@ -88,7 +94,7 @@ final class PhpSpecMockCollector
|
|||||||
$variable = $this->nodeNameResolver->getName($param->var);
|
$variable = $this->nodeNameResolver->getName($param->var);
|
||||||
/** @var string $class */
|
/** @var string $class */
|
||||||
$class = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
|
$class = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);
|
||||||
$classMethod = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ final class PhpSpecMocksToPHPUnitMocksRector extends \Rector\PhpSpecToPHPUnit\Re
|
|||||||
$classLike = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\Class_::class);
|
$classLike = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\Class_::class);
|
||||||
$classMocks = $this->phpSpecMockCollector->resolveClassMocksFromParam($classLike);
|
$classMocks = $this->phpSpecMockCollector->resolveClassMocksFromParam($classLike);
|
||||||
$variable = $this->getName($param->var);
|
$variable = $this->getName($param->var);
|
||||||
$classMethod = $param->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($param, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ CODE_SAMPLE
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
foreach ($readOnlyVariableAssigns as $readOnlyVariableAssign) {
|
foreach ($readOnlyVariableAssigns as $readOnlyVariableAssign) {
|
||||||
$classMethod = $readOnlyVariableAssign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($readOnlyVariableAssign, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ final class ComplexNodeRemover
|
|||||||
*/
|
*/
|
||||||
private function shouldSkipPropertyForClassMethod($expr, array $classMethodNamesToSkip) : bool
|
private function shouldSkipPropertyForClassMethod($expr, array $classMethodNamesToSkip) : bool
|
||||||
{
|
{
|
||||||
$classMethodNode = $expr->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethodNode = $this->betterNodeFinder->findParentType($expr, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethodNode instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethodNode instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ final class ComplexNodeRemover
|
|||||||
}
|
}
|
||||||
private function removeConstructorDependency(\PhpParser\Node\Expr\Assign $assign) : void
|
private function removeConstructorDependency(\PhpParser\Node\Expr\Assign $assign) : void
|
||||||
{
|
{
|
||||||
$classMethod = $assign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($assign, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
private function isInStaticClassMethod(\PhpParser\Node\Expr\StaticCall $staticCall) : bool
|
private function isInStaticClassMethod(\PhpParser\Node\Expr\StaticCall $staticCall) : bool
|
||||||
{
|
{
|
||||||
$locationClassMethod = $staticCall->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$locationClassMethod = $this->betterNodeFinder->findParentType($staticCall, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$locationClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$locationClassMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,12 @@ use PhpParser\Node\Expr\MethodCall;
|
|||||||
use PhpParser\Node\Expr\PropertyFetch;
|
use PhpParser\Node\Expr\PropertyFetch;
|
||||||
use PhpParser\Node\Expr\StaticCall;
|
use PhpParser\Node\Expr\StaticCall;
|
||||||
use PhpParser\Node\Expr\Variable;
|
use PhpParser\Node\Expr\Variable;
|
||||||
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PHPStan\Type\ObjectType;
|
use PHPStan\Type\ObjectType;
|
||||||
use Rector\Core\Configuration\Option;
|
use Rector\Core\Configuration\Option;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\Core\ValueObject\MethodName;
|
use Rector\Core\ValueObject\MethodName;
|
||||||
use Rector\Naming\Naming\PropertyNaming;
|
use Rector\Naming\Naming\PropertyNaming;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use RectorPrefix20211106\Symplify\PackageBuilder\Parameter\ParameterProvider;
|
use RectorPrefix20211106\Symplify\PackageBuilder\Parameter\ParameterProvider;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
@ -82,7 +82,10 @@ CODE_SAMPLE
|
|||||||
return $this->createFromSelf($node);
|
return $this->createFromSelf($node);
|
||||||
}
|
}
|
||||||
$propertyName = $this->propertyNaming->fqnToVariableName($staticObjectType);
|
$propertyName = $this->propertyNaming->fqnToVariableName($staticObjectType);
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if ($this->nodeNameResolver->isName($classMethod, \Rector\Core\ValueObject\MethodName::CONSTRUCT)) {
|
if ($this->nodeNameResolver->isName($classMethod, \Rector\Core\ValueObject\MethodName::CONSTRUCT)) {
|
||||||
$propertyFetch = new \PhpParser\Node\Expr\Variable($propertyName);
|
$propertyFetch = new \PhpParser\Node\Expr\Variable($propertyName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,7 +15,6 @@ use Rector\Core\Exception\ShouldNotHappenException;
|
|||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\Naming\Naming\PropertyNaming;
|
use Rector\Naming\Naming\PropertyNaming;
|
||||||
use Rector\Naming\ValueObject\ExpectedName;
|
use Rector\Naming\ValueObject\ExpectedName;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer;
|
use Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer;
|
||||||
use Rector\PostRector\Collector\PropertyToAddCollector;
|
use Rector\PostRector\Collector\PropertyToAddCollector;
|
||||||
use Rector\PostRector\ValueObject\PropertyMetadata;
|
use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||||
@ -143,10 +142,9 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
private function shouldSkipFuncCall(\PhpParser\Node\Expr\FuncCall $funcCall) : bool
|
private function shouldSkipFuncCall(\PhpParser\Node\Expr\FuncCall $funcCall) : bool
|
||||||
{
|
{
|
||||||
// we can inject only in injectable class method context
|
|
||||||
// we can inject only in injectable class method context
|
// we can inject only in injectable class method context
|
||||||
/** @var ClassMethod|null $classMethod */
|
/** @var ClassMethod|null $classMethod */
|
||||||
$classMethod = $funcCall->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($funcCall, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ use PhpParser\Node\Stmt\Class_;
|
|||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer;
|
use Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer;
|
||||||
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||||
@ -84,7 +83,7 @@ CODE_SAMPLE
|
|||||||
if (!$classLike instanceof \PhpParser\Node\Stmt\Class_) {
|
if (!$classLike instanceof \PhpParser\Node\Stmt\Class_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ use PhpParser\Node\Stmt\ClassMethod;
|
|||||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||||
use Rector\Core\Exception\ShouldNotHappenException;
|
use Rector\Core\Exception\ShouldNotHappenException;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer;
|
use Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer;
|
||||||
use Rector\Transform\ValueObject\StaticCallToMethodCall;
|
use Rector\Transform\ValueObject\StaticCallToMethodCall;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||||
@ -93,7 +92,7 @@ CODE_SAMPLE
|
|||||||
if (!$classLike instanceof \PhpParser\Node\Stmt\Class_) {
|
if (!$classLike instanceof \PhpParser\Node\Stmt\Class_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ final class GetterNodeParamTypeInferer implements \Rector\TypeDeclaration\Contra
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// what is return type?
|
// what is return type?
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'c3b6efea7ee5351ce66461fe02c5f9b7282816bb';
|
public const PACKAGE_VERSION = '824df97e93bb43baca8f22a6f6a0f537a0049dd6';
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2021-11-06 12:52:18';
|
public const RELEASE_DATE = '2021-11-06 15:07:22';
|
||||||
public static function resolvePackageVersion() : string
|
public static function resolvePackageVersion() : string
|
||||||
{
|
{
|
||||||
$process = new \RectorPrefix20211106\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
$process = new \RectorPrefix20211106\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||||
|
@ -116,12 +116,12 @@ final class ClassMethodManipulator
|
|||||||
*/
|
*/
|
||||||
public function addMethodParameterIfMissing(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType, array $possibleNames) : string
|
public function addMethodParameterIfMissing(\PhpParser\Node $node, \PHPStan\Type\ObjectType $objectType, array $possibleNames) : string
|
||||||
{
|
{
|
||||||
$classMethodNode = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethodNode instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
// or null?
|
// or null?
|
||||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||||
}
|
}
|
||||||
foreach ($classMethodNode->params as $paramNode) {
|
foreach ($classMethod->params as $paramNode) {
|
||||||
if (!$this->nodeTypeResolver->isObjectType($paramNode, $objectType)) {
|
if (!$this->nodeTypeResolver->isObjectType($paramNode, $objectType)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -131,8 +131,8 @@ final class ClassMethodManipulator
|
|||||||
}
|
}
|
||||||
return $paramName;
|
return $paramName;
|
||||||
}
|
}
|
||||||
$paramName = $this->resolveName($classMethodNode, $possibleNames);
|
$paramName = $this->resolveName($classMethod, $possibleNames);
|
||||||
$classMethodNode->params[] = new \PhpParser\Node\Param(new \PhpParser\Node\Expr\Variable($paramName), null, new \PhpParser\Node\Name\FullyQualified($objectType->getClassName()));
|
$classMethod->params[] = new \PhpParser\Node\Param(new \PhpParser\Node\Expr\Variable($paramName), null, new \PhpParser\Node\Name\FullyQualified($objectType->getClassName()));
|
||||||
return $paramName;
|
return $paramName;
|
||||||
}
|
}
|
||||||
public function isPropertyPromotion(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
|
public function isPropertyPromotion(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
|
||||||
|
@ -95,7 +95,7 @@ final class MethodCallManipulator
|
|||||||
public function findMethodCallsOnVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
public function findMethodCallsOnVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
||||||
{
|
{
|
||||||
// get scope node, e.g. parent function call, method call or anonymous function
|
// get scope node, e.g. parent function call, method call or anonymous function
|
||||||
$classMethod = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($variable, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ final class PropertyManipulator
|
|||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
// skip for constructor? it is allowed to set value in constructor method
|
// skip for constructor? it is allowed to set value in constructor method
|
||||||
$classMethod = $propertyFetch->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($propertyFetch, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if ($classMethod instanceof \PhpParser\Node\Stmt\ClassMethod && $this->nodeNameResolver->isName($classMethod->name, \Rector\Core\ValueObject\MethodName::CONSTRUCT)) {
|
if ($classMethod instanceof \PhpParser\Node\Stmt\ClassMethod && $this->nodeNameResolver->isName($classMethod->name, \Rector\Core\ValueObject\MethodName::CONSTRUCT)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ use Rector\Core\PhpParser\Comparing\NodeComparator;
|
|||||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
use Rector\Core\PhpParser\NodeFinder\LocalConstantFinder;
|
use Rector\Core\PhpParser\NodeFinder\LocalConstantFinder;
|
||||||
use Rector\NodeNameResolver\NodeNameResolver;
|
use Rector\NodeNameResolver\NodeNameResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||||
final class RegexPatternArgumentManipulator
|
final class RegexPatternArgumentManipulator
|
||||||
{
|
{
|
||||||
@ -144,7 +143,7 @@ final class RegexPatternArgumentManipulator
|
|||||||
*/
|
*/
|
||||||
private function findAssignerForVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
private function findAssignerForVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
||||||
{
|
{
|
||||||
$classMethod = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($variable, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ abstract class AbstractRector extends \PhpParser\NodeVisitorAbstract implements
|
|||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private const ATTRIBUTES_TO_MIRROR = [\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME, \Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE, \Rector\NodeTypeResolver\Node\AttributeKey::USE_NODES, \Rector\NodeTypeResolver\Node\AttributeKey::SCOPE, \Rector\NodeTypeResolver\Node\AttributeKey::RESOLVED_NAME, \Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE, \Rector\NodeTypeResolver\Node\AttributeKey::CURRENT_STATEMENT, \Rector\NodeTypeResolver\Node\AttributeKey::PREVIOUS_STATEMENT];
|
private const ATTRIBUTES_TO_MIRROR = [\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME, \Rector\NodeTypeResolver\Node\AttributeKey::USE_NODES, \Rector\NodeTypeResolver\Node\AttributeKey::SCOPE, \Rector\NodeTypeResolver\Node\AttributeKey::RESOLVED_NAME, \Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE, \Rector\NodeTypeResolver\Node\AttributeKey::CURRENT_STATEMENT, \Rector\NodeTypeResolver\Node\AttributeKey::PREVIOUS_STATEMENT];
|
||||||
/**
|
/**
|
||||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||||
*/
|
*/
|
||||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb::getLoader();
|
return ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81::getLoader();
|
||||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb
|
class ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit459af300f88369828b2c5381ea17dddb::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81::getInitializer($loader));
|
||||||
} else {
|
} else {
|
||||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||||
if ($classMap) {
|
if ($classMap) {
|
||||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb
|
|||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
$includeFiles = Composer\Autoload\ComposerStaticInit459af300f88369828b2c5381ea17dddb::$files;
|
$includeFiles = Composer\Autoload\ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81::$files;
|
||||||
} else {
|
} else {
|
||||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||||
}
|
}
|
||||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
composerRequire459af300f88369828b2c5381ea17dddb($fileIdentifier, $file);
|
composerRequire7ade9639c4b2634a59b028a99a4c8a81($fileIdentifier, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function composerRequire459af300f88369828b2c5381ea17dddb($fileIdentifier, $file)
|
function composerRequire7ade9639c4b2634a59b028a99a4c8a81($fileIdentifier, $file)
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
require $file;
|
require $file;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit459af300f88369828b2c5381ea17dddb
|
class ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||||
@ -3523,9 +3523,9 @@ class ComposerStaticInit459af300f88369828b2c5381ea17dddb
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit459af300f88369828b2c5381ea17dddb::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit459af300f88369828b2c5381ea17dddb::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit459af300f88369828b2c5381ea17dddb::$classMap;
|
$loader->classMap = ComposerStaticInit7ade9639c4b2634a59b028a99a4c8a81::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
28
vendor/composer/installed.json
vendored
28
vendor/composer/installed.json
vendored
@ -1462,17 +1462,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector\/rector-nette",
|
"name": "rector\/rector-nette",
|
||||||
"version": "0.11.46",
|
"version": "0.11.47",
|
||||||
"version_normalized": "0.11.46.0",
|
"version_normalized": "0.11.47.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||||
"reference": "e6406acab409e80b1258b0c292cdbf2a3a79365f"
|
"reference": "eddbf4ee25207951034e1b9b05378677afae22df"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/e6406acab409e80b1258b0c292cdbf2a3a79365f",
|
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/eddbf4ee25207951034e1b9b05378677afae22df",
|
||||||
"reference": "e6406acab409e80b1258b0c292cdbf2a3a79365f",
|
"reference": "eddbf4ee25207951034e1b9b05378677afae22df",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1500,7 +1500,7 @@
|
|||||||
"symplify\/phpstan-rules": "^10.0",
|
"symplify\/phpstan-rules": "^10.0",
|
||||||
"symplify\/rule-doc-generator": "^10.0"
|
"symplify\/rule-doc-generator": "^10.0"
|
||||||
},
|
},
|
||||||
"time": "2021-11-06T01:21:50+00:00",
|
"time": "2021-11-06T12:07:17+00:00",
|
||||||
"type": "rector-extension",
|
"type": "rector-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
@ -1528,7 +1528,7 @@
|
|||||||
"description": "Rector upgrades rules for Nette Framework",
|
"description": "Rector upgrades rules for Nette Framework",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
||||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.46"
|
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.47"
|
||||||
},
|
},
|
||||||
"install-path": "..\/rector\/rector-nette"
|
"install-path": "..\/rector\/rector-nette"
|
||||||
},
|
},
|
||||||
@ -1657,17 +1657,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector\/rector-symfony",
|
"name": "rector\/rector-symfony",
|
||||||
"version": "0.11.37",
|
"version": "0.11.38",
|
||||||
"version_normalized": "0.11.37.0",
|
"version_normalized": "0.11.38.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||||
"reference": "acfb0e9ac4752910dd50a2806be2253c4dd87925"
|
"reference": "46437972a8bd80834e263b6b325defffd5c5ebf3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/acfb0e9ac4752910dd50a2806be2253c4dd87925",
|
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/46437972a8bd80834e263b6b325defffd5c5ebf3",
|
||||||
"reference": "acfb0e9ac4752910dd50a2806be2253c4dd87925",
|
"reference": "46437972a8bd80834e263b6b325defffd5c5ebf3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1692,7 +1692,7 @@
|
|||||||
"symplify\/phpstan-rules": "^10.0",
|
"symplify\/phpstan-rules": "^10.0",
|
||||||
"symplify\/rule-doc-generator": "^10.0"
|
"symplify\/rule-doc-generator": "^10.0"
|
||||||
},
|
},
|
||||||
"time": "2021-11-06T01:15:43+00:00",
|
"time": "2021-11-06T11:56:49+00:00",
|
||||||
"type": "rector-extension",
|
"type": "rector-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
@ -1717,7 +1717,7 @@
|
|||||||
"description": "Rector upgrades rules for Symfony Framework",
|
"description": "Rector upgrades rules for Symfony Framework",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https:\/\/github.com\/rectorphp\/rector-symfony\/issues",
|
"issues": "https:\/\/github.com\/rectorphp\/rector-symfony\/issues",
|
||||||
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.37"
|
"source": "https:\/\/github.com\/rectorphp\/rector-symfony\/tree\/0.11.38"
|
||||||
},
|
},
|
||||||
"install-path": "..\/rector\/rector-symfony"
|
"install-path": "..\/rector\/rector-symfony"
|
||||||
},
|
},
|
||||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||||||
*/
|
*/
|
||||||
final class GeneratedConfig
|
final class GeneratedConfig
|
||||||
{
|
{
|
||||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.11'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.46'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.21'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.37'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.30'));
|
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.31'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.11'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.47'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.21'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.38'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.30'));
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ use Rector\Core\ValueObject\MethodName;
|
|||||||
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
||||||
use Rector\Nette\NodeResolver\MethodNamesByInputNamesResolver;
|
use Rector\Nette\NodeResolver\MethodNamesByInputNamesResolver;
|
||||||
use Rector\NodeNameResolver\NodeNameResolver;
|
use Rector\NodeNameResolver\NodeNameResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use RectorPrefix20211106\Symfony\Contracts\Service\Attribute\Required;
|
use RectorPrefix20211106\Symfony\Contracts\Service\Attribute\Required;
|
||||||
final class ThisVariableInAnotherMethodFormControlTypeResolver implements \Rector\Nette\Contract\FormControlTypeResolverInterface
|
final class ThisVariableInAnotherMethodFormControlTypeResolver implements \Rector\Nette\Contract\FormControlTypeResolverInterface
|
||||||
{
|
{
|
||||||
@ -49,7 +48,7 @@ final class ThisVariableInAnotherMethodFormControlTypeResolver implements \Recto
|
|||||||
if (!$node instanceof \PhpParser\Node\Expr\Variable) {
|
if (!$node instanceof \PhpParser\Node\Expr\Variable) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
|||||||
use PhpParser\Node\Stmt\Expression;
|
use PhpParser\Node\Stmt\Expression;
|
||||||
use PHPStan\Type\ObjectType;
|
use PHPStan\Type\ObjectType;
|
||||||
use Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator;
|
use Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator;
|
||||||
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
use Rector\Nette\NodeAdding\FunctionLikeFirstLevelStatementResolver;
|
use Rector\Nette\NodeAdding\FunctionLikeFirstLevelStatementResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
use Rector\PostRector\Collector\NodesToAddCollector;
|
||||||
@ -31,11 +32,16 @@ final class AssignAnalyzer
|
|||||||
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator
|
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator
|
||||||
*/
|
*/
|
||||||
private $varAnnotationManipulator;
|
private $varAnnotationManipulator;
|
||||||
public function __construct(\Rector\Nette\NodeAdding\FunctionLikeFirstLevelStatementResolver $functionLikeFirstLevelStatementResolver, \Rector\PostRector\Collector\NodesToAddCollector $nodesToAddCollector, \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator $varAnnotationManipulator)
|
/**
|
||||||
|
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||||
|
*/
|
||||||
|
private $betterNodeFinder;
|
||||||
|
public function __construct(\Rector\Nette\NodeAdding\FunctionLikeFirstLevelStatementResolver $functionLikeFirstLevelStatementResolver, \Rector\PostRector\Collector\NodesToAddCollector $nodesToAddCollector, \Rector\BetterPhpDocParser\PhpDocManipulator\VarAnnotationManipulator $varAnnotationManipulator, \Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder)
|
||||||
{
|
{
|
||||||
$this->functionLikeFirstLevelStatementResolver = $functionLikeFirstLevelStatementResolver;
|
$this->functionLikeFirstLevelStatementResolver = $functionLikeFirstLevelStatementResolver;
|
||||||
$this->nodesToAddCollector = $nodesToAddCollector;
|
$this->nodesToAddCollector = $nodesToAddCollector;
|
||||||
$this->varAnnotationManipulator = $varAnnotationManipulator;
|
$this->varAnnotationManipulator = $varAnnotationManipulator;
|
||||||
|
$this->betterNodeFinder = $betterNodeFinder;
|
||||||
}
|
}
|
||||||
public function addAssignExpressionForFirstCase(string $variableName, \PhpParser\Node\Expr\ArrayDimFetch $arrayDimFetch, \PHPStan\Type\ObjectType $controlObjectType) : void
|
public function addAssignExpressionForFirstCase(string $variableName, \PhpParser\Node\Expr\ArrayDimFetch $arrayDimFetch, \PHPStan\Type\ObjectType $controlObjectType) : void
|
||||||
{
|
{
|
||||||
@ -48,7 +54,7 @@ final class AssignAnalyzer
|
|||||||
}
|
}
|
||||||
private function shouldSkipForAlreadyAddedInCurrentClassMethod(\PhpParser\Node\Expr\ArrayDimFetch $arrayDimFetch, string $variableName) : bool
|
private function shouldSkipForAlreadyAddedInCurrentClassMethod(\PhpParser\Node\Expr\ArrayDimFetch $arrayDimFetch, string $variableName) : bool
|
||||||
{
|
{
|
||||||
$classMethod = $arrayDimFetch->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($arrayDimFetch, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ final class MethodCallManipulator
|
|||||||
public function findMethodCallsOnVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
public function findMethodCallsOnVariable(\PhpParser\Node\Expr\Variable $variable) : array
|
||||||
{
|
{
|
||||||
// get scope node, e.g. parent function call, method call or anonymous function
|
// get scope node, e.g. parent function call, method call or anonymous function
|
||||||
$classMethod = $variable->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($variable, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ CODE_SAMPLE
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$this->assignAnalyzer->addAssignExpressionForFirstCase($variableName, $node, $controlObjectType);
|
$this->assignAnalyzer->addAssignExpressionForFirstCase($variableName, $node, $controlObjectType);
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if ($classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if ($classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
$this->arrayDimFetchRenamer->renameToVariable($classMethod, $node, $variableName);
|
$this->arrayDimFetchRenamer->renameToVariable($classMethod, $node, $variableName);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ use PhpParser\Node\Scalar\String_;
|
|||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use Rector\Core\Exception\ShouldNotHappenException;
|
use Rector\Core\Exception\ShouldNotHappenException;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractRector;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\Symfony\Bridge\NodeAnalyzer\ControllerMethodAnalyzer;
|
use Rector\Symfony\Bridge\NodeAnalyzer\ControllerMethodAnalyzer;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
@ -143,7 +142,7 @@ CODE_SAMPLE
|
|||||||
if (!$this->isName($node->name, 'getRequest') && !$this->isGetMethodCallWithRequestParameters($node)) {
|
if (!$this->isName($node->name, 'getRequest') && !$this->isGetMethodCallWithRequestParameters($node)) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ CODE_SAMPLE
|
|||||||
if (!$classReflection->isSubclassOf('Twig_Extension')) {
|
if (!$classReflection->isSubclassOf('Twig_Extension')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$classMethod = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::METHOD_NODE);
|
$classMethod = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
|
||||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
|||||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||||
spl_autoload_call('RectorPrefix20211106\AutoloadIncluder');
|
spl_autoload_call('RectorPrefix20211106\AutoloadIncluder');
|
||||||
}
|
}
|
||||||
if (!class_exists('ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb', false) && !interface_exists('ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb', false) && !trait_exists('ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb', false)) {
|
if (!class_exists('ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81', false) && !interface_exists('ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81', false) && !trait_exists('ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81', false)) {
|
||||||
spl_autoload_call('RectorPrefix20211106\ComposerAutoloaderInit459af300f88369828b2c5381ea17dddb');
|
spl_autoload_call('RectorPrefix20211106\ComposerAutoloaderInit7ade9639c4b2634a59b028a99a4c8a81');
|
||||||
}
|
}
|
||||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||||
spl_autoload_call('RectorPrefix20211106\Helmich\TypoScriptParser\Parser\AST\Statement');
|
spl_autoload_call('RectorPrefix20211106\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||||
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
|
|||||||
return \RectorPrefix20211106\print_node(...func_get_args());
|
return \RectorPrefix20211106\print_node(...func_get_args());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!function_exists('composerRequire459af300f88369828b2c5381ea17dddb')) {
|
if (!function_exists('composerRequire7ade9639c4b2634a59b028a99a4c8a81')) {
|
||||||
function composerRequire459af300f88369828b2c5381ea17dddb() {
|
function composerRequire7ade9639c4b2634a59b028a99a4c8a81() {
|
||||||
return \RectorPrefix20211106\composerRequire459af300f88369828b2c5381ea17dddb(...func_get_args());
|
return \RectorPrefix20211106\composerRequire7ade9639c4b2634a59b028a99a4c8a81(...func_get_args());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!function_exists('parseArgs')) {
|
if (!function_exists('parseArgs')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user