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

 <?php
 
 use Symfony\Component\Validator\Constraints as Assert;
 
 class Model
 {
-    /**
-     * @Assert\Type("string")
-     */
+    #[Assert\Type('string')]
     protected string $str;    
     
-    /**
-     * @Assert\All({
-     *   @Assert\Type("string")
-     * })
-     */
+    #[Assert\All([new Assert\Type('string')])]
     protected array $items;
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: bacfbf - released at 2025-06-13 13:38