Add type to constants based on their value
final class SomeClass
{
- public const TYPE = 'some_type';
+ public const string TYPE = 'some_type';
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
return RectorConfig::configure()
->withRules([
AddTypeToConstRector::class,
]);