Find the best Rector rule to solve your problem


SetCookieRector

Convert setcookie argument to PHP7.3 option array

-setcookie('name', $value, 360);
+setcookie('name', $value, ['expires' => 360]);
SETS:  PHP 7.3

StringifyStrNeedlesRector

Makes needles explicit strings

 $needle = 5;
-$fivePosition = strpos('725', $needle);
+$fivePosition = strpos('725', (string) $needle);
SETS:  PHP 7.3

RegexDashEscapeRector

Escape - in some cases

-preg_match("#[\w-()]#", 'some text');
+preg_match("#[\w\-()]#", 'some text');
SETS:  PHP 7.3

ArrayKeyFirstLastRector

Make use of array_key_first() and array_key_last()

-reset($items);
-$firstKey = key($items);
+$firstKey = array_key_first($items);
SETS:  PHP 7.3 Polyfills

SensitiveDefineRector

Changes case insensitive constants to sensitive ones.

-define('FOO', 42, true);
+define('FOO', 42);
SETS:  PHP 7.3

SensitiveConstantNameRector

Changes case insensitive constants to sensitive ones.

 define('FOO', 42, true);
 var_dump(FOO);
-var_dump(foo);
+var_dump(FOO);
SETS:  PHP 7.3

SensitiveHereNowDocRector

Changes heredoc/nowdoc that contains closing word to safe wrapper name

-$value = <<<A
+$value = <<<A_WRAP
     A
-A
+A_WRAP
SETS:  PHP 7.3

IsCountableRector

Changes is_array + Countable check to is_countable

-is_array($foo) || $foo instanceof Countable;
+is_countable($foo);
SETS:  PHP 7.3 Polyfills

Configurable

RenameFunctionRector

Turns defined function call new one.

-view("...", []);
+Laravel\Templating\render("...", []);