-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
101 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@package rector/rector | ||
|
||
--- rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-11-23 18:38:29.000000000 +0100 | ||
+++ rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-12-17 18:06:56.000000000 +0100 | ||
@@ -174,13 +174,19 @@ | ||
*/ | ||
private function cleanClosureUses(array $uses) : array | ||
{ | ||
- $variableNames = \array_map(function ($use) : string { | ||
- return (string) $this->nodeNameResolver->getName($use->var); | ||
- }, $uses, []); | ||
- $variableNames = \array_unique($variableNames); | ||
- return \array_map(static function ($variableName) : ClosureUse { | ||
- return new \PhpParser\Node\Expr\ClosureUse(new \PhpParser\Node\Expr\Variable($variableName)); | ||
- }, $variableNames, []); | ||
+ $uniqueUses = []; | ||
+ foreach ($uses as $use) { | ||
+ if (!\is_string($use->var->name)) { | ||
+ continue; | ||
+ } | ||
+ $variableName = $use->var->name; | ||
+ if (\array_key_exists($variableName, $uniqueUses)) { | ||
+ continue; | ||
+ } | ||
+ | ||
+ $uniqueUses[$variableName] = $use; | ||
+ } | ||
+ return \array_values($uniqueUses); | ||
} | ||
private function applyNestedUses(\PhpParser\Node\Expr\Closure $anonymousFunctionNode, \PhpParser\Node\Expr\Variable $useVariable) : \PhpParser\Node\Expr\Closure | ||
{ | ||
@@ -269,7 +275,11 @@ | ||
} | ||
$parentArrowFunction = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\ArrowFunction::class); | ||
if ($parentArrowFunction instanceof \PhpParser\Node\Expr\ArrowFunction) { | ||
- return !(bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class); | ||
+ $parentCallLike = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\CallLike::class); | ||
+ | ||
+ if (! $parentCallLike instanceof \PhpParser\Node\Expr\CallLike) { | ||
+ return ! (bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class); | ||
+ } | ||
} | ||
return \true; | ||
}); |
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
patches/DowngradeTrailingCommasInFunctionCallsRector.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@package rector/rector | ||
|
||
--- rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:27.000000000 +0100 | ||
+++ rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:45.000000000 +0100 | ||
@@ -58,7 +58,7 @@ | ||
*/ | ||
public function getNodeTypes() : array | ||
{ | ||
- return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class]; | ||
+ return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class, Node\Expr\New_::class]; | ||
} | ||
/** | ||
* @param FuncCall|MethodCall|StaticCall $node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@package rector/rector | ||
|
||
--- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:20.000000000 +0100 | ||
+++ packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:27.000000000 +0100 | ||
@@ -226,12 +226,12 @@ | ||
{ | ||
// 1. get PHPStan locator | ||
/** @var ClassReflector $classReflector */ | ||
- $classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector'); | ||
+ //$classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector'); | ||
/** @var SourceLocator $sourceLocator */ | ||
- $sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator'); | ||
+ //$sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator'); | ||
// 2. get Rector locator | ||
- $aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]); | ||
- $this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator); | ||
+ //$aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]); | ||
+ //$this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator); | ||
} | ||
private function createDummyClassScopeContext(\PHPStan\Analyser\MutatingScope $mutatingScope) : \PHPStan\Analyser\ScopeContext | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@package rector/rector | ||
|
||
--- packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-11-23 18:38:29.000000000 +0100 | ||
+++ packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-12-18 22:49:01.000000000 +0100 | ||
@@ -122,9 +122,6 @@ | ||
if ($type instanceof \PHPStan\Type\Constant\ConstantIntegerType) { | ||
return new \PHPStan\Type\IntegerType(); | ||
} | ||
- if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) { | ||
- return new \PHPStan\Type\BooleanType(); | ||
- } | ||
return $type; | ||
} | ||
/** |