Configurable

AttributeKeyToClassConstFetchRector

Replace key value on specific attribute to class constant

 use Doctrine\ORM\Mapping\Column;
+use Doctrine\DBAL\Types\Types;

 class SomeClass
 {
-    #[Column(type: "string")]
+    #[Column(type: Types::STRING)]
     public $name;
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
use Rector\Transform\ValueObject\AttributeKeyToClassConstFetch;

return RectorConfig::configure()
    ->withConfiguredRule(AttributeKeyToClassConstFetchRector::class, [
        new AttributeKeyToClassConstFetch('Doctrine\ORM\Mapping\Column', 'type', 'Doctrine\DBAL\Types\Types', [
        'string' => 'STRING',
    ]),
    ]);
SETS:  Code Quality