You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Php74] Add rule to convert if (!isset($x)) { $x = ...; } to ??= #9843
NullCoalescingOperatorRector currently operates on Assign nodes, so it only recognizes the self-referencing coalesce form. The equivalent if guard which is what most pre-7.4 code actually looks like, is not detected.
Note that Rector already encodes this equivalence in the opposite direction: the PHP 7.4 downgrade set rewrites ??= into exactly the if ( ! isset( ... ) ) block requested here (see #4124). Only the upgrade direction is missing.
Activity
TomasVotruba commentedon Aug 20, 2026
Great idea 👍
There you go rectorphp/rector-src#8356