Skip to content

[Form] Fix author tag + exception messages #31278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Transforms between a timezone identifier string and a DateTimeZone object.
*
* @author Roland Franssen <franssen.roland@gmai.com>
* @author Roland Franssen <franssen.roland@gmail.com>
*/
class DateTimeZoneToStringTransformer implements DataTransformerInterface
{
Expand All @@ -39,14 +39,14 @@ public function transform($dateTimeZone)

if ($this->multiple) {
if (!\is_array($dateTimeZone)) {
throw new TransformationFailedException('Expected an array.');
throw new TransformationFailedException('Expected an array of \DateTimeZone objects.');
}

return array_map([new self(), 'transform'], $dateTimeZone);
}

if (!$dateTimeZone instanceof \DateTimeZone) {
throw new TransformationFailedException('Expected a \DateTimeZone.');
throw new TransformationFailedException('Expected a \DateTimeZone object.');
}

return $dateTimeZone->getName();
Expand All @@ -63,14 +63,14 @@ public function reverseTransform($value)

if ($this->multiple) {
if (!\is_array($value)) {
throw new TransformationFailedException('Expected an array.');
throw new TransformationFailedException('Expected an array of timezone identifier strings.');
}

return array_map([new self(), 'reverseTransform'], $value);
}

if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
throw new TransformationFailedException('Expected a timezone identifier string.');
}

try {
Expand Down