ParenthesizeNestedTernaryRector

Add parentheses to nested ternary

-$value = $a ? $b : $a ?: null;
+$value = ($a ? $b : $a) ?: null;

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Ternary\ParenthesizeNestedTernaryRector;

return RectorConfig::configure()
    ->withRules([
        ParenthesizeNestedTernaryRector::class,
    ]);
SETS:  PHP 7.4