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

Found 21 rules:

CallUserFuncToMethodCallRector

Refactor call_user_func() on known class method to a method call

 final class SomeClass
 {
     public function run()
     {
-        $result = \call_user_func([$this->property, 'method'], $args);
+        $result = $this->property->method($args);
     }
 }
SETS:  Coding Style

StrictArraySearchRector

Makes array_search search for identical elements

-array_search($value, $items);
+array_search($value, $items, true);
SETS:  Coding Style

CallUserFuncArrayToVariadicRector

Replace call_user_func_array() with variadic

 class SomeClass
 {
     public function run()
     {
-        call_user_func_array('some_function', $items);
+        some_function(...$items);
     }
 }
SETS:  Coding Style

StrictInArrayRector

Set in_array strict to true when defined on similar type

 class BothStrings
 {
     public function run(string $value)
     {
-        return in_array($value, ['one', 'two', 'three']);
+        return in_array($value, ['one', 'two', 'three'], true);
     }
 }
SETS:  Coding Style

VersionCompareFuncCallToConstantRector

Changes use of call to version compare function to use of PHP version constant

 class SomeClass
 {
     public function run()
     {
-        version_compare(PHP_VERSION, '5.3.0', '<');
+        PHP_VERSION_ID < 50300;
     }
 }
SETS:  Coding Style

NewlineBetweenClassLikeStmtsRector

Add new line space between class constants, properties and class methods to make it more readable

 final class SomeClass
 {
     public const NAME = 'name';
+
     public function first()
     {
     }
+
     public function second()
     {
     }
 }
SETS:  Coding Style

CatchExceptionNameMatchingTypeRector

Type and name of catch exception should match

 try {
     // ...
-} catch (SomeException $typoException) {
-    $typoException->getMessage();
+} catch (SomeException $someException) {
+    $someException->getMessage();
 }
SETS:  Coding Style

SplitGroupedPropertiesRector

Separate grouped properties to own lines

 class SomeClass
 {
     /**
      * @var string
      */
-    public $isIt, $isIsThough;
+    public $isIt;
+
+    /**
+     * @var string
+     */
+    public $isIsThough;
 }
SETS:  Coding Style

SplitDoubleAssignRector

Split multiple inline assigns to each own lines default value, to prevent undefined array issues

 class SomeClass
 {
     public function run()
     {
-        $one = $two = 1;
+        $one = 1;
+        $two = 1;
     }
 }
SETS:  Coding Style

NewlineAfterStatementRector

Add empty new line after different-type statements to improve code readability

 class SomeClass
 {
     public function run($input)
     {
         $value = 5 * $input;
+
         $secondValue = $value ^ 5;
+
         return $value - $secondValue;
     }
 }
SETS:  Coding Style

RemoveUselessAliasInUseStatementRector

Remove useless alias in use statement as same name with last use statement name

-use App\Bar as Bar;
+use App\Bar;
SETS:  Coding Style

SimplifyQuoteEscapeRector

Prefer quote that are not inside the string

 class SomeClass
 {
     public function run()
     {
-         $name = "\" Tom";
-         $name = '\' Sara';
+         $name = '" Tom';
+         $name = "' Sara";
     }
 }
SETS:  Coding Style

UseClassKeywordForClassNameResolutionRector

Use class keyword for class name resolution in string instead of hardcoded string reference

-$value = 'App\SomeClass::someMethod()';
+$value = \App\SomeClass::class . '::someMethod()';
SETS:  Coding Style

SplitGroupedClassConstantsRector

Separate class constant to own lines

 class SomeClass
 {
-    const HI = true, HELLO = 'true';
+    const HI = true;
+    const HELLO = 'true';
 }
SETS:  Coding Style

AlternativeIfToBracketRector

Change alternative if/elseif/else/endif syntax to bracket syntax

-if ($value) :
+if ($value) {
     $result = 1;
-else :
+} else {
     $result = 2;
-endif;
+}
SETS:  Coding Style

MakeInheritedMethodVisibilitySameAsParentRector

Make method visibility same as parent one

 class ChildClass extends ParentClass
 {
-    public function run()
+    protected function run()
     {
     }
 }

 class ParentClass
 {
     protected function run()
     {
     }
 }
SETS:  Coding Style

NewlineBeforeNewAssignSetRector

Add extra space before new assign set

 final class SomeClass
 {
     public function run()
     {
         $value = new Value;
         $value->setValue(5);
+
         $value2 = new Value;
         $value2->setValue(1);
+
         $foo = new Value;
         $foo->bar = 5;
+
         $bar = new Value;
         $bar->foo = 1;
     }
 }
SETS:  Coding Style

FuncGetArgsToVariadicParamRector

Refactor func_get_args() in to a variadic param

-function run()
+function run(...$args)
 {
-    $args = \func_get_args();
 }
SETS:  Coding Style

SeparateMultiUseImportsRector

Split multi use imports and trait statements to standalone lines

-use A, B;
+use A;
+use B;

 class SomeClass
 {
-    use SomeTrait, AnotherTrait;
+    use SomeTrait;
+    use AnotherTrait;
 }
SETS:  Coding Style

Configurable

StringClassNameToClassConstantRector

Replace string class names by ::class constant

 class AnotherClass
 {
 }

 class SomeClass
 {
     public function run()
     {
-        return 'AnotherClass';
+        return \AnotherClass::class;
     }
 }

CompleteMissingIfElseBracketRector

Complete missing if/else brackets

 class SomeClass
 {
     public function run($value)
     {
-        if ($value)
+        if ($value) {
             return 1;
+        }
     }
 }
SETS:  Coding Style