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

Found 10 rules:

RemoveUselessVarTagRector

Remove unused @var annotation for properties and class constants

 final class SomeClass
 {
-    /**
-     * @var string
-     */
     public string $name = 'name';
 }
SETS:  Dead Code

RemoveUselessReadOnlyTagRector

Remove useless @readonly annotation on native readonly type

 final class SomeClass
 {
-    /**
-     * @readonly
-     */
     private readonly string $name;

     public function __construct(string $name)
     {
         $this->name = $name;
     }
 }
SETS:  Dead Code

RemoveUselessReturnTagRector

Remove @return docblock with same type as defined in PHP

 use stdClass;

 class SomeClass
 {
-    /**
-     * @return stdClass
-     */
     public function foo(): stdClass
     {
     }
 }
SETS:  Dead Code

RemoveUselessParamTagRector

Remove @param docblock with same type as parameter type

 class SomeClass
 {
     /**
-     * @param string $a
      * @param string $b description
      */
     public function foo(string $a, string $b)
     {
     }
 }
SETS:  Dead Code

RemoveNullTagValueNodeRector

Remove @var/@param/@return null docblock

 class SomeClass
 {
-    /**
-     * @return null
-     */
     public function foo()
     {
         return null;
     }
 }
SETS:  Dead Code

InlineVarDocTagToAssertRector

Convert inline @var tags to calls to assert()

-/** @var Foo $foo */
-$foo = createFoo();
+$foo = createFoo();
+assert($foo instanceof Foo);

Configurable

RemoveDumpDataDeadCodeRector

It will removes the dump data just like dd or dump functions from the code.`

 class MyController
 {
     public function store()
     {
-        dd('test');
         return true;
     }

     public function update()
     {
-        dump('test');
         return true;
     }
 }

RemoveReflectionSetAccessibleCallsRector

Remove Reflection::setAccessible() calls

 $reflectionProperty = new ReflectionProperty($object, 'property');
-$reflectionProperty->setAccessible(true);
 $value = $reflectionProperty->getValue($object);

 $reflectionMethod = new ReflectionMethod($object, 'method');
-$reflectionMethod->setAccessible(false);
 $reflectionMethod->invoke($object);
SETS:  PHP 8.1

RemoveGetClassGetParentClassNoArgsRector

Replace calls to get_class() and get_parent_class() without arguments with self::class and parent::class

 class Example extends StdClass {
     public function whoAreYou() {
-        return get_class() . ' daughter of ' . get_parent_class();
+        return self::class . ' daughter of ' . parent::class;
     }
 }
SETS:  PHP 8.3

RemoveFinfoBufferContextArgRector

Remove argument by position by function name

-finfo_buffer($finfo, $fileContents, FILEINFO_NONE, []);
+finfo_buffer($finfo, $fileContents, FILEINFO_NONE);
SETS:  PHP 8.5