Skip to content

Commit 2b5a266

Browse files
committed
Fix quotes in exception messages
1 parent a1162d3 commit 2b5a266

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

Encoder/XmlEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null)
412412

413413
if (\is_object($data)) {
414414
if (null === $this->serializer) {
415-
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
415+
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used with object data.', __METHOD__));
416416
}
417417

418418
$data = $this->serializer->normalize($data, $this->format, $this->context);
@@ -490,7 +490,7 @@ private function selectNodeType(\DOMNode $node, $val)
490490
$this->buildXml($node, $val);
491491
} elseif (\is_object($val)) {
492492
if (null === $this->serializer) {
493-
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used with object data.', __METHOD__));
493+
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used with object data.', __METHOD__));
494494
}
495495

496496
return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context));

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($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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
340340
if (method_exists($constructorParameter, 'isVariadic') && $constructorParameter->isVariadic()) {
341341
if ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) {
342342
if (!\is_array($data[$paramName])) {
343-
throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name));
343+
throw new RuntimeException(sprintf('Cannot create an instance of "%s" from serialized data because the variadic parameter "%s" can only accept an array.', $class, $constructorParameter->name));
344344
}
345345

346346
$variadicParameters = [];
@@ -366,7 +366,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
366366
} elseif ($constructorParameter->isDefaultValueAvailable()) {
367367
$params[] = $constructorParameter->getDefaultValue();
368368
} else {
369-
throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name));
369+
throw new RuntimeException(sprintf('Cannot create an instance of "%s" from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name));
370370
}
371371
}
372372

@@ -388,7 +388,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
388388
try {
389389
if (null !== $parameter->getClass()) {
390390
if (!$this->serializer instanceof DenormalizerInterface) {
391-
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));
391+
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));
392392
}
393393
$parameterClass = $parameter->getClass()->getName();
394394

Normalizer/ArrayDenormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
6969
public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/)
7070
{
7171
if (null === $this->serializer) {
72-
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow %s() to be used.', __METHOD__));
72+
throw new BadMethodCallException(sprintf('The serializer needs to be set to allow "%s()" to be used.', __METHOD__));
7373
}
7474

7575
$context = \func_num_args() > 3 ? func_get_arg(3) : [];

Normalizer/DateIntervalNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function supportsNormalization($data, $format = null)
6767
public function denormalize($data, $type, $format = null, array $context = [])
6868
{
6969
if (!\is_string($data)) {
70-
throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', \gettype($data)));
70+
throw new InvalidArgumentException(sprintf('Data expected to be a string, "%s" given.', \gettype($data)));
7171
}
7272

7373
if (!$this->isISO8601($data)) {

Serializer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function __construct(array $normalizers = [], array $encoders = [])
109109
final public function serialize($data, $format, array $context = [])
110110
{
111111
if (!$this->supportsEncoding($format, $context)) {
112-
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported.', $format));
112+
throw new NotEncodableValueException(sprintf('Serialization for the format "%s" is not supported.', $format));
113113
}
114114

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

131131
$data = $this->decode($data, $format, $context);
@@ -161,7 +161,7 @@ public function normalize($data, $format = null, array $context = [])
161161
throw new LogicException('You must register at least one normalizer to be able to normalize objects.');
162162
}
163163

164-
throw new NotNormalizableValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', \get_class($data)));
164+
throw new NotNormalizableValueException(sprintf('Could not normalize object of type "%s", no supporting normalizer found.', \get_class($data)));
165165
}
166166

167167
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))));
@@ -182,7 +182,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
182182
return $normalizer->denormalize($data, $type, $format, $context);
183183
}
184184

185-
throw new NotNormalizableValueException(sprintf('Could not denormalize object of type %s, no supporting normalizer found.', $type));
185+
throw new NotNormalizableValueException(sprintf('Could not denormalize object of type "%s", no supporting normalizer found.', $type));
186186
}
187187

188188
/**

0 commit comments

Comments
 (0)