Skip to content

Commit 8a8f009

Browse files
committed
Updated Rector to commit 2ed3aa83d8300798973e480e52c9c2ddd7fa6d00
rectorphp/rector-src@2ed3aa8 Don't require parentheses for short-ternaries (#7604)
1 parent 553a28f commit 8a8f009

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public function getNodeTypes(): array
5252
public function refactor(Node $node): ?Node
5353
{
5454
if ($node->cond instanceof Ternary || $node->else instanceof Ternary) {
55+
// Chaining of short-ternaries (elvis operator) is stable and behaves reasonably
56+
$isElvis = $node->cond instanceof Ternary && $node->cond->if === null;
57+
if ($isElvis) {
58+
return null;
59+
}
5560
if ($this->parenthesizedNestedTernaryAnalyzer->isParenthesized($this->file, $node)) {
5661
return null;
5762
}

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '8376d26987ca4f6fc36f779b84c04d71900e14ac';
22+
public const PACKAGE_VERSION = '2ed3aa83d8300798973e480e52c9c2ddd7fa6d00';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-10-29 20:46:56';
27+
public const RELEASE_DATE = '2025-10-29 21:51:36';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)