Skip to content

Commit 2baf371

Browse files
committed
minor #16926 [Routing] Document the Requirement constants in routing.rst (nicwortel)
This PR was merged into the 6.1 branch. Discussion ---------- [Routing] Document the Requirement constants in routing.rst Fixes #16718 symfony/symfony#45528 by `@fancyweb` introduced the `Symfony\Component\Routing\Requirement\Requirement` enum in Symfony 6.1, as a solution for symfony/symfony#26524. It was blogged about in https://symfony.com/blog/new-in-symfony-6-1-improved-routing-requirements-and-utf-8-parameters, but I couldn't find it anywhere in the Routing documentation. This PR adds a small hint about the use of the `Requirement` enum for common route requirements: ![The Requirement enum contains a collection of commonly used regular-expression constants such as digits, dates and UUIDs which can be used as route parameter requirements.](https://user-images.githubusercontent.com/1055691/176497123-24b9bf6e-1b79-4385-baee-0eb132ae8944.png) I'm open for suggestions to further improve this. I decided to use a small info block instead without code examples, because it doesn't seem to be a big feature and I'm not sure how well it is supported across all configuration formats. Let me know if you would like to see some code examples. Commits ------- 571647d Document the Requirement constants in routing.rst
2 parents a711a6d + 571647d commit 2baf371

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,12 @@ URL Route Parameters
772772
``/blog/my-first-post`` ``blog_show`` ``$slug`` = ``my-first-post``
773773
======================== ============= ===============================
774774

775+
.. tip::
776+
777+
The :class:`Symfony\\Component\\Routing\\Requirement\\Requirement` enum
778+
contains a collection of commonly used regular-expression constants such as
779+
digits, dates and UUIDs which can be used as route parameter requirements.
780+
775781
.. tip::
776782

777783
Route requirements (and route paths too) can include

0 commit comments

Comments
 (0)