From 25258e10282a81615fdb8722f7d5d5f719cf7e32 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 1 May 2019 00:49:59 +0200 Subject: [PATCH] fix cs --- .../Array_/CallableThisArrayToAnonymousFunctionRector.php | 7 ++++--- .../Identical/BooleanNotIdenticalToNotIdenticalRector.php | 2 +- .../EndsWithFunctionToNetteUtilsStringsRector.php | 7 ++++--- .../StartsWithFunctionToNetteUtilsStringsRector.php | 5 +++-- .../Rector/NotIdentical/StrposToStringsContainsRector.php | 2 +- .../AddDefaultValueForUndefinedVariableRector.php | 8 ++++++-- .../Class_/NewUniqueObjectToEntityFactoryRector.php | 2 +- .../Class_/PHPUnitStaticToKernelTestCaseGetRector.php | 4 ++-- .../src/Rector/Class_/PassFactoryToUniqueObjectRector.php | 2 +- .../Rector/Class_/StaticTypeToSetterInjectionRector.php | 2 +- .../Class_/FinalizeClassesWithoutChildrenRector.php | 2 +- .../MethodCall/SimplifyWebTestCaseAssertionsRector.php | 4 ++-- src/NodeContainer/ParsedNodesByType.php | 4 ++-- src/PhpParser/Node/BetterNodeFinder.php | 2 +- .../Node/Manipulator/PropertyFetchManipulator.php | 3 ++- 15 files changed, 32 insertions(+), 24 deletions(-) diff --git a/packages/CodeQuality/src/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php b/packages/CodeQuality/src/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php index 618de166326..537458b735d 100644 --- a/packages/CodeQuality/src/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php +++ b/packages/CodeQuality/src/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php @@ -10,6 +10,7 @@ use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\ClosureUse; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; use Rector\NodeContainer\ParsedNodesByType; @@ -88,7 +89,7 @@ CODE_SAMPLE } /** - * @param Node\Expr\Array_ $node + * @param Array_ $node */ public function refactor(Node $node): ?Node { @@ -126,8 +127,8 @@ CODE_SAMPLE } /** - * @param Node\Param[] $params - * @return Node\Arg[] + * @param Param[] $params + * @return Arg[] */ private function convertParamsToArgs(array $params): array { diff --git a/packages/CodeQuality/src/Rector/Identical/BooleanNotIdenticalToNotIdenticalRector.php b/packages/CodeQuality/src/Rector/Identical/BooleanNotIdenticalToNotIdenticalRector.php index 69a4661639f..ecfb0f6b5c2 100644 --- a/packages/CodeQuality/src/Rector/Identical/BooleanNotIdenticalToNotIdenticalRector.php +++ b/packages/CodeQuality/src/Rector/Identical/BooleanNotIdenticalToNotIdenticalRector.php @@ -64,7 +64,7 @@ CODE_SAMPLE } /** - * @param Identical|Node\Expr\BooleanNot $node + * @param Identical|BooleanNot $node */ public function refactor(Node $node): ?Node { diff --git a/packages/Nette/src/Rector/Identical/EndsWithFunctionToNetteUtilsStringsRector.php b/packages/Nette/src/Rector/Identical/EndsWithFunctionToNetteUtilsStringsRector.php index 58335566b8f..e5a4710a379 100644 --- a/packages/Nette/src/Rector/Identical/EndsWithFunctionToNetteUtilsStringsRector.php +++ b/packages/Nette/src/Rector/Identical/EndsWithFunctionToNetteUtilsStringsRector.php @@ -4,6 +4,7 @@ namespace Rector\Nette\Rector\Identical; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; @@ -95,7 +96,7 @@ CODE_SAMPLE } /** - * @return Node\Expr[]|null + * @return Expr[]|null */ private function matchContentAndNeedleOfSubstrOfVariableLength(Node $node, Variable $variable): ?array { @@ -111,7 +112,7 @@ CODE_SAMPLE return null; } - /** @var Node\Expr\UnaryMinus $unaryMinus */ + /** @var UnaryMinus $unaryMinus */ $unaryMinus = $node->args[1]->value; if (! $unaryMinus->expr instanceof FuncCall) { @@ -122,7 +123,7 @@ CODE_SAMPLE return null; } - /** @var Node\Expr\FuncCall $strlenFuncCall */ + /** @var FuncCall $strlenFuncCall */ $strlenFuncCall = $unaryMinus->expr; if ($this->areNodesEqual($strlenFuncCall->args[0]->value, $variable)) { diff --git a/packages/Nette/src/Rector/Identical/StartsWithFunctionToNetteUtilsStringsRector.php b/packages/Nette/src/Rector/Identical/StartsWithFunctionToNetteUtilsStringsRector.php index c17713690d7..9e21411c4c2 100644 --- a/packages/Nette/src/Rector/Identical/StartsWithFunctionToNetteUtilsStringsRector.php +++ b/packages/Nette/src/Rector/Identical/StartsWithFunctionToNetteUtilsStringsRector.php @@ -4,6 +4,7 @@ namespace Rector\Nette\Rector\Identical; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; @@ -94,7 +95,7 @@ CODE_SAMPLE } /** - * @return Node\Expr[]|null + * @return Expr[]|null */ private function matchContentAndNeedleOfSubstrOfVariableLength(Node $node, Variable $variable): ?array { @@ -121,7 +122,7 @@ CODE_SAMPLE return null; } - /** @var Node\Expr\FuncCall $strlenFuncCall */ + /** @var FuncCall $strlenFuncCall */ $strlenFuncCall = $node->args[2]->value; if ($this->areNodesEqual($strlenFuncCall->args[0]->value, $variable)) { return [$node->args[0]->value, $strlenFuncCall->args[0]->value]; diff --git a/packages/Nette/src/Rector/NotIdentical/StrposToStringsContainsRector.php b/packages/Nette/src/Rector/NotIdentical/StrposToStringsContainsRector.php index 1035f445408..07522b7ac2b 100644 --- a/packages/Nette/src/Rector/NotIdentical/StrposToStringsContainsRector.php +++ b/packages/Nette/src/Rector/NotIdentical/StrposToStringsContainsRector.php @@ -58,7 +58,7 @@ CODE_SAMPLE } /** - * @param Node\Expr\BinaryOp\NotIdentical|Node\Expr\BinaryOp\Identical $node + * @param NotIdentical|Identical $node */ public function refactor(Node $node): ?Node { diff --git a/packages/Php/src/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php b/packages/Php/src/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php index bbadc59a4c8..432d2d9023c 100644 --- a/packages/Php/src/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php +++ b/packages/Php/src/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php @@ -4,9 +4,13 @@ namespace Rector\Php\Rector\FunctionLike; use PhpParser\Node; use PhpParser\Node\Expr\Assign; +use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Variable; use PhpParser\Node\FunctionLike; +use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; +use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt\Unset_; use PHPStan\Analyser\Scope; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\NodeTraverser\CallableNodeTraverser; @@ -78,7 +82,7 @@ CODE_SAMPLE } /** - * @param Node\Stmt\ClassMethod|Node\Stmt\Function_|Node\Expr\Closure $node + * @param ClassMethod|Function_|Closure $node */ public function refactor(Node $node): ?Node { @@ -111,7 +115,7 @@ CODE_SAMPLE return null; } - if ($parentNode instanceof Node\Stmt\Unset_ || $parentNode instanceof Node\Expr\Cast\Unset_) { + if ($parentNode instanceof Unset_ || $parentNode instanceof Node\Expr\Cast\Unset_) { return null; } diff --git a/packages/RemovingStatic/src/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php b/packages/RemovingStatic/src/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php index 7f782e1ab7c..23a15105293 100644 --- a/packages/RemovingStatic/src/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php +++ b/packages/RemovingStatic/src/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php @@ -135,7 +135,7 @@ CODE_SAMPLE } /** - * @param Node\Stmt\Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/packages/RemovingStatic/src/Rector/Class_/PHPUnitStaticToKernelTestCaseGetRector.php b/packages/RemovingStatic/src/Rector/Class_/PHPUnitStaticToKernelTestCaseGetRector.php index 251f397c6ac..50296f14b3d 100644 --- a/packages/RemovingStatic/src/Rector/Class_/PHPUnitStaticToKernelTestCaseGetRector.php +++ b/packages/RemovingStatic/src/Rector/Class_/PHPUnitStaticToKernelTestCaseGetRector.php @@ -142,7 +142,7 @@ CODE_SAMPLE } /** - * @param Node\Expr\StaticCall|Node\Stmt\Class_ $node + * @param StaticCall|Class_ $node */ public function refactor(Node $node): ?Node { @@ -183,7 +183,7 @@ CODE_SAMPLE private function processStaticCall(StaticCall $staticCall): ?MethodCall { - /** @var Node\Stmt\Class_|null $class */ + /** @var Class_|null $class */ $class = $staticCall->getAttribute(AttributeKey::CLASS_NODE); if ($class === null) { return null; diff --git a/packages/RemovingStatic/src/Rector/Class_/PassFactoryToUniqueObjectRector.php b/packages/RemovingStatic/src/Rector/Class_/PassFactoryToUniqueObjectRector.php index 1a3eee8786a..cc6f6267dab 100644 --- a/packages/RemovingStatic/src/Rector/Class_/PassFactoryToUniqueObjectRector.php +++ b/packages/RemovingStatic/src/Rector/Class_/PassFactoryToUniqueObjectRector.php @@ -153,7 +153,7 @@ CODE_SAMPLE } /** - * @param Node\Expr\StaticCall|Node\Stmt\Class_ $node + * @param StaticCall|Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/packages/RemovingStatic/src/Rector/Class_/StaticTypeToSetterInjectionRector.php b/packages/RemovingStatic/src/Rector/Class_/StaticTypeToSetterInjectionRector.php index 6c18735a12c..b9ca619668e 100644 --- a/packages/RemovingStatic/src/Rector/Class_/StaticTypeToSetterInjectionRector.php +++ b/packages/RemovingStatic/src/Rector/Class_/StaticTypeToSetterInjectionRector.php @@ -101,7 +101,7 @@ CODE_SAMPLE } /** - * @param Node\Expr\StaticCall|Node\Stmt\Class_ $node + * @param StaticCall|Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/packages/SOLID/src/Rector/Class_/FinalizeClassesWithoutChildrenRector.php b/packages/SOLID/src/Rector/Class_/FinalizeClassesWithoutChildrenRector.php index 70c057d62fd..549bd68c03c 100644 --- a/packages/SOLID/src/Rector/Class_/FinalizeClassesWithoutChildrenRector.php +++ b/packages/SOLID/src/Rector/Class_/FinalizeClassesWithoutChildrenRector.php @@ -66,7 +66,7 @@ CODE_SAMPLE } /** - * @param Node\Stmt\Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/packages/Symfony/src/Rector/MethodCall/SimplifyWebTestCaseAssertionsRector.php b/packages/Symfony/src/Rector/MethodCall/SimplifyWebTestCaseAssertionsRector.php index 985b08ea42a..2ba3a552fa8 100644 --- a/packages/Symfony/src/Rector/MethodCall/SimplifyWebTestCaseAssertionsRector.php +++ b/packages/Symfony/src/Rector/MethodCall/SimplifyWebTestCaseAssertionsRector.php @@ -144,7 +144,7 @@ CODE_SAMPLE } /** - * @return Node\Arg[]|null + * @return Arg[]|null */ private function matchAssertContainsCrawlerArg(MethodCall $methodCall): ?array { @@ -182,7 +182,7 @@ CODE_SAMPLE private function processAssertResponseRedirects(MethodCall $methodCall): ?Node { - /** @var Node\Stmt\Expression|null $previousNode */ + /** @var Expression|null $previousNode */ $previousExpression = $methodCall->getAttribute(AttributeKey::PREVIOUS_EXPRESSION); if (! $previousExpression instanceof Expression) { return null; diff --git a/src/NodeContainer/ParsedNodesByType.php b/src/NodeContainer/ParsedNodesByType.php index 2eb859dfd16..8f640ec1be4 100644 --- a/src/NodeContainer/ParsedNodesByType.php +++ b/src/NodeContainer/ParsedNodesByType.php @@ -107,7 +107,7 @@ final class ParsedNodesByType } /** - * @return Node\Expr\New_[] + * @return New_[] */ public function getNewNodes(): array { @@ -115,7 +115,7 @@ final class ParsedNodesByType } /** - * @return Node\Expr\StaticCall[] + * @return StaticCall[] */ public function getStaticCallNodes(): array { diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index 914df20b5c4..186d789f73c 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -143,7 +143,7 @@ final class BetterNodeFinder } /** - * @return Node\Expr\Assign[] + * @return Assign[] */ public function findAssignsOfVariable(Node $node, Variable $variable): array { diff --git a/src/PhpParser/Node/Manipulator/PropertyFetchManipulator.php b/src/PhpParser/Node/Manipulator/PropertyFetchManipulator.php index 35f9f78e9c3..63bad01dc58 100644 --- a/src/PhpParser/Node/Manipulator/PropertyFetchManipulator.php +++ b/src/PhpParser/Node/Manipulator/PropertyFetchManipulator.php @@ -4,6 +4,7 @@ namespace Rector\PhpParser\Node\Manipulator; use PhpParser\Node; use PhpParser\Node\Expr\PropertyFetch; +use PhpParser\Node\Stmt\Class_; use PHPStan\Analyser\Scope; use PHPStan\Broker\Broker; use PHPStan\Type\ObjectType; @@ -56,7 +57,7 @@ final class PropertyFetchManipulator return false; } - /** @var Node\Stmt\Class_|null $class */ + /** @var Class_|null $class */ $class = $propertyFetch->getAttribute(AttributeKey::CLASS_NODE); if ($class === null) { return false;