File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff 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-
6057Creating the Validator itself
6158-----------------------------
6259
You can’t perform that action at this time.
0 commit comments