IfIssetToCoalescingRector

Change if with isset and return to coalesce

 class SomeClass
 {
     private $items = [];

     public function resolve($key)
     {
-        if (isset($this->items[$key])) {
-            return $this->items[$key];
-        }
-
-        return 'fallback value';
+        return $this->items[$key] ?? 'fallback value';
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;

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