Replace coalesce to ternary when left side is non nullable
function run(string $a)
{
- return $a ?? 'foo';
+ return $a ?: 'foo';
}
Configure your rector.php:
<?php
use Rector\CodeQuality\Rector\Coalesce\CoalesceToTernaryRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
CoalesceToTernaryRector::class,
]);