Skip to content

Commit 15d0cc2

Browse files
committed
minor #7390 Unify placeholders in documentation and code (aivus)
This PR was merged into the 2.7 branch. Discussion ---------- Unify placeholders in documentation and code Update validation documentation to unify approach with placeholders. Constraints/Validators in code have `{{ value }}` placeholders, but documentation `%value%`. It could confuse. I propose to update documentation to use `{{ value }}` placeholders Commits ------- 274ffc5 Unify placeholders in documentation and code
2 parents fa5fa31 + 274ffc5 commit 15d0cc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

validation/custom_constraint.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen
2424
*/
2525
class ContainsAlphanumeric extends Constraint
2626
{
27-
public $message = 'The string "%string%" contains an illegal character: it can only contain letters or numbers.';
27+
public $message = 'The string "{{ string }}" contains an illegal character: it can only contain letters or numbers.';
2828
}
2929

3030
.. note::
@@ -67,14 +67,14 @@ The validator class is also simple, and only has one required method ``validate(
6767
if (!preg_match('/^[a-zA-Z0-9]+$/', $value, $matches)) {
6868
// If you're using the new 2.5 validation API (you probably are!)
6969
$this->context->buildViolation($constraint->message)
70-
->setParameter('%string%', $value)
70+
->setParameter('{{ string }}', $value)
7171
->addViolation();
7272

7373
// If you're using the old 2.4 validation API
7474
/*
7575
$this->context->addViolation(
7676
$constraint->message,
77-
array('%string%' => $value)
77+
array('{{ string }}' => $value)
7878
);
7979
*/
8080
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy