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
Copy file name to clipboardExpand all lines: Constraint.php
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ public static function getErrorName(string $errorCode): string
82
82
}
83
83
84
84
if (!isset(static::$errorNames[$errorCode])) {
85
-
thrownewInvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
85
+
thrownewInvalidArgumentException(\sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
86
86
}
87
87
88
88
trigger_deprecation('symfony/validator', '6.1', 'The "%s::$errorNames" property is deprecated, use protected const ERROR_NAMES instead.', static::class);
@@ -144,7 +144,7 @@ protected function normalizeOptions(mixed $options): array
144
144
145
145
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
146
146
if (null === $defaultOption) {
147
-
thrownewConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
147
+
thrownewConstraintDefinitionException(\sprintf('No default option is configured for constraint "%s".', static::class));
148
148
}
149
149
150
150
$options[$defaultOption] = $options['value'];
@@ -165,7 +165,7 @@ protected function normalizeOptions(mixed $options): array
thrownewConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));
168
+
thrownewConstraintDefinitionException(\sprintf('No default option is configured for constraint "%s".', static::class));
169
169
}
170
170
171
171
if (\array_key_exists($defaultOption, $knownOptions)) {
@@ -177,11 +177,11 @@ protected function normalizeOptions(mixed $options): array
177
177
}
178
178
179
179
if (\count($invalidOptions) > 0) {
180
-
thrownewInvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
180
+
thrownewInvalidOptionsException(\sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions);
181
181
}
182
182
183
183
if (\count($missingOptions) > 0) {
184
-
thrownewMissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
184
+
thrownewMissingOptionsException(\sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions));
185
185
}
186
186
187
187
return$normalizedOptions;
@@ -206,7 +206,7 @@ public function __set(string $option, mixed $value)
206
206
return;
207
207
}
208
208
209
-
thrownewInvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
209
+
thrownewInvalidOptionsException(\sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
210
210
}
211
211
212
212
/**
@@ -226,7 +226,7 @@ public function __get(string $option): mixed
226
226
return$this->groups;
227
227
}
228
228
229
-
thrownewInvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
229
+
thrownewInvalidOptionsException(\sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]);
230
230
}
231
231
232
232
publicfunction__isset(string$option): bool
@@ -242,7 +242,7 @@ public function __isset(string $option): bool
242
242
publicfunctionaddImplicitGroupName(string$group)
243
243
{
244
244
if (null === $this->groups && \array_key_exists('groups', (array) $this)) {
245
-
thrownew \LogicException(sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
245
+
thrownew \LogicException(\sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
246
246
}
247
247
248
248
if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) {
if (null === $this->value && null === $this->propertyPath) {
45
-
thrownewConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
45
+
thrownewConstraintDefinitionException(\sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class));
46
46
}
47
47
48
48
if (null !== $this->value && null !== $this->propertyPath) {
49
-
thrownewConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class));
49
+
thrownewConstraintDefinitionException(\sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class));
50
50
}
51
51
52
52
if (null !== $this->propertyPath && !class_exists(PropertyAccess::class)) {
53
-
thrownewLogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option. Try running "composer require symfony/property-access".', static::class));
53
+
thrownewLogicException(\sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option. Try running "composer require symfony/property-access".', static::class));
@@ -71,7 +71,7 @@ public function validate(mixed $value, Constraint $constraint)
71
71
try {
72
72
$comparedValue = new$value($comparedValue);
73
73
} catch (\Exception) {
74
-
thrownewConstraintDefinitionException(sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, get_debug_type($value), get_debug_type($constraint)));
74
+
thrownewConstraintDefinitionException(\sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, get_debug_type($value), get_debug_type($constraint)));
Copy file name to clipboardExpand all lines: Constraints/Bic.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ public function __construct(?array $options = null, ?string $message = null, ?st
69
69
}
70
70
71
71
if (null !== $this->ibanPropertyPath && !class_exists(PropertyAccess::class)) {
72
-
thrownewLogicException(sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option. Try running "composer require symfony/property-access".', self::class));
72
+
thrownewLogicException(\sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option. Try running "composer require symfony/property-access".', self::class));
thrownewConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, get_debug_type($object)));
49
+
thrownewConstraintDefinitionException(\sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, get_debug_type($object)));
50
50
}
51
51
52
52
$reflMethod = new \ReflectionMethod($object, $method);
Copy file name to clipboardExpand all lines: Constraints/ChoiceValidator.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -56,8 +56,8 @@ public function validate(mixed $value, Constraint $constraint)
56
56
thrownewConstraintDefinitionException('The Choice constraint expects a valid callback.');
57
57
}
58
58
$choices = $choices();
59
-
if (!is_array($choices)) {
60
-
thrownewConstraintDefinitionException(sprintf('The Choice constraint callback "%s" is expected to return an array, but returned "%s".', trim($this->formatValue($constraint->callback), '"'), get_debug_type($choices)));
59
+
if (!\is_array($choices)) {
60
+
thrownewConstraintDefinitionException(\sprintf('The Choice constraint callback "%s" is expected to return an array, but returned "%s".', trim($this->formatValue($constraint->callback), '"'), get_debug_type($choices)));
0 commit comments