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

Found 5 rules:

ChildDoctrineRepositoryClassTypeRector

Add return type to classes that extend Doctrine\ORM\EntityRepository based on return Doctrine method names

 use Doctrine\ORM\EntityRepository;

 /**
  * @extends EntityRepository<SomeType>
  */
 final class SomeRepository extends EntityRepository
 {
-    public function getActiveItem()
+    public function getActiveItem(): ?SomeType
     {
         return $this->findOneBy([
             'something'
         ]);
     }
 }

CastDoctrineExprToStringRector

Casts Doctrine Expr\x to string where necessary.

 $statements->add(
     $builder->expr()->like(
-        $builder->expr()->lower($column),
-        $builder->expr()->lower($builder->expr()->literal('%'.$like.'%'))
+        (string) $builder->expr()->lower($column),
+        (string) $builder->expr()->lower($builder->expr()->literal('%'.$like.'%'))
     )
 );

Configurable

YamlToAttributeDoctrineMappingRector

Converts YAML Doctrine Entity mapping to particular annotation mapping

+use Doctrine\ORM\Mapping as ORM;
+
+#[ORM\Entity]
 class SomeEntity
 {
+    #[ORM\Id]
+    #[ORM\GeneratedValue]
+    #[ORM\Column(type: 'integer')]
     private $id;

+    #[ORM\Column(type: 'string')]
     private $name;
 }

Configurable

AddPropertyTypeDeclarationRector

Add type to property by added rules, mostly public/property by parent type

 class SomeClass extends ParentClass
 {
-    public $name;
+    public string $name;
 }

ValidationRuleArrayStringValueToArrayRector

Convert string validation rules into arrays for Laravel's Validator.

 Validator::make($data, [
-    'field' => 'required|nullable|string|max:255',
+    'field' => ['required', 'nullable', 'string', 'max:255'],
 ]);