Find a Rector rule

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

Found 10 rules, grouped by set: Clear

drupal/core 11.2 1 match

Remove deprecated CacheTagChecksumCount and CacheTagIsValidCount entries from assertMetrics() calls (deprecated in drupal:11.2.0, removed in drupal:12.0.0, no replacement).

 $this->assertMetrics([
     'CacheGetCount' => 5,
-    'CacheTagChecksumCount' => 38,
-    'CacheTagIsValidCount' => 43,
     'CacheTagInvalidationCount' => 0,
 ], $performance_data);
Not in a set 3 matches

Remove the deprecated 6th $tag argument from TwigNodeTrans constructor calls

-new TwigNodeTrans($body, $plural, $count, $options, $lineno, $this->getTag());
+new TwigNodeTrans($body, $plural, $count, $options, $lineno);

Merge more precise @phpstan-var/@phpstan-param/@phpstan-return docblock tag into its native @var/@param/@return tag

 final class SomeClass
 {
     /**
-     * @var Collection
-     *
-     * @phpstan-var Collection<int, string>
+     * @var Collection<int, string>
      */
     private $items;
 }

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;
     }
 }
Dead Code 6 matches

Remove unused @var annotation for properties and class constants

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

Remove useless @readonly annotation on native readonly type

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

     public function __construct(string $name)
     {
         $this->name = $name;
     }
 }

Remove @return docblock with same type as defined in PHP

 use stdClass;

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

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)
     {
     }
 }

Remove @return docblock that contradicts the declared native return type

 final class SomeClass
 {
-    /**
-     * @return SomeObject
-     */
     public function getName(): string
     {
         return $this->someObject->getName();
     }
 }

Remove @var/@param/@return null docblock

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