Run Rector on your code to see what it can do for you:

 {
     public function run(bool $param)
     {
-        $constraints = new Assert\Collection([
-            'example1' => [new Assert\NotBlank(), new Assert\Type('string')],
-            'example2' => [new Assert\Type('string')],
-            'example3' => [new Assert\NotBlank(), new Assert\Type('string')],
-            'example4' => [new Assert\NotBlank(), new Assert\Type('string')],
-        ], allowExtraFields: false);
+        $constraints = new Assert\Collection(example1: [new Assert\NotBlank(), new Assert\Type('string')], example2: [new Assert\Type('string')], example3: [new Assert\NotBlank(), new Assert\Type('string')], example4: [new Assert\NotBlank(), new Assert\Type('string')]);
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 2.4.2 - released at 2026-04-16 14:00