Skip to content

Commit d09938b

Browse files
committed
Revert Update Rector
This reverts commit 989dcd7.
1 parent 989dcd7 commit d09938b

7 files changed

+101
-22
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"phpstan/phpstan-phpunit": "^1.0",
5757
"phpstan/phpstan-strict-rules": "^1.0",
5858
"phpunit/phpunit": "^9.5.4",
59-
"rector/rector": "^0.12.10",
59+
"rector/rector": "0.12.5",
6060
"vaimo/composer-patches": "^4.22"
6161
},
6262
"config": {

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@package rector/rector
2+
3+
--- rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-11-23 18:38:29.000000000 +0100
4+
+++ rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-12-17 18:06:56.000000000 +0100
5+
@@ -174,13 +174,19 @@
6+
*/
7+
private function cleanClosureUses(array $uses) : array
8+
{
9+
- $variableNames = \array_map(function ($use) : string {
10+
- return (string) $this->nodeNameResolver->getName($use->var);
11+
- }, $uses, []);
12+
- $variableNames = \array_unique($variableNames);
13+
- return \array_map(static function ($variableName) : ClosureUse {
14+
- return new \PhpParser\Node\Expr\ClosureUse(new \PhpParser\Node\Expr\Variable($variableName));
15+
- }, $variableNames, []);
16+
+ $uniqueUses = [];
17+
+ foreach ($uses as $use) {
18+
+ if (!\is_string($use->var->name)) {
19+
+ continue;
20+
+ }
21+
+ $variableName = $use->var->name;
22+
+ if (\array_key_exists($variableName, $uniqueUses)) {
23+
+ continue;
24+
+ }
25+
+
26+
+ $uniqueUses[$variableName] = $use;
27+
+ }
28+
+ return \array_values($uniqueUses);
29+
}
30+
private function applyNestedUses(\PhpParser\Node\Expr\Closure $anonymousFunctionNode, \PhpParser\Node\Expr\Variable $useVariable) : \PhpParser\Node\Expr\Closure
31+
{
32+
@@ -269,7 +275,11 @@
33+
}
34+
$parentArrowFunction = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\ArrowFunction::class);
35+
if ($parentArrowFunction instanceof \PhpParser\Node\Expr\ArrowFunction) {
36+
- return !(bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class);
37+
+ $parentCallLike = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\CallLike::class);
38+
+
39+
+ if (! $parentCallLike instanceof \PhpParser\Node\Expr\CallLike) {
40+
+ return ! (bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class);
41+
+ }
42+
}
43+
return \true;
44+
});

patches/BooleanTypeMapper.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@package rector/rector
2+
3+
--- rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:27.000000000 +0100
4+
+++ rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:45.000000000 +0100
5+
@@ -58,7 +58,7 @@
6+
*/
7+
public function getNodeTypes() : array
8+
{
9+
- return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class];
10+
+ return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class, Node\Expr\New_::class];
11+
}
12+
/**
13+
* @param FuncCall|MethodCall|StaticCall $node
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@package rector/rector
2+
3+
--- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:20.000000000 +0100
4+
+++ packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:27.000000000 +0100
5+
@@ -226,12 +226,12 @@
6+
{
7+
// 1. get PHPStan locator
8+
/** @var ClassReflector $classReflector */
9+
- $classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
10+
+ //$classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
11+
/** @var SourceLocator $sourceLocator */
12+
- $sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
13+
+ //$sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
14+
// 2. get Rector locator
15+
- $aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
16+
- $this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
17+
+ //$aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
18+
+ //$this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
19+
}
20+
private function createDummyClassScopeContext(\PHPStan\Analyser\MutatingScope $mutatingScope) : \PHPStan\Analyser\ScopeContext
21+
{

patches/TypeFactory.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@package rector/rector
2+
3+
--- packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-11-23 18:38:29.000000000 +0100
4+
+++ packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-12-18 22:49:01.000000000 +0100
5+
@@ -122,9 +122,6 @@
6+
if ($type instanceof \PHPStan\Type\Constant\ConstantIntegerType) {
7+
return new \PHPStan\Type\IntegerType();
8+
}
9+
- if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
10+
- return new \PHPStan\Type\BooleanType();
11+
- }
12+
return $type;
13+
}
14+
/**

0 commit comments

Comments
 (0)