From c3291b9b903364664dacbe96ec6735877ca72feb Mon Sep 17 00:00:00 2001 From: TomasVotruba <924196+TomasVotruba@users.noreply.github.com> Date: Sun, 1 Mar 2026 00:53:42 +0000 Subject: [PATCH] [automated] Apply Coding Standard --- .../Rector/FuncCall/StrictInArrayRector.php | 15 ++++++++------- .../Ternary/TernaryToNullCoalescingRector.php | 6 +++++- .../Rector/List_/ListToArrayDestructRector.php | 10 +++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/rules/CodingStyle/Rector/FuncCall/StrictInArrayRector.php b/rules/CodingStyle/Rector/FuncCall/StrictInArrayRector.php index d15bb8097f4..f0ac1007161 100644 --- a/rules/CodingStyle/Rector/FuncCall/StrictInArrayRector.php +++ b/rules/CodingStyle/Rector/FuncCall/StrictInArrayRector.php @@ -25,9 +25,10 @@ public function __construct( public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Set in_array strict to true when defined on similar type', [ - new CodeSample( - <<<'CODE_SAMPLE' + 'Set in_array strict to true when defined on similar type', + [ + new CodeSample( + <<<'CODE_SAMPLE' class BothStrings { public function run(string $value) @@ -36,8 +37,8 @@ public function run(string $value) } } CODE_SAMPLE - , - <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class BothStrings { public function run(string $value) @@ -46,8 +47,8 @@ public function run(string $value) } } CODE_SAMPLE - ), - ] + ), + ] ); } diff --git a/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php b/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php index 9b9ad83aafb..1599eaad212 100644 --- a/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php +++ b/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php @@ -115,7 +115,11 @@ private function processTernaryWithIsset(Ternary $ternary, Isset_ $isset): ?Coal return null; } - if (($ternary->else instanceof Ternary || $ternary->else instanceof BinaryOp) && $this->isTernaryParenthesized($this->file, $ternary->cond, $ternary)) { + if (($ternary->else instanceof Ternary || $ternary->else instanceof BinaryOp) && $this->isTernaryParenthesized( + $this->file, + $ternary->cond, + $ternary + )) { $ternary->else->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, true); } diff --git a/rules/Php71/Rector/List_/ListToArrayDestructRector.php b/rules/Php71/Rector/List_/ListToArrayDestructRector.php index 00f97b8ab16..eaafa1ea313 100644 --- a/rules/Php71/Rector/List_/ListToArrayDestructRector.php +++ b/rules/Php71/Rector/List_/ListToArrayDestructRector.php @@ -108,6 +108,11 @@ public function refactor(Node $node): ?Node return $node; } + public function provideMinPhpVersion(): int + { + return PhpVersionFeature::ARRAY_DESTRUCT; + } + private function hasPartialDestruct(List_ $list): bool { foreach ($list->items as $listItem) { @@ -118,9 +123,4 @@ private function hasPartialDestruct(List_ $list): bool return false; } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::ARRAY_DESTRUCT; - } }