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

Found 10 rules:

RenameVariableToMatchMethodCallReturnTypeRector

Rename variable to match method return type

 class SomeClass
 {
     public function run()
     {
-        $a = $this->getRunner();
+        $runner = $this->getRunner();
     }

     public function getRunner(): Runner
     {
         return new Runner();
     }
 }
SETS:  Naming

RenameForeachValueVariableToMatchMethodCallReturnTypeRector

Renames value variable name in foreach loop to match method type

 class SomeClass
 {
     public function run()
     {
         $array = [];
-        foreach ($object->getMethods() as $property) {
-            $array[] = $property;
+        foreach ($object->getMethods() as $method) {
+            $array[] = $method;
         }
     }
 }
SETS:  Naming

RenameForeachValueVariableToMatchExprVariableRector

Renames value variable name in foreach loop to match expression variable

 class SomeClass
 {
     public function run()
     {
         $array = [];
-        foreach ($variables as $property) {
-            $array[] = $property;
+        foreach ($variables as $variable) {
+            $array[] = $variable;
         }
     }
 }
SETS:  Naming

RenamePropertyToMatchTypeRector

Rename property and method param to match its type

 class SomeClass
 {
     /**
      * @var EntityManager
      */
-    private $eventManager;
+    private $entityManager;

-    public function __construct(EntityManager $eventManager)
+    public function __construct(EntityManager $entityManager)
     {
-        $this->eventManager = $eventManager;
+        $this->entityManager = $entityManager;
     }
 }
SETS:  Naming

RenameParamToMatchTypeRector

Rename param to match ClassType

 final class SomeClass
 {
-    public function run(Apple $pie)
+    public function run(Apple $apple)
     {
-        $food = $pie;
+        $food = $apple;
     }
 }
SETS:  Naming

RenameVariableToMatchNewTypeRector

Rename variable to match new ClassType

 final class SomeClass
 {
     public function run()
     {
-        $search = new DreamSearch();
-        $search->advance();
+        $dreamSearch = new DreamSearch();
+        $dreamSearch->advance();
     }
 }
SETS:  Naming

RenameMktimeWithoutArgsToTimeRector

Renames mktime() without arguments to time()

 class SomeClass
 {
     public function run()
     {
         $time = mktime(1, 2, 3);
-        $nextTime = mktime();
+        $nextTime = time();
     }
 }
SETS:  PHP 7.0

Configurable

RenameFunctionLikeParamWithinCallLikeArgRector

Rename param within closures and arrow functions based on use with specified method calls

-(new SomeClass)->process(function ($param) {});
+(new SomeClass)->process(function ($parameter) {});

Configurable

RenameMethodRector

Turns method names to new ones.


Configurable

RenameFunctionRector

Turns defined function call new one.

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