Skip to content

Commit 3505ee4

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages
2 parents 003bfa6 + bde3281 commit 3505ee4

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

Extension/Core/DataTransformer/BaseDateTimeTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public function __construct(string $inputTimezone = null, string $outputTimezone
4343
try {
4444
new \DateTimeZone($this->inputTimezone);
4545
} catch (\Exception $e) {
46-
throw new InvalidArgumentException(sprintf('Input timezone is invalid: %s.', $this->inputTimezone), $e->getCode(), $e);
46+
throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e);
4747
}
4848

4949
try {
5050
new \DateTimeZone($this->outputTimezone);
5151
} catch (\Exception $e) {
52-
throw new InvalidArgumentException(sprintf('Output timezone is invalid: %s.', $this->outputTimezone), $e->getCode(), $e);
52+
throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e);
5353
}
5454
}
5555
}

Extension/Core/Type/DateTimeType.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,28 +311,28 @@ public function configureOptions(OptionsResolver $resolver)
311311

312312
$resolver->setNormalizer('date_format', function (Options $options, $dateFormat) {
313313
if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
314-
throw new LogicException(sprintf('Cannot use the "date_format" option of the %s with an HTML5 date.', self::class));
314+
throw new LogicException(sprintf('Cannot use the "date_format" option of the "%s" with an HTML5 date.', self::class));
315315
}
316316

317317
return $dateFormat;
318318
});
319319
$resolver->setNormalizer('date_widget', function (Options $options, $dateWidget) {
320320
if (null !== $dateWidget && 'single_text' === $options['widget']) {
321-
throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
321+
throw new LogicException(sprintf('Cannot use the "date_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
322322
}
323323

324324
return $dateWidget;
325325
});
326326
$resolver->setNormalizer('time_widget', function (Options $options, $timeWidget) {
327327
if (null !== $timeWidget && 'single_text' === $options['widget']) {
328-
throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
328+
throw new LogicException(sprintf('Cannot use the "time_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class));
329329
}
330330

331331
return $timeWidget;
332332
});
333333
$resolver->setNormalizer('html5', function (Options $options, $html5) {
334334
if ($html5 && self::HTML5_FORMAT !== $options['format']) {
335-
throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is enabled.', self::class));
335+
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
336336
}
337337

338338
return $html5;

Extension/Core/Type/DateType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function configureOptions(OptionsResolver $resolver)
325325

326326
$resolver->setNormalizer('html5', function (Options $options, $html5) {
327327
if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
328-
throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is enabled.', self::class));
328+
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
329329
}
330330

331331
return $html5;

Extension/Core/Type/WeekType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function configureOptions(OptionsResolver $resolver)
161161
$resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);
162162
$resolver->setNormalizer('html5', function (Options $options, $html5) {
163163
if ($html5 && 'single_text' !== $options['widget']) {
164-
throw new LogicException(sprintf('The "widget" option of %s must be set to "single_text" when the "html5" option is enabled.', self::class));
164+
throw new LogicException(sprintf('The "widget" option of "%s" must be set to "single_text" when the "html5" option is enabled.', self::class));
165165
}
166166

167167
return $html5;

Extension/DataCollector/FormDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
7070
public function __construct(FormDataExtractorInterface $dataExtractor)
7171
{
7272
if (!class_exists(ClassStub::class)) {
73-
throw new \LogicException(sprintf('The VarDumper component is needed for using the %s class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
73+
throw new \LogicException(sprintf('The VarDumper component is needed for using the "%s" class. Install symfony/var-dumper version 3.4 or above.', __CLASS__));
7474
}
7575

7676
$this->dataExtractor = $dataExtractor;

Extension/Validator/ViolationMapper/ViolationPath.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function getElements()
163163
public function getElement(int $index)
164164
{
165165
if (!isset($this->elements[$index])) {
166-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
166+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
167167
}
168168

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

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

193193
return $this->isIndex[$index];
@@ -210,7 +210,7 @@ public function isIndex(int $index)
210210
public function mapsForm(int $index)
211211
{
212212
if (!isset($this->mapsForm[$index])) {
213-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
213+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
214214
}
215215

216216
return $this->mapsForm[$index];

Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ private function modelToNorm($value)
10551055
$value = $transformer->transform($value);
10561056
}
10571057
} catch (TransformationFailedException $exception) {
1058-
throw new TransformationFailedException('Unable to transform data for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
1058+
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
10591059
}
10601060

10611061
return $value;
@@ -1077,7 +1077,7 @@ private function normToModel($value)
10771077
$value = $transformers[$i]->reverseTransform($value);
10781078
}
10791079
} catch (TransformationFailedException $exception) {
1080-
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
1080+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
10811081
}
10821082

10831083
return $value;
@@ -1106,7 +1106,7 @@ private function normToView($value)
11061106
$value = $transformer->transform($value);
11071107
}
11081108
} catch (TransformationFailedException $exception) {
1109-
throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
1109+
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
11101110
}
11111111

11121112
return $value;
@@ -1130,7 +1130,7 @@ private function viewToNorm($value)
11301130
$value = $transformers[$i]->reverseTransform($value);
11311131
}
11321132
} catch (TransformationFailedException $exception) {
1133-
throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
1133+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": %s', $this->getPropertyPath(), $exception->getMessage()), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());
11341134
}
11351135

11361136
return $value;

Test/Traits/ValidatorExtensionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function getValidatorExtension(): ValidatorExtension
3131
}
3232

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

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

0 commit comments

Comments
 (0)