From 02cf396ea5b4c0e4f22b9ced41b6e9eb6e0beadb Mon Sep 17 00:00:00 2001 From: kaizen-ci Date: Fri, 19 Mar 2021 22:59:52 +0000 Subject: [PATCH] [ci-review] Rector Rectify --- .../Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php | 2 +- rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php | 2 +- .../ClassMethod/YieldClassMethodToArrayClassMethodRector.php | 2 +- rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php | 2 +- .../MoveCurrentDateTimeDefaultInEntityToConstructorRector.php | 2 +- .../RemoveRedundantDefaultClassAnnotationValuesRector.php | 2 +- .../RemoveRedundantDefaultPropertyAnnotationValuesRector.php | 2 +- .../ClassConst/DowngradeClassConstantVisibilityRector.php | 2 +- .../ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php | 3 ++- .../Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php | 2 +- .../DowngradeNullsafeToTernaryOperatorRector.php | 2 +- .../Rector/FuncCall/MysqlFuncCallToMysqliRector.php | 2 +- rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php | 2 +- rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php | 2 +- .../Rector/Class_/NewUniqueObjectToEntityFactoryRector.php | 2 +- .../Rector/ClassConstFetch/RenameClassConstFetchRector.php | 2 +- rules/Renaming/Rector/ConstFetch/RenameConstantRector.php | 2 +- 17 files changed, 18 insertions(+), 17 deletions(-) diff --git a/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php b/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php index 974cf9bc199c..7e2b769b905f 100644 --- a/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php +++ b/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php @@ -69,7 +69,7 @@ public function getNodeTypes(): array /** * @param FuncCall $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): FuncCall { foreach ($this->functionArgumentSwaps as $functionArgumentSwap) { if (! $this->isName($node, $functionArgumentSwap->getFunction())) { diff --git a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php index 014046a2abc5..0339a353722f 100644 --- a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php +++ b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php @@ -57,7 +57,7 @@ public function getNodeTypes(): array /** * @param NotEqual $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): NotEqual { // invoke override to default "!=" $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); diff --git a/rules/CodingStyle/Rector/ClassMethod/YieldClassMethodToArrayClassMethodRector.php b/rules/CodingStyle/Rector/ClassMethod/YieldClassMethodToArrayClassMethodRector.php index 12cddae8442e..f7f1fd7e0c8c 100644 --- a/rules/CodingStyle/Rector/ClassMethod/YieldClassMethodToArrayClassMethodRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/YieldClassMethodToArrayClassMethodRector.php @@ -93,7 +93,7 @@ public function getNodeTypes(): array /** * @param ClassMethod $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): ClassMethod { foreach ($this->methodsByType as $type => $methods) { if (! $this->isObjectType($node, new ObjectType($type))) { diff --git a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php index 92cd837e1d47..e091f44d1d06 100644 --- a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php +++ b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php @@ -65,7 +65,7 @@ public function getNodeTypes(): array /** * @param String_ $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): String_ { $doubleQuoteCount = substr_count($node->value, '"'); $singleQuoteCount = substr_count($node->value, "'"); diff --git a/rules/DoctrineCodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php b/rules/DoctrineCodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php index 5f18c2ef141a..a5664f438157 100644 --- a/rules/DoctrineCodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php +++ b/rules/DoctrineCodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php @@ -116,7 +116,7 @@ public function getNodeTypes(): array /** * @param Class_ $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Class_ { foreach ($node->getProperties() as $property) { $this->refactorProperty($property, $node); diff --git a/rules/DoctrineCodeQuality/Rector/Class_/RemoveRedundantDefaultClassAnnotationValuesRector.php b/rules/DoctrineCodeQuality/Rector/Class_/RemoveRedundantDefaultClassAnnotationValuesRector.php index 20b4b05556c6..8ed1024b79b2 100644 --- a/rules/DoctrineCodeQuality/Rector/Class_/RemoveRedundantDefaultClassAnnotationValuesRector.php +++ b/rules/DoctrineCodeQuality/Rector/Class_/RemoveRedundantDefaultClassAnnotationValuesRector.php @@ -70,7 +70,7 @@ public function getNodeTypes(): array /** * @param Class_ $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Class_ { if ($node instanceof Class_) { $this->refactorClassAnnotations($node); diff --git a/rules/DoctrineCodeQuality/Rector/Property/RemoveRedundantDefaultPropertyAnnotationValuesRector.php b/rules/DoctrineCodeQuality/Rector/Property/RemoveRedundantDefaultPropertyAnnotationValuesRector.php index c2f5ac91f2c5..6e558b36c66b 100644 --- a/rules/DoctrineCodeQuality/Rector/Property/RemoveRedundantDefaultPropertyAnnotationValuesRector.php +++ b/rules/DoctrineCodeQuality/Rector/Property/RemoveRedundantDefaultPropertyAnnotationValuesRector.php @@ -102,7 +102,7 @@ public function getNodeTypes(): array /** * @param Property $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Property { if ($node instanceof Property) { $this->refactorPropertyAnnotations($node); diff --git a/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php b/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php index b5e8c90a048e..9f6fb852204f 100644 --- a/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php +++ b/rules/DowngradePhp71/Rector/ClassConst/DowngradeClassConstantVisibilityRector.php @@ -54,7 +54,7 @@ public function getNodeTypes(): array /** * @param ClassConst $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): ClassConst { $this->visibilityManipulator->removeVisibility($node); diff --git a/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php b/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php index fb94142747df..73078a214064 100644 --- a/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php +++ b/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php @@ -6,6 +6,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\ArrowFunction; +use PhpParser\Node\Expr\Closure; use PhpParser\Node\Stmt\Return_; use Rector\Core\Rector\AbstractRector; use Rector\Php72\NodeFactory\AnonymousFunctionFactory; @@ -71,7 +72,7 @@ public function getNodeTypes(): array /** * @param ArrowFunction $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Closure { $stmts = [new Return_($node->expr)]; diff --git a/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php b/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php index 65cb93ed18e9..7bbbeb8a5e60 100644 --- a/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php +++ b/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php @@ -46,7 +46,7 @@ public function getNodeTypes(): array /** * @param AssignCoalesce $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Assign { return new Assign($node->var, new Coalesce($node->var, $node->expr)); } diff --git a/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php b/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php index 4cdf76a55e98..23911cfabca6 100644 --- a/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php +++ b/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php @@ -47,7 +47,7 @@ public function getNodeTypes(): array /** * @param NullsafeMethodCall|NullsafePropertyFetch $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Ternary { $called = $node instanceof NullsafeMethodCall ? new MethodCall($node->var, $node->name, $node->args) diff --git a/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php b/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php index 4a56e8c70b9d..a0542cf32520 100644 --- a/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php +++ b/rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php @@ -56,7 +56,7 @@ public function getNodeTypes(): array /** * @param FuncCall $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): FuncCall { if ($this->isName($node, 'mysql_create_db')) { return $this->processMysqlCreateDb($node); diff --git a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php index cc85d30d4ead..358d5c33319c 100644 --- a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php +++ b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php @@ -69,7 +69,7 @@ public function getNodeTypes(): array /** * @param Switch_ $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Switch_ { foreach ($node->cases as $case) { foreach ($case->stmts as $key => $caseStmt) { diff --git a/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php b/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php index a2b864217e01..148b9127bf2c 100644 --- a/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php +++ b/rules/Php54/Rector/FuncCall/RemoveReferenceFromCallRector.php @@ -53,7 +53,7 @@ public function getNodeTypes(): array /** * @param FuncCall $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): FuncCall { foreach ($node->args as $nodeArg) { if ($nodeArg->byRef) { diff --git a/rules/RemovingStatic/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php b/rules/RemovingStatic/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php index 55c27c160558..c57da7922247 100644 --- a/rules/RemovingStatic/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php +++ b/rules/RemovingStatic/Rector/Class_/NewUniqueObjectToEntityFactoryRector.php @@ -133,7 +133,7 @@ public function getNodeTypes(): array /** * @param Class_ $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): Class_ { $this->matchedObjectTypes = []; diff --git a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php index f5501e961e06..76d5a4a148b3 100644 --- a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php +++ b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php @@ -71,7 +71,7 @@ public function getNodeTypes(): array /** * @param ClassConstFetch $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): ClassConstFetch { foreach ($this->renameClassConstFetches as $renameClassConstFetch) { if (! $this->isObjectType($node->class, $renameClassConstFetch->getOldObjectType())) { diff --git a/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php b/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php index d2da71d0001a..6f0c36adbbaf 100644 --- a/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php +++ b/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php @@ -72,7 +72,7 @@ public function getNodeTypes(): array /** * @param ConstFetch $node */ - public function refactor(Node $node): ?Node + public function refactor(Node $node): ConstFetch { foreach ($this->oldToNewConstants as $oldConstant => $newConstant) { if (! $this->isName($node, $oldConstant)) {