From a52382344d8dc70a770b274ba6380453e55344c0 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 26 Aug 2012 08:28:19 +0200 Subject: [PATCH 1/3] [Form] fixed and added phpDoc --- .../Form/ChoiceList/ORMQueryBuilderLoader.php | 6 +- .../Doctrine/Form/Type/DoctrineType.php | 1 + .../Component/Form/Event/DataEvent.php | 4 +- src/Symfony/Component/Form/Form.php | 115 ++++++------------ src/Symfony/Component/Form/FormBuilder.php | 3 +- .../Component/Form/FormConfigBuilder.php | 1 - .../Form/FormConfigBuilderInterface.php | 8 +- .../Component/Form/FormConfigInterface.php | 2 +- src/Symfony/Component/Form/FormError.php | 10 +- src/Symfony/Component/Form/FormInterface.php | 36 ++++-- .../Form/Util/PropertyPathIterator.php | 2 +- 11 files changed, 83 insertions(+), 105 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php index 5d9b5e225e..238ef557c5 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php @@ -33,9 +33,9 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface /** * Construct an ORM Query Builder Loader * - * @param QueryBuilder $queryBuilder - * @param EntityManager $manager - * @param string $class + * @param QueryBuilder|\Closure $queryBuilder + * @param EntityManager $manager + * @param string $class */ public function __construct($queryBuilder, $manager = null, $class = null) { diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index e7c6accaa4..06c753a769 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -155,6 +155,7 @@ abstract class DoctrineType extends AbstractType * @param ObjectManager $manager * @param mixed $queryBuilder * @param string $class + * * @return EntityLoaderInterface */ abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class); diff --git a/src/Symfony/Component/Form/Event/DataEvent.php b/src/Symfony/Component/Form/Event/DataEvent.php index 7bdc053edd..1091b5ccf2 100644 --- a/src/Symfony/Component/Form/Event/DataEvent.php +++ b/src/Symfony/Component/Form/Event/DataEvent.php @@ -50,7 +50,7 @@ class DataEvent extends Event /** * Returns the data associated with this event. * - * @return type + * @return mixed */ public function getData() { @@ -58,7 +58,7 @@ class DataEvent extends Event } /** - * Allows updating with some filtered data + * Allows updating with some filtered data. * * @param mixed $data */ diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index e9cf205cd0..ff29a119c6 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -164,9 +164,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the configuration of the form. - * - * @return FormConfigInterface The form's configuration. + * {@inheritdoc} */ public function getConfig() { @@ -174,9 +172,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the name by which the form is identified in forms. - * - * @return string The name of the form. + * {@inheritdoc} */ public function getName() { @@ -247,11 +243,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Sets the parent form. - * - * @param FormInterface $parent The parent form - * - * @return Form The current form + * {@inheritdoc} */ public function setParent(FormInterface $parent = null) { @@ -269,9 +261,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the parent form. - * - * @return FormInterface The parent form + * {@inheritdoc} */ public function getParent() { @@ -279,9 +269,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the form has a parent. - * - * @return Boolean + * {@inheritdoc} */ public function hasParent() { @@ -289,9 +277,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the root of the form tree. - * - * @return FormInterface The root of the tree + * {@inheritdoc} */ public function getRoot() { @@ -299,9 +285,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the form is the root of the form tree. - * - * @return Boolean + * {@inheritdoc} */ public function isRoot() { @@ -339,11 +323,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Updates the form with default data. - * - * @param mixed $modelData The data formatted as expected for the underlying object - * - * @return Form The current form + * {@inheritdoc} */ public function setData($modelData) { @@ -440,9 +420,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the data in the format needed for the underlying object. - * - * @return mixed + * {@inheritdoc} */ public function getData() { @@ -454,11 +432,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the normalized data of the form. - * - * @return mixed When the form is not bound, the default data is returned. - * When the form is bound, the normalized bound data is - * returned if the form is valid, null otherwise. + * {@inheritdoc} */ public function getNormData() { @@ -470,9 +444,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the data transformed by the value transformer. - * - * @return string + * {@inheritdoc} */ public function getViewData() { @@ -497,9 +469,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the extra data. - * - * @return array The bound data which do not belong to a child + * {@inheritdoc} */ public function getExtraData() { @@ -507,13 +477,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Binds data to the form, transforms and validates it. - * - * @param string|array $submittedData The data - * - * @return Form The current form - * - * @throws UnexpectedTypeException + * {@inheritdoc} */ public function bind($submittedData) { @@ -677,11 +641,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Adds an error to this form. - * - * @param FormError $error - * - * @return Form The current form + * {@inheritdoc} */ public function addError(FormError $error) { @@ -708,9 +668,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the form is bound. - * - * @return Boolean true if the form is bound to input values, false otherwise + * {@inheritdoc} */ public function isBound() { @@ -718,9 +676,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the data in the different formats is synchronized. - * - * @return Boolean + * {@inheritdoc} */ public function isSynchronized() { @@ -728,9 +684,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the form is empty. - * - * @return Boolean + * {@inheritdoc} */ public function isEmpty() { @@ -744,9 +698,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns whether the form is valid. - * - * @return Boolean + * {@inheritdoc} */ public function isValid() { @@ -783,9 +735,7 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns all errors. - * - * @return array An array of FormError instances that occurred during binding + * {@inheritdoc} */ public function getErrors() { @@ -962,11 +912,11 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns true if the child exists (implements the \ArrayAccess interface). + * Returns whether a child with the given name exists (implements the \ArrayAccess interface). * * @param string $name The name of the child * - * @return Boolean true if the widget exists, false otherwise + * @return Boolean */ public function offsetExists($name) { @@ -974,11 +924,13 @@ class Form implements \IteratorAggregate, FormInterface } /** - * Returns the form child associated with the name (implements the \ArrayAccess interface). + * Returns the child with the given name (implements the \ArrayAccess interface). * - * @param string $name The offset of the value to get + * @param string $name The name of the child * - * @return FormInterface A form instance + * @return FormInterface The child form + * + * @throws \InvalidArgumentException If the named child does not exist. */ public function offsetGet($name) { @@ -989,7 +941,12 @@ class Form implements \IteratorAggregate, FormInterface * Adds a child to the form (implements the \ArrayAccess interface). * * @param string $name Ignored. The name of the child is used. - * @param FormInterface $child The child to be added + * @param FormInterface $child The child to be added. + * + * @throws AlreadyBoundException If the form has already been bound. + * @throws FormException When trying to add a child to a non-compound form. + * + * @see self::add() */ public function offsetSet($name, $child) { @@ -999,7 +956,9 @@ class Form implements \IteratorAggregate, FormInterface /** * Removes the child with the given name from the form (implements the \ArrayAccess interface). * - * @param string $name The name of the child to be removed + * @param string $name The name of the child to remove + * + * @throws AlreadyBoundException If the form has already been bound. */ public function offsetUnset($name) { @@ -1043,7 +1002,7 @@ class Form implements \IteratorAggregate, FormInterface * * @param mixed $value The value to transform * - * @return string + * @return mixed */ private function modelToNorm($value) { @@ -1077,7 +1036,7 @@ class Form implements \IteratorAggregate, FormInterface * * @param mixed $value The value to transform * - * @return string + * @return mixed */ private function normToView($value) { diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index e89cdfdfca..9d23ff565f 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -44,7 +44,8 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB private $unresolvedChildren = array(); /** - * The parent of this builder + * The parent of this builder. + * * @var FormBuilder */ private $parent; diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 81906fe439..459c09c04e 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -143,7 +143,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface * @param EventDispatcherInterface $dispatcher The event dispatcher * @param array $options The form options * - * @throws UnexpectedTypeException If the name is not a string. * @throws \InvalidArgumentException If the data class is not a valid class or if * the name contains invalid characters. */ diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php index 988abb40ba..35eff8790b 100644 --- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php +++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -162,9 +162,9 @@ interface FormConfigBuilderInterface extends FormConfigInterface /** * Sets the property path that the form should be mapped to. * - * @param string|PropertyPath $propertyPath The property path or null if the path - * should be set automatically based on - * the form's name. + * @param null|string|PropertyPathInterface $propertyPath The property path or null if the path + * should be set automatically based on + * the form's name. * * @return self The configuration object. */ @@ -184,7 +184,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface * Sets whether the form's data should be modified by reference. * * @param Boolean $byReference Whether the data should be - * modified by reference. + * modified by reference. * * @return self The configuration object. */ diff --git a/src/Symfony/Component/Form/FormConfigInterface.php b/src/Symfony/Component/Form/FormConfigInterface.php index 1274e4c7a5..364d6a60b0 100644 --- a/src/Symfony/Component/Form/FormConfigInterface.php +++ b/src/Symfony/Component/Form/FormConfigInterface.php @@ -35,7 +35,7 @@ interface FormConfigInterface /** * Returns the property path that the form should be mapped to. * - * @return Util\PropertyPath The property path. + * @return null|Util\PropertyPathInterface The property path. */ public function getPropertyPath(); diff --git a/src/Symfony/Component/Form/FormError.php b/src/Symfony/Component/Form/FormError.php index 4ef5653413..b336a40388 100644 --- a/src/Symfony/Component/Form/FormError.php +++ b/src/Symfony/Component/Form/FormError.php @@ -41,12 +41,12 @@ class FormError * * Any array key in $messageParameters will be used as a placeholder in * $messageTemplate. - * @see Symfony\Component\Translation\Translator + * @see \Symfony\Component\Translation\Translator * - * @param string $messageTemplate The template for the error message - * @param array $messageParameters The parameters that should be - * substituted in the message template. - * @param integer $messagePluralization The value for error message pluralization + * @param string $messageTemplate The template for the error message + * @param array $messageParameters The parameters that should be + * substituted in the message template. + * @param integer|null $messagePluralization The value for error message pluralization */ public function __construct($messageTemplate, array $messageParameters = array(), $messagePluralization = null) { diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 2f78d155d9..31582205b3 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Form; /** - * A form group bundling multiple form forms + * A form group bundling multiple forms in a hierarchical structure. * * @author Bernhard Schussek */ @@ -24,6 +24,10 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * @param FormInterface $parent The parent form * * @return FormInterface The form instance + * + * @throws Exception\AlreadyBoundException If the form has already been bound. + * @throws Exception\FormException When trying to set a parent for a form with + * an empty name. */ public function setParent(FormInterface $parent = null); @@ -47,6 +51,9 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * @param FormInterface $child The FormInterface to add as a child * * @return FormInterface The form instance + * + * @throws Exception\AlreadyBoundException If the form has already been bound. + * @throws Exception\FormException When trying to add a child to a non-compound form. */ public function add(FormInterface $child); @@ -56,6 +63,8 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * @param string $name The name of the child * * @return FormInterface The child form + * + * @throws \InvalidArgumentException If the named child does not exist. */ public function get($name); @@ -74,6 +83,8 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * @param string $name The name of the child to remove * * @return FormInterface The form instance + * + * @throws Exception\AlreadyBoundException If the form has already been bound. */ public function remove($name); @@ -92,11 +103,16 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable public function getErrors(); /** - * Updates the field with default data. + * Updates the form with default data. * * @param array $modelData The data formatted as expected for the underlying object * * @return FormInterface The form instance + * + * @throws Exception\AlreadyBoundException If the form has already been bound. + * @throws Exception\FormException If listeners try to call setData in a cycle. Or if + * the view data does not match the expected type + * according to {@link FormConfigInterface::getDataClass}. */ public function setData($modelData); @@ -111,15 +127,15 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * Returns the normalized data of the field. * * @return mixed When the field is not bound, the default data is returned. - * When the field is bound, the normalized bound data is - * returned if the field is valid, null otherwise. + * When the field is bound, the normalized bound data is + * returned if the field is valid, null otherwise. */ public function getNormData(); /** * Returns the data transformed by the value transformer. * - * @return string + * @return mixed */ public function getViewData(); @@ -154,7 +170,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable /** * Returns the property path that the form is mapped to. * - * @return Util\PropertyPath The property path. + * @return Util\PropertyPathInterface The property path. */ public function getPropertyPath(); @@ -213,13 +229,15 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable public function isSynchronized(); /** - * Writes data into the form. + * Binds data to the form, transforms and validates it. * - * @param mixed $data The data + * @param null|string|array $submittedData The data * * @return FormInterface The form instance + * + * @throws Exception\AlreadyBoundException If the form has already been bound. */ - public function bind($data); + public function bind($submittedData); /** * Returns the root of the form tree. diff --git a/src/Symfony/Component/Form/Util/PropertyPathIterator.php b/src/Symfony/Component/Form/Util/PropertyPathIterator.php index 72ce27210c..c165d0854e 100644 --- a/src/Symfony/Component/Form/Util/PropertyPathIterator.php +++ b/src/Symfony/Component/Form/Util/PropertyPathIterator.php @@ -21,7 +21,7 @@ class PropertyPathIterator extends \ArrayIterator implements PropertyPathIterato { /** * The traversed property path - * @var PropertyPath + * @var PropertyPathInterface */ protected $path; From 596bbb13279cd98711de472afe3ac261d4ec2463 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 26 Aug 2012 08:29:26 +0200 Subject: [PATCH 2/3] [Form] fixed FormConfigBuilder to use PropertyPathInterface --- src/Symfony/Component/Form/FormConfigBuilder.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 459c09c04e..c4e3f92695 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Util\PropertyPath; +use Symfony\Component\Form\Util\PropertyPathInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; @@ -41,7 +42,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface private $name; /** - * @var PropertyPath + * @var PropertyPathInterface */ private $propertyPath; @@ -709,7 +710,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface throw new FormException('The config builder cannot be modified anymore.'); } - if (null !== $propertyPath && !$propertyPath instanceof PropertyPath) { + if (null !== $propertyPath && !$propertyPath instanceof PropertyPathInterface) { $propertyPath = new PropertyPath($propertyPath); } From 83dc966f1cd5fe85b6f301181a639c9e13b74bab Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Mon, 27 Aug 2012 00:03:52 +0000 Subject: [PATCH 3/3] [Form] Fixed some PHPDoc --- .../Component/Form/AbstractRendererEngine.php | 2 +- .../ChoiceToBooleanArrayTransformer.php | 4 +++- .../ChoicesToBooleanArrayTransformer.php | 6 ++++-- .../DataTransformer/ChoicesToValuesTransformer.php | 3 ++- .../PercentToLocalizedStringTransformer.php | 2 ++ src/Symfony/Component/Form/Form.php | 2 ++ src/Symfony/Component/Form/FormConfigBuilder.php | 12 ++++++++++++ src/Symfony/Component/Form/Guess/Guess.php | 2 ++ .../Component/Form/Util/PropertyPathBuilder.php | 2 ++ 9 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Form/AbstractRendererEngine.php b/src/Symfony/Component/Form/AbstractRendererEngine.php index 9e16b44cfe..347be10d29 100644 --- a/src/Symfony/Component/Form/AbstractRendererEngine.php +++ b/src/Symfony/Component/Form/AbstractRendererEngine.php @@ -22,7 +22,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface * The variable in {@link FormView} used as cache key. */ const CACHE_KEY_VAR = 'cache_key'; - + /** * @var array */ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php index c7f9549d3b..7e6203c64d 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php @@ -77,7 +77,9 @@ class ChoiceToBooleanArrayTransformer implements DataTransformerInterface * * @return mixed A scalar value * - * @throws new UnexpectedTypeException if the given value is not an array + * @throws UnexpectedTypeException if the given value is not an array + * @throws TransformationFailedException if the recuperation of the choices fails or + * if some choice can't be found */ public function reverseTransform($values) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php index 38253ff43c..9c3b6475d1 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php @@ -40,7 +40,7 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface * * @return mixed An array * - * @throws UnexpectedTypeException if the given value is not an array + * @throws UnexpectedTypeException if the given value is not an array * @throws TransformationFailedException if the choices can not be retrieved */ public function transform($array) @@ -79,7 +79,9 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface * * @return mixed An array * - * @throws UnexpectedTypeException if the given value is not an array + * @throws UnexpectedTypeException if the given value is not an array + * @throws TransformationFailedException if the recuperation of the choices fails or + * if some choice can't be found */ public function reverseTransform($values) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php index f439bd9211..e72fcf097e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php @@ -59,7 +59,8 @@ class ChoicesToValuesTransformer implements DataTransformerInterface * * @return array * - * @throws UnexpectedTypeException if the given value is not an array + * @throws UnexpectedTypeException if the given value is not an array + * @throws TransformationFailedException if could not find all matching choices for the given values */ public function reverseTransform($array) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index c4d9ce28e8..bbf66466a0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -42,6 +42,8 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface * * @param integer $precision The precision * @param string $type One of the supported types + * + * @throws UnexpectedTypeException if the given value of type is unknown */ public function __construct($precision = null, $type = null) { diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index ff29a119c6..6fcc1cb6b0 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -143,6 +143,8 @@ class Form implements \IteratorAggregate, FormInterface * Creates a new form based on the given configuration. * * @param FormConfigInterface $config The form configuration. + * + * @throws FormException if a data mapper is not provided for a compound form */ public function __construct(FormConfigInterface $config) { diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index c4e3f92695..9a21df4642 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -244,6 +244,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link addViewTransformer()} instead. */ @@ -263,6 +265,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ public function prependClientTransformer(DataTransformerInterface $viewTransformer) @@ -279,6 +283,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link resetViewTransformers()} instead. */ @@ -330,6 +336,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ public function appendNormTransformer(DataTransformerInterface $modelTransformer) @@ -348,6 +356,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link addModelTransformer()} instead. */ @@ -365,6 +375,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * + * @throws FormException if the form configuration is locked + * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link resetModelTransformers()} instead. */ diff --git a/src/Symfony/Component/Form/Guess/Guess.php b/src/Symfony/Component/Form/Guess/Guess.php index ade0f7c1c4..de3e4e2cee 100644 --- a/src/Symfony/Component/Form/Guess/Guess.php +++ b/src/Symfony/Component/Form/Guess/Guess.php @@ -96,6 +96,8 @@ abstract class Guess * Constructor * * @param integer $confidence The confidence + * + * @throws \UnexpectedValueException if the given value of confidence is unknown */ public function __construct($confidence) { diff --git a/src/Symfony/Component/Form/Util/PropertyPathBuilder.php b/src/Symfony/Component/Form/Util/PropertyPathBuilder.php index 32b483ca68..eac49c2e7f 100644 --- a/src/Symfony/Component/Form/Util/PropertyPathBuilder.php +++ b/src/Symfony/Component/Form/Util/PropertyPathBuilder.php @@ -89,6 +89,8 @@ class PropertyPathBuilder * * @param integer $offset The offset at which to remove. * @param integer $length The length of the removed piece. + * + * @throws \OutOfBoundsException if offset is invalid */ public function remove($offset, $length = 1) {