TernaryConditionVariableAssignmentRector

Assign outcome of ternary condition to variable, where applicable

 function ternary($value)
 {
-    $value ? $a = 1 : $a = 0;
+    $a = $value ? 1 : 0;
 }

Configure your rector.php:

<?php

use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        TernaryConditionVariableAssignmentRector::class,
    ]);
SETS:  Coding Style