Skip to content

Commit 8eb8f3b

Browse files
committed
Fix quotes in exception messages
1 parent 90ce15b commit 8eb8f3b

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

Extension/Core/DataTransformer/BaseDateTimeTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public function __construct($inputTimezone = null, $outputTimezone = null)
5353
try {
5454
new \DateTimeZone($this->inputTimezone);
5555
} catch (\Exception $e) {
56-
throw new InvalidArgumentException(sprintf('Input timezone is invalid: %s.', $this->inputTimezone), $e->getCode(), $e);
56+
throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
5757
}
5858

5959
try {
6060
new \DateTimeZone($this->outputTimezone);
6161
} catch (\Exception $e) {
62-
throw new InvalidArgumentException(sprintf('Output timezone is invalid: %s.', $this->outputTimezone), $e->getCode(), $e);
62+
throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
6363
}
6464
}
6565
}

Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function configureOptions(OptionsResolver $resolver)
273273

274274
// Set by the user
275275
if (true !== $choicesAsValues) {
276-
throw new \RuntimeException(sprintf('The "choices_as_values" option of the %s should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
276+
throw new \RuntimeException(sprintf('The "choices_as_values" option of the "%s" should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
277277
}
278278

279279
@trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED);

Extension/Validator/ViolationMapper/ViolationPath.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function getElements()
163163
public function getElement($index)
164164
{
165165
if (!isset($this->elements[$index])) {
166-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
166+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
167167
}
168168

169169
return $this->elements[$index];
@@ -175,7 +175,7 @@ public function getElement($index)
175175
public function isProperty($index)
176176
{
177177
if (!isset($this->isIndex[$index])) {
178-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
178+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
179179
}
180180

181181
return !$this->isIndex[$index];
@@ -187,7 +187,7 @@ public function isProperty($index)
187187
public function isIndex($index)
188188
{
189189
if (!isset($this->isIndex[$index])) {
190-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
190+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
191191
}
192192

193193
return $this->isIndex[$index];
@@ -212,7 +212,7 @@ public function isIndex($index)
212212
public function mapsForm($index)
213213
{
214214
if (!isset($this->mapsForm[$index])) {
215-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
215+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
216216
}
217217

218218
return $this->mapsForm[$index];

Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ private function modelToNorm($value)
10311031
$value = $transformer->transform($value);
10321032
}
10331033
} catch (TransformationFailedException $exception) {
1034-
throw new TransformationFailedException('Unable to transform data for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
1034+
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
10351035
}
10361036

10371037
return $value;
@@ -1055,7 +1055,7 @@ private function normToModel($value)
10551055
$value = $transformers[$i]->reverseTransform($value);
10561056
}
10571057
} catch (TransformationFailedException $exception) {
1058-
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
1058+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
10591059
}
10601060

10611061
return $value;
@@ -1086,7 +1086,7 @@ private function normToView($value)
10861086
$value = $transformer->transform($value);
10871087
}
10881088
} catch (TransformationFailedException $exception) {
1089-
throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
1089+
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
10901090
}
10911091

10921092
return $value;
@@ -1112,7 +1112,7 @@ private function viewToNorm($value)
11121112
$value = $transformers[$i]->reverseTransform($value);
11131113
}
11141114
} catch (TransformationFailedException $exception) {
1115-
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
1115+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
11161116
}
11171117

11181118
return $value;

Test/Traits/ValidatorExtensionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function getValidatorExtension()
3434
}
3535

3636
if (!$this instanceof TypeTestCase) {
37-
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends %s.', TypeTestCase::class));
37+
throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends "%s".', TypeTestCase::class));
3838
}
3939

4040
$this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();

0 commit comments

Comments
 (0)