Skip to content

Commit 842a8d6

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages
2 parents 1227b85 + ec1add5 commit 842a8d6

16 files changed

+19
-19
lines changed

Constraints/CallbackValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function validate($object, Constraint $constraint)
4646
$method($object, $this->context, $constraint->payload);
4747
} elseif (null !== $object) {
4848
if (!method_exists($object, $method)) {
49-
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s.', $method, \get_class($object)));
49+
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, \get_class($object)));
5050
}
5151

5252
$reflMethod = new \ReflectionMethod($object, $method);

Constraints/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function initializeNestedConstraints()
5757
parent::initializeNestedConstraints();
5858

5959
if (!\is_array($this->fields)) {
60-
throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s.', __CLASS__));
60+
throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint "%s".', __CLASS__));
6161
}
6262

6363
foreach ($this->fields as $fieldName => $field) {

Constraints/Composite.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ public function __construct($options = null)
7171
$constraint = \get_class($constraint);
7272
}
7373

74-
throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s.', $constraint, static::class));
74+
throw new ConstraintDefinitionException(sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, static::class));
7575
}
7676

7777
if ($constraint instanceof Valid) {
78-
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', static::class));
78+
throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', static::class));
7979
}
8080
}
8181

@@ -99,7 +99,7 @@ public function __construct($options = null)
9999
$excessGroups = array_diff($constraint->groups, $this->groups);
100100

101101
if (\count($excessGroups) > 0) {
102-
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s.', implode('", "', $excessGroups), \get_class($constraint), static::class));
102+
throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), \get_class($constraint), static::class));
103103
}
104104
} else {
105105
$constraint->groups = $this->groups;

Constraints/Count.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct($options = null)
5151
parent::__construct($options);
5252

5353
if (null === $this->min && null === $this->max) {
54-
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']);
54+
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint "%s".', __CLASS__), ['min', 'max']);
5555
}
5656
}
5757
}

Constraints/EmailValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function validate($value, Constraint $constraint)
7070
}
7171

7272
if (!\in_array($constraint->mode, Email::$validationModes, true)) {
73-
throw new \InvalidArgumentException(sprintf('The %s::$mode parameter value is not valid.', \get_class($constraint)));
73+
throw new \InvalidArgumentException(sprintf('The "%s::$mode" parameter value is not valid.', \get_class($constraint)));
7474
}
7575

7676
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {

Constraints/Length.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct($options = null)
5858
parent::__construct($options);
5959

6060
if (null === $this->min && null === $this->max) {
61-
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s.', __CLASS__), ['min', 'max']);
61+
throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint "%s".', __CLASS__), ['min', 'max']);
6262
}
6363

6464
if (null !== $this->normalizer && !\is_callable($this->normalizer)) {

Constraints/Range.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct($options = null)
6565
parent::__construct($options);
6666

6767
if (null === $this->min && null === $this->minPropertyPath && null === $this->max && null === $this->maxPropertyPath) {
68-
throw new MissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint %s.', __CLASS__), ['min', 'minPropertyPath', 'max', 'maxPropertyPath']);
68+
throw new MissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint "%s".', __CLASS__), ['min', 'minPropertyPath', 'max', 'maxPropertyPath']);
6969
}
7070
}
7171
}

Constraints/Traverse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Traverse extends Constraint
2626
public function __construct($options = null)
2727
{
2828
if (\is_array($options) && \array_key_exists('groups', $options)) {
29-
throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s.', __CLASS__));
29+
throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__));
3030
}
3131

3232
parent::__construct($options);

Mapping/Factory/LazyLoadingMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(LoaderInterface $loader = null, CacheItemPoolInterfa
7272
public function getMetadataFor($value)
7373
{
7474
if (!\is_object($value) && !\is_string($value)) {
75-
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s.', \gettype($value)));
75+
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value)));
7676
}
7777

7878
$class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\');

Mapping/GetterMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function __construct(string $class, string $property, string $method = nu
5353
} elseif (method_exists($class, $hasMethod)) {
5454
$method = $hasMethod;
5555
} else {
56-
throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s.', $class, $getMethod, $isMethod, $hasMethod));
56+
throw new ValidatorException(sprintf('Neither of these methods exist in class "%s": "%s", "%s", "%s".', $class, $getMethod, $isMethod, $hasMethod));
5757
}
5858
} elseif (!method_exists($class, $method)) {
59-
throw new ValidatorException(sprintf('The %s() method does not exist in class %s.', $method, $class));
59+
throw new ValidatorException(sprintf('The "%s()" method does not exist in class "%s".', $method, $class));
6060
}
6161

6262
parent::__construct($class, $method, $property);

0 commit comments

Comments
 (0)