TernaryEmptyArrayArrayDimFetchToCoalesceRector

Change ternary empty on array property with array dim fetch to coalesce operator

 final class SomeClass
 {
     private array $items = [];

     public function run()
     {
-        return ! empty($this->items) ? $this->items[0] : 'default';
+        return $this->items[0] ?? 'default';
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
    ]);
SETS:  Code Quality