ChoiceListToChoicesNamedArgumentRector
Pass list of choices to the Choice constraint via "choices" named argument instead of the first argument
use Symfony\Component\Validator\Constraints\Choice;
-$constraint = new Choice(['draft', 'published']);
+$constraint = new Choice(choices: ['draft', 'published']);
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony80\Rector\New_\ChoiceListToChoicesNamedArgumentRector;
return RectorConfig::configure()
->withRules([
ChoiceListToChoicesNamedArgumentRector::class,
]);
PACKAGE:
symfony/validator >=7.4