Skip to content

Commit a73d408

Browse files
committed
Fix code examples in PHPDoc
1 parent 131ae08 commit a73d408

File tree

2 files changed

+21
-43
lines changed

2 files changed

+21
-43
lines changed

ConstraintViolationInterface.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
* element in the validation graph and the root element that was originally
2020
* passed to the validator. For example, take the following graph:
2121
*
22-
* <pre>
23-
* (Person)---(firstName: string)
24-
* \
25-
* (address: Address)---(street: string)
26-
* </pre>
22+
* (Person)---(firstName: string)
23+
* \
24+
* (address: Address)---(street: string)
2725
*
2826
* If the <tt>Person</tt> object is validated and validation fails for the
2927
* "firstName" property, the generated violation has the <tt>Person</tt>

ExecutionContextInterface.php

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,17 @@
1616
*
1717
* For example, let's validate the following object graph:
1818
*
19-
* <pre>
20-
* (Person)---($firstName: string)
21-
* \
22-
* ($address: Address)---($street: string)
23-
* </pre>
19+
* (Person)---($firstName: string)
20+
* \
21+
* ($address: Address)---($street: string)
2422
*
2523
* We validate the <tt>Person</tt> instance, which becomes the "root" of the
2624
* validation run (see {@link getRoot}). The state of the context after the
2725
* first step will be like this:
2826
*
29-
* <pre>
30-
* (Person)---($firstName: string)
31-
* ^ \
32-
* ($address: Address)---($street: string)
33-
* </pre>
27+
* (Person)---($firstName: string)
28+
* ^ \
29+
* ($address: Address)---($street: string)
3430
*
3531
* The validator is stopped at the <tt>Person</tt> node, both the root and the
3632
* value (see {@link getValue}) of the context point to the <tt>Person</tt>
@@ -41,11 +37,9 @@
4137
* After advancing to the property <tt>$firstName</tt> of the <tt>Person</tt>
4238
* instance, the state of the context looks like this:
4339
*
44-
* <pre>
45-
* (Person)---($firstName: string)
46-
* \ ^
47-
* ($address: Address)---($street: string)
48-
* </pre>
40+
* (Person)---($firstName: string)
41+
* \ ^
42+
* ($address: Address)---($street: string)
4943
*
5044
* The validator is stopped at the property <tt>$firstName</tt>. The root still
5145
* points to the <tt>Person</tt> instance, because this is where the validation
@@ -56,12 +50,10 @@
5650
* <tt>$street</tt> property of the <tt>Address</tt> instance, the context state
5751
* looks like this:
5852
*
59-
* <pre>
60-
* (Person)---($firstName: string)
61-
* \
62-
* ($address: Address)---($street: string)
63-
* ^
64-
* </pre>
53+
* (Person)---($firstName: string)
54+
* \
55+
* ($address: Address)---($street: string)
56+
* ^
6557
*
6658
* The validator is stopped at the property <tt>$street</tt>. The root still
6759
* points to the <tt>Person</tt> instance, but the property path is now
@@ -128,19 +120,14 @@ public function addViolationAt($subPath, $message, array $parameters = array(),
128120
* argument which is appended to the current property path when a violation
129121
* is created. For example, take the following object graph:
130122
*
131-
* <pre>
132-
* (Person)---($address: Address)---($phoneNumber: PhoneNumber)
133-
* ^
134-
* </pre>
123+
* (Person)---($address: Address)---($phoneNumber: PhoneNumber)
135124
*
136125
* When the execution context stops at the <tt>Person</tt> instance, the
137126
* property path is "address". When you validate the <tt>PhoneNumber</tt>
138127
* instance now, pass "phoneNumber" as sub path to correct the property path
139128
* to "address.phoneNumber":
140129
*
141-
* <pre>
142-
* $context->validate($address->phoneNumber, 'phoneNumber');
143-
* </pre>
130+
* $context->validate($address->phoneNumber, 'phoneNumber');
144131
*
145132
* Any violations generated during the validation will be added to the
146133
* violation list that you can access with {@link getViolations}.
@@ -167,19 +154,14 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals
167154
* Use the parameter <tt>$subPath</tt> to adapt the property path for the
168155
* validated value. For example, take the following object graph:
169156
*
170-
* <pre>
171-
* (Person)---($address: Address)---($street: string)
172-
* ^
173-
* </pre>
157+
* (Person)---($address: Address)---($street: string)
174158
*
175159
* When the validator validates the <tt>Address</tt> instance, the
176160
* property path stored in the execution context is "address". When you
177161
* manually validate the property <tt>$street</tt> now, pass the sub path
178162
* "street" to adapt the full property path to "address.street":
179163
*
180-
* <pre>
181-
* $context->validate($address->street, new NotNull(), 'street');
182-
* </pre>
164+
* $context->validate($address->street, new NotNull(), 'street');
183165
*
184166
* @param mixed $value The value to validate
185167
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
@@ -290,9 +272,7 @@ public function getPropertyName();
290272
*
291273
* For example, take the following object graph:
292274
*
293-
* <pre>
294-
* (Person)---($address: Address)---($street: string)
295-
* </pre>
275+
* (Person)---($address: Address)---($street: string)
296276
*
297277
* When the <tt>Person</tt> instance is passed to the validator, the
298278
* property path is initially empty. When the <tt>$address</tt> property

0 commit comments

Comments
 (0)