Skip to content

Commit

Permalink
Fix quotes in exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 16, 2020
1 parent 90ce15b commit 8eb8f3b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Extension/Core/DataTransformer/BaseDateTimeTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public function __construct($inputTimezone = null, $outputTimezone = null)
try {
new \DateTimeZone($this->inputTimezone);
} catch (\Exception $e) {
throw new InvalidArgumentException(sprintf('Input timezone is invalid: %s.', $this->inputTimezone), $e->getCode(), $e);
throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
}

try {
new \DateTimeZone($this->outputTimezone);
} catch (\Exception $e) {
throw new InvalidArgumentException(sprintf('Output timezone is invalid: %s.', $this->outputTimezone), $e->getCode(), $e);
throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
}
}
}
2 changes: 1 addition & 1 deletion Extension/Core/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function configureOptions(OptionsResolver $resolver)

// Set by the user
if (true !== $choicesAsValues) {
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));
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));
}

@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);
Expand Down
8 changes: 4 additions & 4 deletions Extension/Validator/ViolationMapper/ViolationPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function getElements()
public function getElement($index)
{
if (!isset($this->elements[$index])) {
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
}

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

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

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

return $this->mapsForm[$index];
Expand Down
8 changes: 4 additions & 4 deletions Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ private function modelToNorm($value)
$value = $transformer->transform($value);
}
} catch (TransformationFailedException $exception) {
throw new TransformationFailedException('Unable to transform data for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception);
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception);
}

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

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

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

return $value;
Expand Down
2 changes: 1 addition & 1 deletion Test/Traits/ValidatorExtensionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function getValidatorExtension()
}

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

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

0 comments on commit 8eb8f3b

Please sign in to comment.