Find the best Rector rule to solve your problem


RemoveExtraParametersRector

Remove extra parameters

-strlen("asdf", 1);
+strlen("asdf");

AssignArrayToStringRector

String cannot be turned into array by assignment anymore

-$string = '';
+$string = [];
 $string[] = 1;
SETS:  PHP 7.1

BinaryOpBetweenNumberAndStringRector

Change binary operation between some number + string to PHP 7.1 compatible version

 class SomeClass
 {
     public function run()
     {
-        $value = 5 + '';
-        $value = 5.0 + 'hi';
+        $value = 5 + 0;
+        $value = 5.0 + 0.0;
     }
 }
SETS:  PHP 7.1

MultiExceptionCatchRector

Changes multi catch of same exception to single one | separated.

 try {
     // Some code...
-} catch (ExceptionType1 $exception) {
-    $sameCode;
-} catch (ExceptionType2 $exception) {
+} catch (ExceptionType1 | ExceptionType2 $exception) {
     $sameCode;
 }
SETS:  PHP 7.1

IsIterableRector

Changes is_array + Traversable check to is_iterable

-is_array($foo) || $foo instanceof Traversable;
+is_iterable($foo);
SETS:  PHP 7.1

ListToArrayDestructRector

Change list() to array destruct

 class SomeClass
 {
     public function run()
     {
-        list($id1, $name1) = $data;
+        [$id1, $name1] = $data;

-        foreach ($data as list($id, $name)) {
+        foreach ($data as [$id, $name]) {
         }
     }
 }
SETS:  PHP 7.1