Skip to content

Commit 0a91b41

Browse files
committed
Fix quotes in exception messages
1 parent dab46f5 commit 0a91b41

15 files changed

+18
-18
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
\call_user_func($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/Length.php

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

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

Constraints/Range.php

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

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

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);

Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function validate($value, Constraint $constraint)
9393
Url::CHECK_DNS_TYPE_SRV,
9494
Url::CHECK_DNS_TYPE_TXT,
9595
], true)) {
96-
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s.', \get_class($constraint)), ['checkDNS']);
96+
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint "%s".', \get_class($constraint)), ['checkDNS']);
9797
}
9898

9999
$host = parse_url($value, PHP_URL_HOST);

Mapping/Factory/LazyLoadingMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(LoaderInterface $loader = null, CacheInterface $cach
7979
public function getMetadataFor($value)
8080
{
8181
if (!\is_object($value) && !\is_string($value)) {
82-
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s.', \gettype($value)));
82+
throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value)));
8383
}
8484

8585
$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($class, $property, $method = null)
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)