Skip to content

Commit 4b98333

Browse files
Rootieweaverryan
authored andcommitted
Don't use deprecated functions in Callback.rst
The addViolationAt function is marked as deprecated and should be replaced by buildViolation according to the Symfony update guides.
1 parent f732747 commit 4b98333

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

reference/constraints/Callback.rst

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,9 @@ those errors should be attributed::
114114

115115
// check if the name is actually a fake name
116116
if (in_array($this->getFirstName(), $fakeNames)) {
117-
$context->addViolationAt(
118-
'firstName',
119-
'This name sounds totally fake!',
120-
array(),
121-
null
122-
);
117+
$context->buildViolation('This name sounds totally fake!')
118+
->atPath('firstName')
119+
->addViolation();
123120
}
124121
}
125122
}
@@ -137,12 +134,9 @@ have access to the object instance, they receive the object as the first argumen
137134

138135
// check if the name is actually a fake name
139136
if (in_array($object->getFirstName(), $fakeNames)) {
140-
$context->addViolationAt(
141-
'firstName',
142-
'This name sounds totally fake!',
143-
array(),
144-
null
145-
);
137+
$context->buildViolation('This name sounds totally fake!')
138+
->atPath('firstName')
139+
->addViolation();
146140
}
147141
}
148142

0 commit comments

Comments
 (0)