SimplifyIfElseToTernaryRector

Changes if/else for same value as assign to ternary

 class SomeClass
 {
     public function run()
     {
-        if (empty($value)) {
-            $this->arrayBuilt[][$key] = true;
-        } else {
-            $this->arrayBuilt[][$key] = $value;
-        }
+        $this->arrayBuilt[][$key] = empty($value) ? true : $value;
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\Config\RectorConfig;

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