Closed
Description
Currently, the basic examples of constraints like GreaterThan don't use the short version for default options:
class Person
{
/**
* @Assert\GreaterThan(
* value = 18
* )
*/
protected $age;
}
The proper (short) way of writing this would be:
class Person
{
/**
* @Assert\GreaterThan(18)
*/
protected $age;
}
I think the "Basic Usage" examples should be fixed in this direction. In addition, a new section "Message Customization" should be added that shows how to write the constraint when customizing the message:
class Person
{
/**
* @Assert\GreaterThan(
* value = 18,
* message = "Restricted to persons older than 18 years."
* )
*/
protected $age;
}
The above applies for all configuration styles (annotations, PHP, XML and YAML).