https://g.co/gemini/share/fd46586c1688


This constraint compares using !=, so 3 and "3" are considered equal. Use NotIdenticalTo to compare with !==.


// src/Entity/Person.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Person
{
    #[Assert\NotEqualTo('Mary')]
    protected string $firstName;

    #[Assert\NotEqualTo(
        value: 15,
    )]
    protected int $age;
}

Powered by Froala Editor