From 0f30c5db41b20816a48e6b62193e23f0a9910706 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 20 Dec 2021 08:49:12 +0000 Subject: [PATCH] [ci-review] Rector Rectify --- .../FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php | 3 ++- .../Rector/MethodCall/DowngradeReflectionGetTypeRector.php | 2 +- .../MethodCall/DowngradeReflectionGetAttributesRector.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php b/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php index c358f5f3191..8de43ab912d 100644 --- a/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php +++ b/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php @@ -7,6 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\StaticCall; use Rector\Core\Rector\AbstractRector; use Rector\DowngradePhp73\Tokenizer\FollowedByCommaAnalyzer; @@ -65,7 +66,7 @@ public function __construct(string $value) */ public function getNodeTypes(): array { - return [FuncCall::class, MethodCall::class, StaticCall::class, Node\Expr\New_::class]; + return [FuncCall::class, MethodCall::class, StaticCall::class, New_::class]; } /** diff --git a/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php b/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php index c71e7226563..1dc1f1a86e3 100644 --- a/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php +++ b/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php @@ -89,7 +89,7 @@ public function refactor(Node $node): ?Node $node->setAttribute(AttributeKey::CREATED_BY_RULE, self::class); return new Ternary( - $this->nodeFactory->createFuncCall('method_exists', [$node->var, 'getType']), + $this->nodeFactory->createFuncCall('method_exists', fn (): string => $node->var->getType()), $node, $this->nodeFactory->createNull() ); diff --git a/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php b/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php index 6c4fd8f653c..a67c1eac7f7 100644 --- a/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php +++ b/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php @@ -84,7 +84,7 @@ public function refactor(Node $node): ?Node $node->setAttribute(AttributeKey::CREATED_BY_RULE, self::class); return new Ternary( - $this->nodeFactory->createFuncCall('method_exists', [$node->var, 'getAttributes']), + $this->nodeFactory->createFuncCall('method_exists', fn (): array => $node->var->getAttributes()), $node, new Array_([]) );