Skip to content

Commit 56e5236

Browse files
committed
Add missing dots at the end of exception messages
1 parent 8ed6312 commit 56e5236

23 files changed

+38
-38
lines changed

Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function validate($value, Constraint $constraint)
5555
try {
5656
$comparedValue = $this->getPropertyAccessor()->getValue($object, $path);
5757
} catch (NoSuchPropertyException $e) {
58-
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s', $path, \get_class($constraint), $e->getMessage()), 0, $e);
58+
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: %s.', $path, \get_class($constraint), $e->getMessage()), 0, $e);
5959
}
6060
} else {
6161
$comparedValue = $constraint->value;

Constraints/CallbackValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public function validate($object, Constraint $constraint)
4040
if (isset($method[0]) && \is_object($method[0])) {
4141
$method[0] = \get_class($method[0]);
4242
}
43-
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
43+
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable.', json_encode($method)));
4444
}
4545

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/ChoiceValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function validate($value, Constraint $constraint)
3535
}
3636

3737
if (!\is_array($constraint->choices) && !$constraint->callback) {
38-
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice');
38+
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice.');
3939
}
4040

4141
if (null === $value) {
@@ -51,7 +51,7 @@ public function validate($value, Constraint $constraint)
5151
&& !\is_callable($choices = [$this->context->getClassName(), $constraint->callback])
5252
&& !\is_callable($choices = $constraint->callback)
5353
) {
54-
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback');
54+
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback.');
5555
}
5656
$choices = \call_user_func($choices);
5757
} else {

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ 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) {
@@ -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
@@ -58,7 +58,7 @@ public function validate($value, Constraint $constraint)
5858

5959
if ($constraint->strict) {
6060
if (!class_exists('\Egulias\EmailValidator\EmailValidator')) {
61-
throw new RuntimeException('Strict email validation requires egulias/email-validator ~1.2|~2.0');
61+
throw new RuntimeException('Strict email validation requires egulias/email-validator ~1.2|~2.0.');
6262
}
6363

6464
$strictValidator = new \Egulias\EmailValidator\EmailValidator();

Constraints/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function normalizeBinaryFormat($maxSize)
114114
$this->maxSize = $matches[1] * $factors[$unit = strtolower($matches[2])];
115115
$this->binaryFormat = null === $this->binaryFormat ? 2 === \strlen($unit) : $this->binaryFormat;
116116
} else {
117-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));
117+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $this->maxSize));
118118
}
119119
}
120120
}

Constraints/ImageValidator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function validate($value, Constraint $constraint)
100100

101101
if ($constraint->minHeight) {
102102
if (!ctype_digit((string) $constraint->minHeight)) {
103-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height', $constraint->minHeight));
103+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height.', $constraint->minHeight));
104104
}
105105

106106
if ($height < $constraint->minHeight) {
@@ -116,7 +116,7 @@ public function validate($value, Constraint $constraint)
116116

117117
if ($constraint->maxHeight) {
118118
if (!ctype_digit((string) $constraint->maxHeight)) {
119-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height', $constraint->maxHeight));
119+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight));
120120
}
121121

122122
if ($height > $constraint->maxHeight) {
@@ -132,7 +132,7 @@ public function validate($value, Constraint $constraint)
132132

133133
if (null !== $constraint->minPixels) {
134134
if (!ctype_digit((string) $constraint->minPixels)) {
135-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels', $constraint->minPixels));
135+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels));
136136
}
137137

138138
if ($pixels < $constraint->minPixels) {
@@ -148,7 +148,7 @@ public function validate($value, Constraint $constraint)
148148

149149
if (null !== $constraint->maxPixels) {
150150
if (!ctype_digit((string) $constraint->maxPixels)) {
151-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels', $constraint->maxPixels));
151+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels));
152152
}
153153

154154
if ($pixels > $constraint->maxPixels) {
@@ -166,7 +166,7 @@ public function validate($value, Constraint $constraint)
166166

167167
if (null !== $constraint->minRatio) {
168168
if (!is_numeric((string) $constraint->minRatio)) {
169-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio', $constraint->minRatio));
169+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio.', $constraint->minRatio));
170170
}
171171

172172
if ($ratio < $constraint->minRatio) {
@@ -180,7 +180,7 @@ public function validate($value, Constraint $constraint)
180180

181181
if (null !== $constraint->maxRatio) {
182182
if (!is_numeric((string) $constraint->maxRatio)) {
183-
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio', $constraint->maxRatio));
183+
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio.', $constraint->maxRatio));
184184
}
185185

186186
if ($ratio > $constraint->maxRatio) {
@@ -218,7 +218,7 @@ public function validate($value, Constraint $constraint)
218218

219219
if ($constraint->detectCorrupted) {
220220
if (!\function_exists('imagecreatefromstring')) {
221-
throw new RuntimeException('Corrupted images detection requires installed and enabled GD extension');
221+
throw new RuntimeException('Corrupted images detection requires installed and enabled GD extension.');
222222
}
223223

224224
$resource = @imagecreatefromstring(file_get_contents($value));

Constraints/Ip.php

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

8282
if (!\in_array($this->version, self::$versions)) {
83-
throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s"', implode('", "', self::$versions)));
83+
throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s".', implode('", "', self::$versions)));
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)