Skip to content

[Validator] add new constraints Latitude and Longitude #61312

@zairigimad

Description

@zairigimad

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy