Skip to content

Commit 0572f09

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Validator] Add a missing namespace and use [Validator] Use single quotes for a string
2 parents 88bde6b + f28bc9b commit 0572f09

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

validation.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ rules). In order to validate an object, simply map one or more constraints
298298
to its class and then pass it to the ``validator`` service.
299299

300300
Behind the scenes, a constraint is simply a PHP object that makes an assertive
301-
statement. In real life, a constraint could be: 'The cake must not be burned'.
301+
statement. In real life, a constraint could be: ``'The cake must not be burned'``.
302302
In Symfony, constraints are similar: they are assertions that a condition
303303
is true. Given a value, a constraint will tell you if that value
304304
adheres to the rules of the constraint.
@@ -342,7 +342,7 @@ literature genre mostly associated with the author, which can be set to either
342342
{
343343
/**
344344
* @Assert\Choice(
345-
* choices = { "fiction", "non-fiction" },
345+
* choices = {"fiction", "non-fiction"},
346346
* message = "Choose a valid genre."
347347
* )
348348
*/
@@ -509,7 +509,7 @@ of the form fields::
509509
$builder
510510
->add('myField', TextType::class, [
511511
'required' => true,
512-
'constraints' => [new Length(['min' => 3])]
512+
'constraints' => [new Length(['min' => 3])],
513513
])
514514
;
515515
}
@@ -606,7 +606,7 @@ class to have at least 3 characters.
606606
$metadata->addPropertyConstraint('firstName', new Assert\NotBlank());
607607
$metadata->addPropertyConstraint(
608608
'firstName',
609-
new Assert\Length(["min" => 3])
609+
new Assert\Length(['min' => 3])
610610
);
611611
}
612612
}

validation/custom_constraint.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ not to the property:
275275

276276
.. code-block:: php-annotations
277277
278+
// src/Entity/AcmeEntity.php
279+
namespace App\Entity;
280+
281+
use App\Validator as AcmeAssert;
282+
278283
/**
279284
* @AcmeAssert\ProtocolClass
280285
*/

0 commit comments

Comments
 (0)