From af41a1a550a1aa72cd9cd32d25d0811ef66f0a9b Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Mon, 21 May 2012 18:00:31 +0200 Subject: [PATCH] [Form] Fixed typos --- UPGRADE-2.1.md | 2 +- .../Form/Extension/Validator/Constraints/FormValidator.php | 6 +++++- .../Validator/EventListener/ValidationListener.php | 2 +- src/Symfony/Component/Form/Form.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index a919af25e8..c8faf03578 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -551,7 +551,7 @@ )); ``` - After (if the address object is an array): + After: ``` $builder->add('name', 'text', array( diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 978c76326a..586bde759f 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -79,10 +79,14 @@ class FormValidator extends ConstraintValidator } } } else { + $clientDataAsString = is_scalar($form->getClientData()) + ? (string) $form->getClientData() + : gettype($form->getClientData()); + // Mark the form with an error if it is not synchronized $this->context->addViolation( $form->getAttribute('invalid_message'), - array('{{ value }}' => (string) $form->getClientData()), + array('{{ value }}' => $clientDataAsString), $form->getClientData(), null, Form::ERR_INVALID diff --git a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php index 89ff82902e..2ad34d621e 100644 --- a/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php @@ -64,7 +64,7 @@ class ValidationListener implements EventSubscriberInterface if (count($violations) > 0) { foreach ($violations as $violation) { // Allow the "invalid" constraint to be put onto - // non-synchzronized forms + // non-synchronized forms $allowNonSynchronized = Form::ERR_INVALID === $violation->getCode(); $this->violationMapper->mapViolation($violation, $form, $allowNonSynchronized); diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 129ba0bda4..0ad79f70c7 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -348,7 +348,7 @@ class Form implements \IteratorAggregate, FormInterface } throw new FormException( - 'The form\'s client data is expected to of type ' . $expectedType . ', ' . + 'The form\'s client data is expected to be of type ' . $expectedType . ', ' . 'but is an instance of class ' . get_class($clientData) . '. You ' . 'can avoid this error by setting the "data_class" option to ' . '"' . get_class($clientData) . '" or by adding a client transformer ' .