mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 5f4edd9230355cadc311ba8e8954fb9ae5bdc849
5f4edd9230
Remove NonVariableToVariableOnFunctionCallRector, should be handled manually as might need attention (#3357)
This commit is contained in:
parent
0a33500839
commit
6481c8dccc
|
@ -11,7 +11,6 @@ use Rector\Php70\Rector\ClassMethod\Php4ConstructorRector;
|
||||||
use Rector\Php70\Rector\FuncCall\CallUserMethodRector;
|
use Rector\Php70\Rector\FuncCall\CallUserMethodRector;
|
||||||
use Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
|
use Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
|
||||||
use Rector\Php70\Rector\FuncCall\MultiDirnameRector;
|
use Rector\Php70\Rector\FuncCall\MultiDirnameRector;
|
||||||
use Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector;
|
|
||||||
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
|
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
|
||||||
use Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector;
|
use Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector;
|
||||||
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
|
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
|
||||||
|
@ -24,24 +23,25 @@ use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
|
||||||
use Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector;
|
use Rector\Php70\Rector\Ternary\TernaryToSpaceshipRector;
|
||||||
use Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector;
|
use Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector;
|
||||||
return static function (RectorConfig $rectorConfig) : void {
|
return static function (RectorConfig $rectorConfig) : void {
|
||||||
$rectorConfig->rule(Php4ConstructorRector::class);
|
$rectorConfig->rules([
|
||||||
$rectorConfig->rule(TernaryToNullCoalescingRector::class);
|
Php4ConstructorRector::class,
|
||||||
$rectorConfig->rule(RandomFunctionRector::class);
|
TernaryToNullCoalescingRector::class,
|
||||||
$rectorConfig->rule(ExceptionHandlerTypehintRector::class);
|
RandomFunctionRector::class,
|
||||||
$rectorConfig->rule(MultiDirnameRector::class);
|
ExceptionHandlerTypehintRector::class,
|
||||||
$rectorConfig->rule(ListSplitStringRector::class);
|
MultiDirnameRector::class,
|
||||||
$rectorConfig->rule(EmptyListRector::class);
|
ListSplitStringRector::class,
|
||||||
# be careful, run this just once, since it can keep swapping order back and forth
|
EmptyListRector::class,
|
||||||
$rectorConfig->rule(ListSwapArrayOrderRector::class);
|
// be careful, run this just once, since it can keep swapping order back and forth
|
||||||
$rectorConfig->rule(CallUserMethodRector::class);
|
ListSwapArrayOrderRector::class,
|
||||||
$rectorConfig->rule(EregToPregMatchRector::class);
|
CallUserMethodRector::class,
|
||||||
$rectorConfig->rule(ReduceMultipleDefaultSwitchRector::class);
|
EregToPregMatchRector::class,
|
||||||
$rectorConfig->rule(TernaryToSpaceshipRector::class);
|
ReduceMultipleDefaultSwitchRector::class,
|
||||||
$rectorConfig->rule(WrapVariableVariableNameInCurlyBracesRector::class);
|
TernaryToSpaceshipRector::class,
|
||||||
$rectorConfig->rule(IfToSpaceshipRector::class);
|
WrapVariableVariableNameInCurlyBracesRector::class,
|
||||||
$rectorConfig->rule(StaticCallOnNonStaticToInstanceCallRector::class);
|
IfToSpaceshipRector::class,
|
||||||
$rectorConfig->rule(ThisCallOnStaticMethodToStaticCallRector::class);
|
StaticCallOnNonStaticToInstanceCallRector::class,
|
||||||
$rectorConfig->rule(BreakNotInLoopOrSwitchToReturnRector::class);
|
ThisCallOnStaticMethodToStaticCallRector::class,
|
||||||
$rectorConfig->rule(RenameMktimeWithoutArgsToTimeRector::class);
|
BreakNotInLoopOrSwitchToReturnRector::class,
|
||||||
$rectorConfig->rule(NonVariableToVariableOnFunctionCallRector::class);
|
RenameMktimeWithoutArgsToTimeRector::class,
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# 415 Rules Overview
|
# 414 Rules Overview
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
- [Php56](#php56) (2)
|
- [Php56](#php56) (2)
|
||||||
|
|
||||||
- [Php70](#php70) (19)
|
- [Php70](#php70) (18)
|
||||||
|
|
||||||
- [Php71](#php71) (9)
|
- [Php71](#php71) (9)
|
||||||
|
|
||||||
|
@ -4917,19 +4917,6 @@ Changes multiple `dirname()` calls to one with nesting level
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
### NonVariableToVariableOnFunctionCallRector
|
|
||||||
|
|
||||||
Transform non variable like arguments to variable where a function or method expects an argument passed by reference
|
|
||||||
|
|
||||||
- class: [`Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector`](../rules/Php70/Rector/FuncCall/NonVariableToVariableOnFunctionCallRector.php)
|
|
||||||
|
|
||||||
```diff
|
|
||||||
-reset(a());
|
|
||||||
+$a = a(); reset($a);
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
### Php4ConstructorRector
|
### Php4ConstructorRector
|
||||||
|
|
||||||
Changes PHP 4 style constructor to __construct.
|
Changes PHP 4 style constructor to __construct.
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
declare (strict_types=1);
|
declare (strict_types=1);
|
||||||
namespace Rector\NodeNestingScope;
|
namespace Rector\NodeNestingScope;
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Expr\Closure;
|
use PhpParser\Node\Expr\Closure;
|
||||||
|
use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\Stmt\Class_;
|
use PhpParser\Node\Stmt\Class_;
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PhpParser\Node\Stmt\Function_;
|
use PhpParser\Node\Stmt\Function_;
|
||||||
|
@ -24,8 +24,8 @@ final class ParentScopeFinder
|
||||||
/**
|
/**
|
||||||
* @return \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Namespace_|\PhpParser\Node\Expr\Closure|null
|
* @return \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Namespace_|\PhpParser\Node\Expr\Closure|null
|
||||||
*/
|
*/
|
||||||
public function find(Node $node)
|
public function find(Variable $variable)
|
||||||
{
|
{
|
||||||
return $this->betterNodeFinder->findParentByTypes($node, [Closure::class, Function_::class, ClassMethod::class, Class_::class, Namespace_::class]);
|
return $this->betterNodeFinder->findParentByTypes($variable, [Closure::class, Function_::class, ClassMethod::class, Class_::class, Namespace_::class]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@ use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||||
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType;
|
||||||
use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
|
use Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType;
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
|
||||||
* @todo merge with very similar logic in
|
|
||||||
* @see VariableNaming
|
|
||||||
* @see \Rector\Tests\Naming\Naming\PropertyNamingTest
|
* @see \Rector\Tests\Naming\Naming\PropertyNamingTest
|
||||||
*/
|
*/
|
||||||
final class PropertyNaming
|
final class PropertyNaming
|
||||||
|
|
|
@ -49,6 +49,9 @@ final class VariableNaming
|
||||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||||
$this->assignVariableNameResolvers = $assignVariableNameResolvers;
|
$this->assignVariableNameResolvers = $assignVariableNameResolvers;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
public function resolveFromNodeWithScopeCountAndFallbackName(Expr $expr, MutatingScope $mutatingScope, string $fallbackName) : string
|
public function resolveFromNodeWithScopeCountAndFallbackName(Expr $expr, MutatingScope $mutatingScope, string $fallbackName) : string
|
||||||
{
|
{
|
||||||
$name = $this->resolveFromNode($expr);
|
$name = $this->resolveFromNode($expr);
|
||||||
|
@ -79,9 +82,6 @@ final class VariableNaming
|
||||||
}
|
}
|
||||||
return $valueName;
|
return $valueName;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public function resolveFromFuncCallFirstArgumentWithSuffix(FuncCall $funcCall, string $suffix, string $fallbackName, ?Scope $scope) : string
|
public function resolveFromFuncCallFirstArgumentWithSuffix(FuncCall $funcCall, string $suffix, string $fallbackName, ?Scope $scope) : string
|
||||||
{
|
{
|
||||||
$bareName = $this->resolveBareFuncCallArgumentName($funcCall, $fallbackName, $suffix);
|
$bareName = $this->resolveBareFuncCallArgumentName($funcCall, $fallbackName, $suffix);
|
||||||
|
|
|
@ -1,194 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\Php70\Rector\FuncCall;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Arg;
|
|
||||||
use PhpParser\Node\Expr;
|
|
||||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
|
||||||
use PhpParser\Node\Expr\Assign;
|
|
||||||
use PhpParser\Node\Expr\AssignOp;
|
|
||||||
use PhpParser\Node\Expr\AssignRef;
|
|
||||||
use PhpParser\Node\Expr\Closure;
|
|
||||||
use PhpParser\Node\Expr\FuncCall;
|
|
||||||
use PhpParser\Node\Expr\MethodCall;
|
|
||||||
use PhpParser\Node\Expr\PropertyFetch;
|
|
||||||
use PhpParser\Node\Expr\StaticCall;
|
|
||||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
|
||||||
use PhpParser\Node\Expr\Variable;
|
|
||||||
use PhpParser\Node\Stmt;
|
|
||||||
use PhpParser\Node\Stmt\Class_;
|
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
|
||||||
use PhpParser\Node\Stmt\Function_;
|
|
||||||
use PhpParser\Node\Stmt\Namespace_;
|
|
||||||
use PHPStan\Analyser\MutatingScope;
|
|
||||||
use PHPStan\Analyser\Scope;
|
|
||||||
use PHPStan\Reflection\ParameterReflection;
|
|
||||||
use PHPStan\Type\MixedType;
|
|
||||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
|
||||||
use Rector\Core\Rector\AbstractRector;
|
|
||||||
use Rector\Core\Reflection\ReflectionResolver;
|
|
||||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
|
||||||
use Rector\Naming\Naming\VariableNaming;
|
|
||||||
use Rector\NodeNestingScope\ParentScopeFinder;
|
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\Php70\ValueObject\VariableAssignPair;
|
|
||||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
|
||||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @changelog https://www.php.net/manual/en/migration70.incompatible.php
|
|
||||||
*
|
|
||||||
* @see \Rector\Tests\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector\NonVariableToVariableOnFunctionCallRectorTest
|
|
||||||
*/
|
|
||||||
final class NonVariableToVariableOnFunctionCallRector extends AbstractRector implements MinPhpVersionInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\Naming\Naming\VariableNaming
|
|
||||||
*/
|
|
||||||
private $variableNaming;
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\NodeNestingScope\ParentScopeFinder
|
|
||||||
*/
|
|
||||||
private $parentScopeFinder;
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
|
||||||
*/
|
|
||||||
private $reflectionResolver;
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\Core\NodeAnalyzer\ArgsAnalyzer
|
|
||||||
*/
|
|
||||||
private $argsAnalyzer;
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\PostRector\Collector\NodesToAddCollector
|
|
||||||
*/
|
|
||||||
private $nodesToAddCollector;
|
|
||||||
public function __construct(VariableNaming $variableNaming, ParentScopeFinder $parentScopeFinder, ReflectionResolver $reflectionResolver, ArgsAnalyzer $argsAnalyzer, NodesToAddCollector $nodesToAddCollector)
|
|
||||||
{
|
|
||||||
$this->variableNaming = $variableNaming;
|
|
||||||
$this->parentScopeFinder = $parentScopeFinder;
|
|
||||||
$this->reflectionResolver = $reflectionResolver;
|
|
||||||
$this->argsAnalyzer = $argsAnalyzer;
|
|
||||||
$this->nodesToAddCollector = $nodesToAddCollector;
|
|
||||||
}
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Transform non variable like arguments to variable where a function or method expects an argument passed by reference', [new CodeSample('reset(a());', '$a = a(); reset($a);')]);
|
|
||||||
}
|
|
||||||
public function provideMinPhpVersion() : int
|
|
||||||
{
|
|
||||||
return PhpVersionFeature::VARIABLE_ON_FUNC_CALL;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [FuncCall::class, MethodCall::class, StaticCall::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param FuncCall|MethodCall|StaticCall $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
$arguments = $this->getNonVariableArguments($node);
|
|
||||||
if ($arguments === []) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$scopeNode = $this->parentScopeFinder->find($node);
|
|
||||||
if (!$scopeNode instanceof Node) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$currentScope = $scopeNode->getAttribute(AttributeKey::SCOPE);
|
|
||||||
if (!$currentScope instanceof MutatingScope) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach ($arguments as $key => $argument) {
|
|
||||||
if (!$node->args[$key] instanceof Arg) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$replacements = $this->getReplacementsFor($argument, $currentScope, $scopeNode);
|
|
||||||
$currentStmt = $this->betterNodeFinder->resolveCurrentStatement($node);
|
|
||||||
if (!$currentStmt instanceof Stmt) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->nodesToAddCollector->addNodeBeforeNode($replacements->getAssign(), $currentStmt);
|
|
||||||
$node->args[$key]->value = $replacements->getVariable();
|
|
||||||
// add variable name to scope, so we prevent duplication of new variable of the same name
|
|
||||||
$currentScope = $currentScope->assignExpression($replacements->getVariable(), $currentScope->getType($replacements->getVariable()));
|
|
||||||
}
|
|
||||||
$scopeNode->setAttribute(AttributeKey::SCOPE, $currentScope);
|
|
||||||
return $node;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Expr[]
|
|
||||||
* @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $call
|
|
||||||
*/
|
|
||||||
private function getNonVariableArguments($call) : array
|
|
||||||
{
|
|
||||||
$arguments = [];
|
|
||||||
$functionLikeReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($call);
|
|
||||||
if ($functionLikeReflection === null) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
foreach ($functionLikeReflection->getVariants() as $parametersAcceptor) {
|
|
||||||
/** @var ParameterReflection $parameterReflection */
|
|
||||||
foreach ($parametersAcceptor->getParameters() as $key => $parameterReflection) {
|
|
||||||
// omitted optional parameter
|
|
||||||
if (!$this->argsAnalyzer->isArgInstanceInArgsPosition($call->args, $key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($parameterReflection->passedByReference()->no()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/** @var Arg $arg */
|
|
||||||
$arg = $call->args[$key];
|
|
||||||
$argument = $arg->value;
|
|
||||||
if ($this->isVariableLikeNode($argument)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$arguments[$key] = $argument;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $arguments;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param \PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Stmt\Namespace_ $scopeNode
|
|
||||||
*/
|
|
||||||
private function getReplacementsFor(Expr $expr, MutatingScope $scope, $scopeNode) : VariableAssignPair
|
|
||||||
{
|
|
||||||
if ($this->isAssign($expr)) {
|
|
||||||
/** @var Assign|AssignRef|AssignOp $expr */
|
|
||||||
if ($this->isVariableLikeNode($expr->var)) {
|
|
||||||
return new VariableAssignPair($expr->var, $expr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$variableName = $this->variableNaming->resolveFromNodeWithScopeCountAndFallbackName($expr, $scope, 'tmp');
|
|
||||||
$variable = new Variable($variableName);
|
|
||||||
// add a new scope with this variable
|
|
||||||
$mutatingScope = $scope->assignExpression($variable, new MixedType());
|
|
||||||
$scopeNode->setAttribute(AttributeKey::SCOPE, $mutatingScope);
|
|
||||||
return new VariableAssignPair($variable, new Assign($variable, $expr));
|
|
||||||
}
|
|
||||||
private function isVariableLikeNode(Expr $expr) : bool
|
|
||||||
{
|
|
||||||
return $expr instanceof Variable || $expr instanceof ArrayDimFetch || $expr instanceof PropertyFetch || $expr instanceof StaticPropertyFetch;
|
|
||||||
}
|
|
||||||
private function isAssign(Expr $expr) : bool
|
|
||||||
{
|
|
||||||
if ($expr instanceof Assign) {
|
|
||||||
return \true;
|
|
||||||
}
|
|
||||||
if ($expr instanceof AssignRef) {
|
|
||||||
return \true;
|
|
||||||
}
|
|
||||||
return $expr instanceof AssignOp;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\Php70\ValueObject;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
|
||||||
use PhpParser\Node\Expr\Assign;
|
|
||||||
use PhpParser\Node\Expr\AssignOp;
|
|
||||||
use PhpParser\Node\Expr\AssignRef;
|
|
||||||
use PhpParser\Node\Expr\PropertyFetch;
|
|
||||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
|
||||||
use PhpParser\Node\Expr\Variable;
|
|
||||||
final class VariableAssignPair
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var Variable|ArrayDimFetch|PropertyFetch|StaticPropertyFetch
|
|
||||||
* @readonly
|
|
||||||
*/
|
|
||||||
private $variable;
|
|
||||||
/**
|
|
||||||
* @var Assign|AssignOp|AssignRef
|
|
||||||
* @readonly
|
|
||||||
*/
|
|
||||||
private $assign;
|
|
||||||
/**
|
|
||||||
* @param Variable|ArrayDimFetch|PropertyFetch|StaticPropertyFetch $variable
|
|
||||||
* @param Assign|AssignOp|AssignRef $assign
|
|
||||||
*/
|
|
||||||
public function __construct(Node $variable, Node $assign)
|
|
||||||
{
|
|
||||||
$this->variable = $variable;
|
|
||||||
$this->assign = $assign;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return \PhpParser\Node\Expr\ArrayDimFetch|\PhpParser\Node\Expr\PropertyFetch|\PhpParser\Node\Expr\StaticPropertyFetch|\PhpParser\Node\Expr\Variable
|
|
||||||
*/
|
|
||||||
public function getVariable()
|
|
||||||
{
|
|
||||||
return $this->variable;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return \PhpParser\Node\Expr\Assign|\PhpParser\Node\Expr\AssignOp|\PhpParser\Node\Expr\AssignRef
|
|
||||||
*/
|
|
||||||
public function getAssign()
|
|
||||||
{
|
|
||||||
return $this->assign;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '651e283c439ef593c6609ccc2623e11142544f4f';
|
public const PACKAGE_VERSION = '5f4edd9230355cadc311ba8e8954fb9ae5bdc849';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-02-07 16:57:06';
|
public const RELEASE_DATE = '2023-02-07 22:51:55';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9::getLoader();
|
return ComposerAutoloaderInita6db8ff7685b5b587feeb9f8fbe8099d::getLoader();
|
||||||
|
|
|
@ -2160,7 +2160,6 @@ return array(
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\CallUserMethodRector' => $baseDir . '/rules/Php70/Rector/FuncCall/CallUserMethodRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\CallUserMethodRector' => $baseDir . '/rules/Php70/Rector/FuncCall/CallUserMethodRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\EregToPregMatchRector' => $baseDir . '/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\EregToPregMatchRector' => $baseDir . '/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\MultiDirnameRector' => $baseDir . '/rules/Php70/Rector/FuncCall/MultiDirnameRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\MultiDirnameRector' => $baseDir . '/rules/Php70/Rector/FuncCall/MultiDirnameRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\NonVariableToVariableOnFunctionCallRector' => $baseDir . '/rules/Php70/Rector/FuncCall/NonVariableToVariableOnFunctionCallRector.php',
|
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\RandomFunctionRector' => $baseDir . '/rules/Php70/Rector/FuncCall/RandomFunctionRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\RandomFunctionRector' => $baseDir . '/rules/Php70/Rector/FuncCall/RandomFunctionRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\RenameMktimeWithoutArgsToTimeRector' => $baseDir . '/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\RenameMktimeWithoutArgsToTimeRector' => $baseDir . '/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php',
|
||||||
'Rector\\Php70\\Rector\\FunctionLike\\ExceptionHandlerTypehintRector' => $baseDir . '/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php',
|
'Rector\\Php70\\Rector\\FunctionLike\\ExceptionHandlerTypehintRector' => $baseDir . '/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php',
|
||||||
|
@ -2172,7 +2171,6 @@ return array(
|
||||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
||||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
||||||
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => $baseDir . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => $baseDir . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
||||||
'Rector\\Php70\\ValueObject\\VariableAssignPair' => $baseDir . '/rules/Php70/ValueObject/VariableAssignPair.php',
|
|
||||||
'Rector\\Php71\\IsArrayAndDualCheckToAble' => $baseDir . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
'Rector\\Php71\\IsArrayAndDualCheckToAble' => $baseDir . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
||||||
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => $baseDir . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => $baseDir . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
||||||
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => $baseDir . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => $baseDir . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9
|
class ComposerAutoloaderInita6db8ff7685b5b587feeb9f8fbe8099d
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInita6db8ff7685b5b587feeb9f8fbe8099d', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInita6db8ff7685b5b587feeb9f8fbe8099d', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9
|
class ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
|
@ -2407,7 +2407,6 @@ class ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\CallUserMethodRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/CallUserMethodRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\CallUserMethodRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/CallUserMethodRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\EregToPregMatchRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\EregToPregMatchRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\MultiDirnameRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/MultiDirnameRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\MultiDirnameRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/MultiDirnameRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\NonVariableToVariableOnFunctionCallRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/NonVariableToVariableOnFunctionCallRector.php',
|
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\RandomFunctionRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/RandomFunctionRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\RandomFunctionRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/RandomFunctionRector.php',
|
||||||
'Rector\\Php70\\Rector\\FuncCall\\RenameMktimeWithoutArgsToTimeRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php',
|
'Rector\\Php70\\Rector\\FuncCall\\RenameMktimeWithoutArgsToTimeRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php',
|
||||||
'Rector\\Php70\\Rector\\FunctionLike\\ExceptionHandlerTypehintRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php',
|
'Rector\\Php70\\Rector\\FunctionLike\\ExceptionHandlerTypehintRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php',
|
||||||
|
@ -2419,7 +2418,6 @@ class ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
||||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
||||||
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
||||||
'Rector\\Php70\\ValueObject\\VariableAssignPair' => __DIR__ . '/../..' . '/rules/Php70/ValueObject/VariableAssignPair.php',
|
|
||||||
'Rector\\Php71\\IsArrayAndDualCheckToAble' => __DIR__ . '/../..' . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
'Rector\\Php71\\IsArrayAndDualCheckToAble' => __DIR__ . '/../..' . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
||||||
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => __DIR__ . '/../..' . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => __DIR__ . '/../..' . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
||||||
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => __DIR__ . '/../..' . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => __DIR__ . '/../..' . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
||||||
|
@ -3099,9 +3097,9 @@ class ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
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 = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$classMap;
|
$loader->classMap = ComposerStaticInita6db8ff7685b5b587feeb9f8fbe8099d::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -750,17 +750,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan\/phpdoc-parser",
|
"name": "phpstan\/phpdoc-parser",
|
||||||
"version": "1.16.0",
|
"version": "1.16.1",
|
||||||
"version_normalized": "1.16.0.0",
|
"version_normalized": "1.16.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
"url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git",
|
||||||
"reference": "57090cfccbfaa639e703c007486d605a6e80f56d"
|
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/57090cfccbfaa639e703c007486d605a6e80f56d",
|
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||||
"reference": "57090cfccbfaa639e703c007486d605a6e80f56d",
|
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -775,7 +775,7 @@
|
||||||
"phpunit\/phpunit": "^9.5",
|
"phpunit\/phpunit": "^9.5",
|
||||||
"symfony\/process": "^5.2"
|
"symfony\/process": "^5.2"
|
||||||
},
|
},
|
||||||
"time": "2023-01-29T14:41:23+00:00",
|
"time": "2023-02-07T18:11:17+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -792,7 +792,7 @@
|
||||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
|
"issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues",
|
||||||
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.16.0"
|
"source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.16.1"
|
||||||
},
|
},
|
||||||
"install-path": "..\/phpstan\/phpdoc-parser"
|
"install-path": "..\/phpstan\/phpdoc-parser"
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -384,7 +384,7 @@ class TypeParser
|
||||||
do {
|
do {
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) {
|
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) {
|
||||||
return new Ast\Type\ArrayShapeNode($items);
|
return new Ast\Type\ArrayShapeNode($items, \true, $kind);
|
||||||
}
|
}
|
||||||
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC)) {
|
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC)) {
|
||||||
$sealed = \false;
|
$sealed = \false;
|
||||||
|
|
Loading…
Reference in New Issue