$expected->
addConstraint(new Callback(['callback' => 'validateMe', 'payload' => 'foo'
]));
$expected->
addConstraint(new Callback('validateMeStatic'
));
$expected->
addPropertyConstraint('firstName',
new NotNull());
$expected->
addPropertyConstraint('firstName',
new Range(['min' => 3
]));
$expected->
addPropertyConstraint('firstName',
new All([new NotNull(),
new Range(['min' => 3
])]));
$expected->
addPropertyConstraint('firstName',
new All(['constraints' =>
[new NotNull(),
new Range(['min' => 3
])]]));
$expected->
addPropertyConstraint('firstName',
new Collection([ 'foo' =>
[new NotNull(),
new Range(['min' => 3
])],
'bar' =>
new Range(['min' => 5
]),
'baz' =>
new Required([new Email()]),
'qux' =>
new Optional([new NotBlank()]),
], null, null, true
));
$expected->
addPropertyConstraint('firstName',
new Choice([ 'message' => 'Must be one of %choices%',
'choices' =>
['A', 'B'
],
]));
$expected->
addPropertyConstraint('firstName',
new AtLeastOneOf([ new NotNull(),
new Range(['min' => 3
]),
], null, null, 'foo', null, false
));
$expected->
addPropertyConstraint('firstName',
new Sequentially([ new NotBlank(),