You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 3.4:
[DI] configure inlined services before injecting them when dumping the container
Consistently throw exceptions on a single line
fix fopen calls
Update .editorconfig
Copy file name to clipboardExpand all lines: Constraint.php
+4-16Lines changed: 4 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -70,11 +70,7 @@ abstract class Constraint
70
70
publicstaticfunctiongetErrorName($errorCode)
71
71
{
72
72
if (!isset(static::$errorNames[$errorCode])) {
73
-
thrownewInvalidArgumentException(sprintf(
74
-
'The error code "%s" does not exist for constraint of type "%s".',
75
-
$errorCode,
76
-
\get_called_class()
77
-
));
73
+
thrownewInvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class()));
78
74
}
79
75
80
76
returnstatic::$errorNames[$errorCode];
@@ -137,9 +133,7 @@ public function __construct($options = null)
137
133
$option = $this->getDefaultOption();
138
134
139
135
if (null === $option) {
140
-
thrownewConstraintDefinitionException(
141
-
sprintf('No default option is configured for constraint %s', \get_class($this))
142
-
);
136
+
thrownewConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this)));
143
137
}
144
138
145
139
if (array_key_exists($option, $knownOptions)) {
@@ -151,17 +145,11 @@ public function __construct($options = null)
151
145
}
152
146
153
147
if (\count($invalidOptions) > 0) {
154
-
thrownewInvalidOptionsException(
155
-
sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)),
156
-
$invalidOptions
157
-
);
148
+
thrownewInvalidOptionsException(sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions);
158
149
}
159
150
160
151
if (\count($missingOptions) > 0) {
161
-
thrownewMissingOptionsException(
162
-
sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)),
163
-
array_keys($missingOptions)
164
-
);
152
+
thrownewMissingOptionsException(sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions));
'should also be passed to its containing constraint %s',
105
-
implode('", "', $excessGroups),
106
-
\get_class($constraint),
107
-
\get_class($this)
108
-
));
102
+
thrownewConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this)));
thrownewConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', \get_class($constraint)));
130
126
}
131
127
132
128
if ($constraintinstanceof Valid && null === $constraint->groups) {
@@ -597,11 +573,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m
597
573
598
574
// If TRAVERSE, fail if we have no Traversable
599
575
if (!$objectinstanceof \Traversable) {
600
-
thrownewConstraintDefinitionException(sprintf(
601
-
'Traversal was enabled for "%s", but this class '.
602
-
'does not implement "\Traversable".',
603
-
\get_class($object)
604
-
));
576
+
thrownewConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', \get_class($object)));
0 commit comments