DowngradeListReferenceAssignmentRector
Convert the list reference assignment to its equivalent PHP 7.2 code
class SomeClass
{
public function run($string)
{
$array = [1, 2, 3];
- list($a, &$b) = $array;
+ list($a) = $array;
+ $b =& $array[1];
- [&$c, $d, &$e] = $array;
+ [$c, $d, $e] = $array;
+ $c =& $array[0];
+ $e =& $array[2];
- list(&$a, &$b) = $array;
+ $a =& $array[0];
+ $b =& $array[1];
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector;
return RectorConfig::configure()
->withRules([
DowngradeListReferenceAssignmentRector::class,
]);