Skip to content

Commit 9c98fd3

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Add missing dots at the end of exception messages
2 parents bc76d24 + a1162d3 commit 9c98fd3

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

Encoder/XmlEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ private function buildXml(\DOMNode $parentNode, $data, string $xmlRootNodeName =
473473
return $this->appendNode($parentNode, $data, 'data');
474474
}
475475

476-
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))));
476+
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))));
477477
}
478478

479479
/**

Mapping/Factory/ClassResolverTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function getClass($value): string
4040
}
4141

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

4646
return \get_class($value);

Mapping/Loader/FileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ abstract class FileLoader implements LoaderInterface
3030
public function __construct(string $file)
3131
{
3232
if (!is_file($file)) {
33-
throw new MappingException(sprintf('The mapping file %s does not exist', $file));
33+
throw new MappingException(sprintf('The mapping file %s does not exist.', $file));
3434
}
3535

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

4040
$this->file = $file;

Mapping/Loader/LoaderChain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(array $loaders)
4040
{
4141
foreach ($loaders as $loader) {
4242
if (!$loader instanceof LoaderInterface) {
43-
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', \get_class($loader)));
43+
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface.', \get_class($loader)));
4444
}
4545
}
4646

Normalizer/AbstractNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ protected function handleCircularReference($object/*, string $format = null, arr
327327
return $circularReferenceHandler($object, $format, $context);
328328
}
329329

330-
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));
330+
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));
331331
}
332332

333333
/**
@@ -524,7 +524,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
524524
try {
525525
if (null !== $parameter->getClass()) {
526526
if (!$this->serializer instanceof DenormalizerInterface) {
527-
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(), self::class));
527+
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(), self::class));
528528
}
529529
$parameterClass = $parameter->getClass()->getName();
530530
$parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName, $format));

Normalizer/AbstractObjectNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function normalize($object, $format = null, array $context = [])
202202

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

208208
$data = $this->updateData($data, $attribute, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attribute, $format)), $class, $format, $context);
@@ -446,7 +446,7 @@ private function validateAndDenormalize(string $currentClass, string $attribute,
446446

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

452452
$childContext = $this->createChildContext($context, $attribute, $format);

Normalizer/DateTimeNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
106106

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

109-
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']))));
109+
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']))));
110110
}
111111

112112
try {

Normalizer/JsonSerializableNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function normalize($object, $format = null, array $context = [])
3535
}
3636

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

4141
return $this->serializer->normalize($object->jsonSerialize(), $format, $context);

Serializer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function __construct(array $normalizers = [], array $encoders = [])
118118
final public function serialize($data, $format, array $context = []): string
119119
{
120120
if (!$this->supportsEncoding($format, $context)) {
121-
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format));
121+
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format));
122122
}
123123

124124
if ($this->encoder->needsNormalization($format, $context)) {
@@ -134,7 +134,7 @@ final public function serialize($data, $format, array $context = []): string
134134
final public function deserialize($data, $type, $format, array $context = [])
135135
{
136136
if (!$this->supportsDecoding($format, $context)) {
137-
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format));
137+
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported.', $format));
138138
}
139139

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

176-
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))));
176+
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))));
177177
}
178178

179179
/**

0 commit comments

Comments
 (0)