-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Labels
Description
Description
When working with coordinates, it's common to validate their format using regular expressions. While this approach works well, we often end up duplicating the same regex across different parts of the codebase—whether for API validation, form validation, or elsewhere.
This leads to repetition. It would be much cleaner and more maintainable to have this logic centralized in a dedicated constraint class.
examples
class LongitudeDummy
{
#[Longitude]
private $a;
#[Longitude(message: 'myMessage')]
private $b;
#[Longitude(groups: ['my_group'])]
private $c;
}
class LatitudeDummy
{
#[Latitude]
private $a;
#[Latitude(message: 'myMessage')]
private $b;
#[Latitude(groups: ['my_group'])]
private $c;
}