Skip to content

Commit 1182449

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Fix quotes in exception messages
2 parents 8fc7fe6 + 8eb8f3b commit 1182449

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
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/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($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($index)
175175
public function isProperty($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($index)
187187
public function isIndex($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];
@@ -212,7 +212,7 @@ public function isIndex($index)
212212
public function mapsForm($index)
213213
{
214214
if (!isset($this->mapsForm[$index])) {
215-
throw new OutOfBoundsException(sprintf('The index %s is not within the violation path.', $index));
215+
throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index));
216216
}
217217

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

Form.php

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

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

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

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

11371137
return $value;

Test/Traits/ValidatorExtensionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function getValidatorExtension()
3434
}
3535

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

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

0 commit comments

Comments
 (0)