-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#7889Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/8ac3d4d0-4865-4c55-a137-c593363911d4
<?php
$port = '8080';
$scheme = 'https';
$port = isset($port) ? $port : (($scheme == 'https') ? '443' : '80');Responsible rules
TernaryToNullCoalescingRector
Expected Behavior
- The parentheses around the nested ternary should be preserved when converting to null coalescing operator:
-$port = isset($port) ? $port : (($scheme == 'https') ? '443' : '80');
+$port = $port ?? (($scheme == 'https') ? '443' : '80');Note
- This worked correctly in Rector 1.x, where the parentheses were properly preserved during the transformation.
Reactions are currently unavailable