Skip to content

Commit eb9e406

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Add missing dots at the end of exception messages [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict) Fix bad merge Add missing dots at the end of exception messages
2 parents 4411e73 + 644d110 commit eb9e406

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

Encoder/XmlEncoder.php

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

431-
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))));
431+
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))));
432432
}
433433

434434
/**

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
@@ -213,7 +213,7 @@ protected function handleCircularReference(object $object, string $format = null
213213
return $circularReferenceHandler($object, $format, $context);
214214
}
215215

216-
throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', \get_class($object), $context[self::CIRCULAR_REFERENCE_LIMIT] ?? $this->defaultContext[self::CIRCULAR_REFERENCE_LIMIT]));
216+
throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d).', \get_class($object), $context[self::CIRCULAR_REFERENCE_LIMIT] ?? $this->defaultContext[self::CIRCULAR_REFERENCE_LIMIT]));
217217
}
218218

219219
/**
@@ -406,7 +406,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
406406
try {
407407
if (null !== $parameter->getClass()) {
408408
if (!$this->serializer instanceof DenormalizerInterface) {
409-
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));
409+
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));
410410
}
411411
$parameterClass = $parameter->getClass()->getName();
412412
$parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName, $format));

Normalizer/AbstractObjectNormalizer.php

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

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

201201
$data = $this->updateData($data, $attribute, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attribute, $format)), $class, $format, $context);
@@ -215,12 +215,12 @@ protected function instantiateObject(array &$data, string $class, array &$contex
215215
{
216216
if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForClass($class)) {
217217
if (!isset($data[$mapping->getTypeProperty()])) {
218-
throw new RuntimeException(sprintf('Type property "%s" not found for the abstract object "%s"', $mapping->getTypeProperty(), $class));
218+
throw new RuntimeException(sprintf('Type property "%s" not found for the abstract object "%s".', $mapping->getTypeProperty(), $class));
219219
}
220220

221221
$type = $data[$mapping->getTypeProperty()];
222222
if (null === ($mappedClass = $mapping->getClassForType($type))) {
223-
throw new RuntimeException(sprintf('The type "%s" has no mapped class for the abstract object "%s"', $type, $class));
223+
throw new RuntimeException(sprintf('The type "%s" has no mapped class for the abstract object "%s".', $type, $class));
224224
}
225225

226226
$class = $mappedClass;
@@ -414,7 +414,7 @@ private function validateAndDenormalize(string $currentClass, string $attribute,
414414

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

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

Normalizer/DateTimeNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function denormalize($data, string $type, string $format = null, array $c
9494

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

97-
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']))));
97+
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']))));
9898
}
9999

100100
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, string $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
@@ -112,7 +112,7 @@ public function __construct(array $normalizers = [], array $encoders = [])
112112
final public function serialize($data, string $format, array $context = []): string
113113
{
114114
if (!$this->supportsEncoding($format, $context)) {
115-
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format));
115+
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format));
116116
}
117117

118118
if ($this->encoder->needsNormalization($format, $context)) {
@@ -128,7 +128,7 @@ final public function serialize($data, string $format, array $context = []): str
128128
final public function deserialize($data, string $type, string $format, array $context = [])
129129
{
130130
if (!$this->supportsDecoding($format, $context)) {
131-
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format));
131+
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported.', $format));
132132
}
133133

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

170-
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))));
170+
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))));
171171
}
172172

173173
/**

0 commit comments

Comments
 (0)