Find a Rector rule

Find the best Rector rule to solve your problem. Searching through 1108 rules.

Found 4 rules, grouped by set: Clear

PHP 8.2 4 matches

Change deprecated utf8_decode() and utf8_encode() to mb_convert_encoding()

-utf8_decode($value);
-utf8_encode($value);
+mb_convert_encoding($value, 'ISO-8859-1');
+mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');

Replace deprecated ${var} to {$var}

 $c = "football";
-echo "I like playing ${c}";
+echo "I like playing {$c}";

Prior PHP 8.2 FilesystemIterator::SKIP_DOTS was always set and could not be removed, therefore FilesystemIterator::SKIP_DOTS is added in order to keep this behaviour

-new FilesystemIterator(__DIR__, FilesystemIterator::KEY_AS_FILENAME);
+new FilesystemIterator(__DIR__, FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::SKIP_DOTS);

Decorate read-only class with readonly attribute

-final class SomeClass
+final readonly class SomeClass
 {
     public function __construct(
-        private readonly string $name
+        private string $name
     ) {
     }
 }