ConstraintOptionsToNamedArgumentsRector

Refactor Symfony constraints using array options to named arguments syntax for better readability and type safety.

 use Symfony\Component\Validator\Constraints\NotBlank;

-$constraint = new NotBlank(['message' => 'This field should not be blank.']);
+$constraint = new NotBlank(message: 'This field should not be blank.');

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony73\Rector\Class_\ConstraintOptionsToNamedArgumentsRector;

return RectorConfig::configure()
    ->withRules([
        ConstraintOptionsToNamedArgumentsRector::class,
    ]);