IdenticalTo example

return [
            ['symfony', [
                new Length(['min' => 10]),
                new EqualTo(['value' => 'symfony']),
            ]],
            [150, [
                new Range(['min' => 10, 'max' => 20]),
                new GreaterThanOrEqual(['value' => 100]),
            ]],
            [7, [
                new LessThan(['value' => 5]),
                new IdenticalTo(['value' => 7]),
            ]],
            [-3, [
                new DivisibleBy(['value' => 4]),
                new Negative(),
            ]],
            ['FOO', [
                new Choice(['choices' => ['bar', 'BAR']]),
                new Regex(['pattern' => '/foo/i']),
            ]],
            ['fr', [
                new Country(),
                

class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase
{
    protected function createValidator(): IdenticalToValidator
    {
        return new IdenticalToValidator();
    }

    protected static function createConstraint(array $options = null): Constraint
    {
        return new IdenticalTo($options);
    }

    protected function getErrorCode(): ?string
    {
        return IdenticalTo::NOT_IDENTICAL_ERROR;
    }

    public static function provideAllValidComparisons(): array
    {
        $timezone = date_default_timezone_get();
        date_default_timezone_set('UTC');

        
Home | Imprint | This part of the site doesn't use cookies.