mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
b37d5cb932e524905f73366d0c4246a782f74a34
Assert\... when referring to assertions (mpdude)
This PR was merged into the 7.3 branch.
Discussion
----------
[Validator] Consistently use `Assert\...` when referring to assertions
I noticed a slight inconsistency in the docs when showing examples of using `Constraint` classes. In some examples, the class is `use`d and shown with the short class name. In other cases, the `Symfony\Component\Validator\Constraints` namespace is used as `Assert`, and references being made as `Assert\NotBlank` and similar.
Personally, I like the `Assert\` prefix, since it triggers the "ah, that's a constraint" wiring in my head, but I don't mind. Generally, I'd prefer consistency, since I noticed that this caused confusion in my team.
Additionally, this PR fixes a few places where we are still showing the use of array-based options instead of named arguments, a change that was made in 7.3.
Commits
-------
4b4161faa Consistently use `Assert\...` when referring to assertions
The official Symfony Documentation
Online version | Components | Screencasts
Contributing
We love contributors! For more information on how you can contribute, please read the Symfony Docs Contributing Guide.
Important
Use
6.4branch as the base of your pull requests, unless you are documenting a feature that was introduced after Symfony 6.4 (e.g. in Symfony 7.2).
Build Documentation Locally
This is not needed for contributing, but it's useful if you would like to debug some issue in the docs or if you want to read Symfony Documentation offline.
$ git clone git@github.com:symfony/symfony-docs.git
$ cd symfony-docs/
$ cd _build/
$ composer install
$ php build.php
After generating docs, serve them with the internal PHP server:
$ php -S localhost:8000 -t output/
Browse http://localhost:8000 to read the docs.
Description
⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-01-22T16:41:19.167Z
Languages
PHP
78%
HTML
11%
C++
9%
NASL
1.1%
Shell
0.9%