Skip to content

Commit

Permalink
Add missing dots at the end of exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 15, 2020
1 parent f8b9983 commit a1162d3
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Encoder/XmlEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null)
return $this->appendNode($parentNode, $data, 'data');
}

throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Mapping/Factory/ClassResolverTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private function getClass($value)
}

if (!\is_object($value)) {
throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s"', \gettype($value)));
throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value)));
}

return \get_class($value);
Expand Down
4 changes: 2 additions & 2 deletions Mapping/Loader/FileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ abstract class FileLoader implements LoaderInterface
public function __construct($file)
{
if (!is_file($file)) {
throw new MappingException(sprintf('The mapping file %s does not exist', $file));
throw new MappingException(sprintf('The mapping file %s does not exist.', $file));
}

if (!is_readable($file)) {
throw new MappingException(sprintf('The mapping file %s is not readable', $file));
throw new MappingException(sprintf('The mapping file %s is not readable.', $file));
}

$this->file = $file;
Expand Down
2 changes: 1 addition & 1 deletion Mapping/Loader/LoaderChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(array $loaders)
{
foreach ($loaders as $loader) {
if (!$loader instanceof LoaderInterface) {
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', \get_class($loader)));
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface.', \get_class($loader)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions Normalizer/AbstractNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected function handleCircularReference($object)
return \call_user_func($this->circularReferenceHandler, $object);
}

throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', \get_class($object), $this->circularReferenceLimit));
throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d).', \get_class($object), $this->circularReferenceLimit));
}

/**
Expand Down Expand Up @@ -388,7 +388,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
try {
if (null !== $parameter->getClass()) {
if (!$this->serializer instanceof DenormalizerInterface) {
throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $parameter->getClass(), static::class));
throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer.', $parameter->getClass(), static::class));
}
$parameterClass = $parameter->getClass()->getName();

Expand Down
4 changes: 2 additions & 2 deletions Normalizer/AbstractObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function normalize($object, $format = null, array $context = [])

foreach ($stack as $attribute => $attributeValue) {
if (!$this->serializer instanceof NormalizerInterface) {
throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer', $attribute));
throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer.', $attribute));
}

$data = $this->updateData($data, $attribute, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attribute, $format)));
Expand Down Expand Up @@ -268,7 +268,7 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma

if (Type::BUILTIN_TYPE_OBJECT === $builtinType) {
if (!$this->serializer instanceof DenormalizerInterface) {
throw new LogicException(sprintf('Cannot denormalize attribute "%s" for class "%s" because injected serializer is not a denormalizer', $attribute, $class));
throw new LogicException(sprintf('Cannot denormalize attribute "%s" for class "%s" because injected serializer is not a denormalizer.', $attribute, $class));
}

$childContext = $this->createChildContext($context, $attribute, $format);
Expand Down
2 changes: 1 addition & 1 deletion Normalizer/DateTimeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function denormalize($data, $type, $format = null, array $context = [])

$dateTimeErrors = \DateTime::class === $type ? \DateTime::getLastErrors() : \DateTimeImmutable::getLastErrors();

throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors:'."\n".'%s', $data, $dateTimeFormat, $dateTimeErrors['error_count'], implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors']))));
throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors:.'."\n".'%s', $data, $dateTimeFormat, $dateTimeErrors['error_count'], implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors']))));
}

try {
Expand Down
2 changes: 1 addition & 1 deletion Normalizer/JsonSerializableNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function normalize($object, $format = null, array $context = [])
}

if (!$this->serializer instanceof NormalizerInterface) {
throw new LogicException('Cannot normalize object because injected serializer is not a normalizer');
throw new LogicException('Cannot normalize object because injected serializer is not a normalizer.');
}

return $this->serializer->normalize($object->jsonSerialize(), $format, $context);
Expand Down
6 changes: 3 additions & 3 deletions Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function __construct(array $normalizers = [], array $encoders = [])
final public function serialize($data, $format, array $context = [])
{
if (!$this->supportsEncoding($format, $context)) {
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format));
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format));
}

if ($this->encoder->needsNormalization($format, $context)) {
Expand All @@ -125,7 +125,7 @@ final public function serialize($data, $format, array $context = [])
final public function deserialize($data, $type, $format, array $context = [])
{
if (!$this->supportsDecoding($format, $context)) {
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format));
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported.', $format));
}

$data = $this->decode($data, $format, $context);
Expand Down Expand Up @@ -164,7 +164,7 @@ public function normalize($data, $format = null, array $context = [])
throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data)));
}

throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
throw new NotNormalizableValueException(sprintf('An unexpected value could not be normalized: %s.', !\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
}

/**
Expand Down

0 comments on commit a1162d3

Please sign in to comment.