Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2aa0e2e

Browse filesBrowse files
committed
Merge branch '5.2' into 5.x
* 5.2: Minor reword [Validator] Add PHP Attribute as an annotation option in the description
2 parents ba4f403 + 8a614eb commit 2aa0e2e
Copy full SHA for 2aa0e2e

File tree

1 file changed

+4
-7
lines changed
Filter options

1 file changed

+4
-7
lines changed

‎validation/custom_constraint.rst

Copy file name to clipboardExpand all lines: validation/custom_constraint.rst
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,16 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen
4444
public $message = 'The string "{{ string }}" contains an illegal character: it can only contain letters or numbers.';
4545
}
4646
47+
Add ``@Annotation`` or ``#[\Attribute]`` to the constraint class if you want to
48+
use it as an annotation/attribute in other classes. If the constraint has
49+
configuration options, define them as public properties on the constraint class.
50+
4751
.. versionadded:: 5.2
4852

4953
The ability to use PHP attributes to configure constraints was introduced in
5054
Symfony 5.2. Prior to this, Doctrine Annotations were the only way to
5155
annotate constraints.
5256

53-
.. note::
54-
55-
The ``@Annotation`` annotation is necessary for this new constraint in
56-
order to make it available for use in classes via annotations.
57-
Options for your constraint are represented as public properties on the
58-
constraint class.
59-
6057
Creating the Validator itself
6158
-----------------------------
6259

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.