From dfb57a547afc735a2f6f5c5d1e95ab6721b408cc Mon Sep 17 00:00:00 2001 From: Ninos Date: Tue, 7 Nov 2023 08:57:47 +0100 Subject: [PATCH 1/2] Updated: `Ip` & `Cidr` constraints documentation See also: https://github.com/symfony/symfony/pull/51777 --- README.md | 4 +-- reference/constraints/Cidr.rst | 8 ++---- reference/constraints/Ip.rst | 51 ++++++++++++++++++++++++++-------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 17b6ea8ac74..1e445279565 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ We love contributors! For more information on how you can contribute, please rea the [Symfony Docs Contributing Guide](https://symfony.com/doc/current/contributing/documentation/overview.html). > [!IMPORTANT] -> Use `5.4` branch as the base of your pull requests, unless you are documenting a -> feature that was introduced *after* Symfony 5.4 (e.g. in Symfony 6.3). +> Use `6.4` branch as the base of your pull requests, unless you are documenting a +> feature that was introduced *after* Symfony 6.4 (e.g. in Symfony 6.3). Build Documentation Locally --------------------------- diff --git a/reference/constraints/Cidr.rst b/reference/constraints/Cidr.rst index d7bc9e6b4a0..caf29fa7bbc 100644 --- a/reference/constraints/Cidr.rst +++ b/reference/constraints/Cidr.rst @@ -97,7 +97,7 @@ It's a constraint for the lowest value a valid netmask may have. **type**: ``string`` **default**: ``32`` for IPv4 or ``128`` for IPv6 -It's a constraint for the biggest value a valid netmask may have. +It's a constraint for the biggest value a valid netmask may have. The value will be overwritten to `32` if it is greater than `32` and a `V4` is validated. ``netmaskRangeViolationMessage`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -124,10 +124,6 @@ Parameter Description **type**: ``string`` **default**: ``all`` This determines exactly *how* the CIDR notation is validated and can take one -of these values: - -* ``4``: validates for CIDR notations that have an IPv4; -* ``6``: validates for CIDR notations that have an IPv6; -* ``all``: validates all CIDR formats. +of the values available for `Ip` constraint. .. _`CIDR`: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index 2f05f677601..39862115c7a 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -107,36 +107,63 @@ of a variety of different values: **All ranges** -``4`` +``4` (`Assert\Ip::V4`)` Validates for IPv4 addresses -``6`` +``6` (`Assert\Ip::V6`)` Validates for IPv6 addresses -``all`` +``all` (`Assert\Ip::ALL`)` Validates all IP formats +**No public ranges** + +``4_no_public` (`Assert\Ip::V4_NO_PUBLIC`)` + Validates for IPv4 but without public IP ranges +``6_no_public` (`Assert\Ip::V6_NO_PUBLIC`)` + Validates for IPv6 but without public IP ranges +``all_no_public` (`Assert\Ip::ALL_NO_PUBLIC`)` + Validates for all IP formats but without public IP ranges + **No private ranges** -``4_no_priv`` +``4_no_private` (`Assert\Ip::V4_NO_PRIVATE`)` Validates for IPv4 but without private IP ranges -``6_no_priv`` +``6_no_private` (`Assert\Ip::V6_NO_PRIVATE`)` Validates for IPv6 but without private IP ranges -``all_no_priv`` +``all_no_private` (`Assert\Ip::ALL_NO_PRIVATE`)` Validates for all IP formats but without private IP ranges **No reserved ranges** -``4_no_res`` +``4_no_reserved` (`Assert\Ip::V4_NO_RESERVED`)` Validates for IPv4 but without reserved IP ranges -``6_no_res`` +``6_no_reserved` (`Assert\Ip::V6_NO_RESERVED`)` Validates for IPv6 but without reserved IP ranges -``all_no_res`` +``all_no_reserved` (`Assert\Ip::ALL_NO_RESERVED`)` Validates for all IP formats but without reserved IP ranges **Only public ranges** -``4_public`` +``4_public` (`Assert\Ip::V4_ONLY_PUBLIC`)` Validates for IPv4 but without private and reserved ranges -``6_public`` +``6_public` (`Assert\Ip::V6_ONLY_PUBLIC`)` Validates for IPv6 but without private and reserved ranges -``all_public`` +``all_public` (`Assert\Ip::ALL_ONLY_PUBLIC`)` Validates for all IP formats but without private and reserved ranges + +**Only private ranges** + +``4_private` (`Assert\Ip::V4_ONLY_PRIVATE`)` + Validates for IPv4 but without public and reserved ranges +``6_private` (`Assert\Ip::V6_ONLY_PRIVATE`)` + Validates for IPv6 but without public and reserved ranges +``all_private` (`Assert\Ip::ALL_ONLY_PRIVATE`)` + Validates for all IP formats but without public and reserved ranges + +**Only reserved ranges** + +``4_reserved` (`Assert\Ip::V4_ONLY_RESERVED`)` + Validates for IPv4 but without public and private ranges +``6_reserved` (`Assert\Ip::V6_ONLY_RESERVED`)` + Validates for IPv6 but without public and private ranges +``all_reserved` (`Assert\Ip::ALL_ONLY_RESERVED`)` + Validates for all IP formats but without public and private ranges From c45991afc174dc843cdc5e460b9132986bcbbde1 Mon Sep 17 00:00:00 2001 From: Ninos Date: Tue, 7 Nov 2023 11:46:09 +0100 Subject: [PATCH 2/2] Updated: `Ip` & `Cidr` constraints documentation See also: https://github.com/symfony/symfony/pull/51777 --- reference/constraints/Cidr.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reference/constraints/Cidr.rst b/reference/constraints/Cidr.rst index caf29fa7bbc..33b0c172500 100644 --- a/reference/constraints/Cidr.rst +++ b/reference/constraints/Cidr.rst @@ -116,6 +116,8 @@ Parameter Description ``{{ max }}`` The maximum value a CIDR netmask may have =============== ============================================================== +.. include:: /reference/constraints/_normalizer-option.rst.inc + .. include:: /reference/constraints/_payload-option.rst.inc ``version``