Find the best Rector rule to solve your problem. Searching through 755 rules.
Found 8 rules:
Replace null key in array_key_exists with empty string
-array_key_exists(null, $array);
+array_key_exists('', $array);
Wrap chr() argument with % 256 to avoid deprecated out-of-range integers
-echo chr(300);
+echo chr(300 % 256);
Remove argument by position by function name
-finfo_buffer($finfo, $fileContents, FILEINFO_NONE, []);
+finfo_buffer($finfo, $fileContents, FILEINFO_NONE);
Replace ord($str) with ord($str[0])
-echo ord('abc');
+echo ord('a');
Change deprecated semicolon to colon after switch case
switch ($value) {
- case 'baz';
+ case 'baz':
echo 'baz';
}
Change @deprecated annotation to Deprecated attribute
-/**
- * @deprecated 1.0.0 Use SomeOtherConstant instead
- */
+#[\Deprecated(message: 'Use SomeOtherConstant instead', since: '1.0.0')]
const SomeConstant = 'irrelevant';
Replaces null
return value with empty array in __debugInfo
methods
new class
{
public function __debugInfo() {
- return null;
+ return [];
}
};
Make use of array_first() and array_last()
-echo $array[array_key_first($array)];
-echo $array[array_key_last($array)];
+echo array_first($array);
+echo array_last($array;