소스 검색

[Form] phpDoc

Victor Berchet 14 년 전
부모
커밋
87a6fd0f99

+ 84 - 22
src/Symfony/Component/Form/AbstractExtension.php

@@ -20,25 +20,38 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
 abstract class AbstractExtension implements FormExtensionInterface
 {
     /**
-     * @var array
+     * The types provided by this extension
+     * @var array An array of FormTypeInterface
      */
     private $types;
 
     /**
-     * @var array
+     * The type extensions provided by this extension
+     * @var array An array of FormTypeExtensionInterface
      */
     private $typeExtensions;
 
     /**
+     * The type guesser provided by this extension
      * @var FormTypeGuesserInterface
      */
     private $typeGuesser;
 
     /**
+     * Whether the type guesser has been loaded
      * @var Boolean
      */
     private $typeGuesserLoaded = false;
 
+    /**
+     * Returns a type by name.
+     *
+     * @param string $name The name of the type
+     *
+     * @return FormTypeInterface The type
+     *
+     * @throws FormException if the given type is not supported by this extension
+     */
     public function getType($name)
     {
         if (null === $this->types) {
@@ -52,6 +65,13 @@ abstract class AbstractExtension implements FormExtensionInterface
         return $this->types[$name];
     }
 
+    /**
+     * Returns whether the given type is supported.
+     *
+     * @param string $name The name of the type
+     *
+     * @return Boolean Whether the type is supported by this extension
+     */
     public function hasType($name)
     {
         if (null === $this->types) {
@@ -61,6 +81,13 @@ abstract class AbstractExtension implements FormExtensionInterface
         return isset($this->types[$name]);
     }
 
+    /**
+     * Returns the extensions for the given type.
+     *
+     * @param string $name The name of the type
+     *
+     * @return array An array of extensions as FormTypeExtensionInterface instances
+     */
     public function getTypeExtensions($name)
     {
         if (null === $this->typeExtensions) {
@@ -72,6 +99,13 @@ abstract class AbstractExtension implements FormExtensionInterface
             : array();
     }
 
+    /**
+     * Returns whether this extension provides type extensions for the given type.
+     *
+     * @param string $name The name of the type
+     *
+     * @return Boolean Whether the given type has extensions
+     */
     public function hasTypeExtensions($name)
     {
         if (null === $this->typeExtensions) {
@@ -81,6 +115,11 @@ abstract class AbstractExtension implements FormExtensionInterface
         return isset($this->typeExtensions[$name]) && count($this->typeExtensions[$name]) > 0;
     }
 
+    /**
+     * Returns the type guesser provided by this extension.
+     *
+     * @return FormTypeGuesserInterface|null The type guesser
+     */
     public function getTypeGuesser()
     {
         if (!$this->typeGuesserLoaded) {
@@ -90,69 +129,92 @@ abstract class AbstractExtension implements FormExtensionInterface
         return $this->typeGuesser;
     }
 
+    /**
+     * Registers the types.
+     *
+     * @return array An array of FormTypeInterface instances
+     */
     protected function loadTypes()
     {
         return array();
     }
 
+    /**
+     * Registers the type extensions.
+     *
+     * @return array An array of FormTypeExtensionInterface instances
+     */
     protected function loadTypeExtensions()
     {
         return array();
     }
 
+    /**
+     * Registers the type guesser.
+     *
+     * @return FormTypeGuesserInterface|null A type guesser
+     */
     protected function loadTypeGuesser()
     {
         return null;
     }
 
+    /**
+     * Initializes the types.
+     *
+     * @throws UnexpectedTypeException if any registered type is not an instance of FormTypeInterface
+     */
     private function initTypes()
     {
-        $types = $this->loadTypes();
-        $typesByName = array();
+        $this->types = array();
 
-        foreach ($types as $type) {
+        foreach ($this->loadTypes() as $type) {
             if (!$type instanceof FormTypeInterface) {
                 throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
             }
 
-            $typesByName[$type->getName()] = $type;
+            $this->types[$type->getName()] = $type;
         }
-
-        $this->types = $typesByName;
     }
 
+    /**
+     * Initializes the type extensions.
+     *
+     * @throws UnexpectedTypeException if any registered type extension is not
+     *                                 an instance of FormTypeExtensionInterface
+     */
     private function initTypeExtensions()
     {
-        $extensions = $this->loadTypeExtensions();
-        $extensionsByType = array();
+        $this->typeExtensions = array();
 
-        foreach ($extensions as $extension) {
+        foreach ($this->loadTypeExtensions() as $extension) {
             if (!$extension instanceof FormTypeExtensionInterface) {
                 throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface');
             }
 
             $type = $extension->getExtendedType();
 
-            if (!isset($extensionsByType[$type])) {
-                $extensionsByType[$type] = array();
+            if (!isset($this->typeExtensions[$type])) {
+                $this->typeExtensions[$type] = array();
             }
 
-            $extensionsByType[$type][] = $extension;
+            $this->typeExtensions[$type][] = $extension;
         }
-
-        $this->typeExtensions = $extensionsByType;
     }
 
+    /**
+     * Initializes the type guesser.
+     *
+     * @throws UnexpectedTypeException if the type guesser is not an instance of FormTypeGuesserInterface
+     */
     private function initTypeGuesser()
     {
         $this->typeGuesserLoaded = true;
 
-        $guesser = $this->loadTypeGuesser();
+        $this->guesser = $this->loadTypeGuesser();
 
-        if (!$guesser instanceof FormTypeGuesserInterface) {
-            throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
+        if (!$this->guesser instanceof FormTypeGuesserInterface) {
+            throw new UnexpectedTypeException($this->guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
         }
-
-        $this->guesser = $guesser;
     }
-}
+}

+ 58 - 1
src/Symfony/Component/Form/AbstractType.php

@@ -15,20 +15,75 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
 
 abstract class AbstractType implements FormTypeInterface
 {
+    /**
+     * The extensions for this type
+     * @var array An array of FormTypeExtensionInterface instances
+     */
     private $extensions = array();
 
+    /**
+     * Builds the form.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the form.
+     *
+     * @see FormTypeExtensionInterface::buildForm()
+     *
+     * @param FormBuilder   $builder The form builder
+     * @param array         $options The options
+     */
     public function buildForm(FormBuilder $builder, array $options)
     {
     }
 
+    /**
+     * Builds the form view.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the view.
+     *
+     * @see FormTypeExtensionInterface::buildView()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     public function buildView(FormView $view, FormInterface $form)
     {
     }
 
+    /**
+     * Builds the form view.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the view.
+     *
+     * Children views have been built while this method gets called so you get
+     * a chance to modify them.
+     *
+     * @see FormTypeExtensionInterface::buildViewBottomUp()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     public function buildViewBottomUp(FormView $view, FormInterface $form)
     {
     }
 
+    /**
+     * Returns a builder for the current type.
+     *
+     * The builder is retrieved by going up in the type hierarchy when a type does
+     * not provide one.
+     *
+     * @param string                $name       The name of the builder
+     * @param FormFactoryInterface  $factory    The form factory
+     * @param array                 $options    The options
+     *
+     * @return FormBuilder|null A form builder or null when the type does not have a builder
+     */
     public function createBuilder($name, FormFactoryInterface $factory, array $options)
     {
         return null;
@@ -51,7 +106,7 @@ abstract class AbstractType implements FormTypeInterface
      *
      * @param array $options
      *
-     * @return string The name of the parent type
+     * @return string|null The name of the parent type if any otherwise null
      */
     public function getParent(array $options)
     {
@@ -61,6 +116,8 @@ abstract class AbstractType implements FormTypeInterface
     /**
      * Returns the name of this type.
      *
+     * The default name type is the class name without the Form nor Type suffix
+     *
      * @return string The name of this type
      */
     public function getName()

+ 40 - 0
src/Symfony/Component/Form/AbstractTypeExtension.php

@@ -13,18 +13,58 @@ namespace Symfony\Component\Form;
 
 abstract class AbstractTypeExtension implements FormTypeExtensionInterface
 {
+    /**
+     * Builds the form.
+     *
+     * This method gets called after the extended type has built the form to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildForm()
+     *
+     * @param FormBuilder   $builder The form builder
+     * @param array         $options The options
+     */
     public function buildForm(FormBuilder $builder, array $options)
     {
     }
 
+    /**
+     * Builds the view.
+     *
+     * This method gets called after the extended type has built the view to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildView()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     public function buildView(FormView $view, FormInterface $form)
     {
     }
 
+    /**
+     * Builds the view.
+     *
+     * This method gets called after the extended type has built the view to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildViewBottomUp()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     public function buildViewBottomUp(FormView $view, FormInterface $form)
     {
     }
 
+    /**
+     * Overrides the default options form the extended type.
+     *
+     * @param array $options
+     *
+     * @return array
+     */
     public function getDefaultOptions(array $options)
     {
         return array();

+ 35 - 0
src/Symfony/Component/Form/CallbackTransformer.php

@@ -13,21 +13,56 @@ namespace Symfony\Component\Form;
 
 class CallbackTransformer implements DataTransformerInterface
 {
+    /**
+     * The callback used for forward transform
+     * @var \Closure
+     */
     private $transform;
 
+    /**
+     * The callback used for reverse transform
+     * @var \Closure
+     */
     private $reverseTransform;
 
+    /**
+     * Constructor.
+     *
+     * @param \Closure $transform           The forward transform callback
+     * @param \Closure $reverseTransform    The reverse transform callback
+     */
     public function __construct(\Closure $transform, \Closure $reverseTransform)
     {
         $this->transform = $transform;
         $this->reverseTransform = $reverseTransform;
     }
 
+    /**
+     * Transforms a value from the original representation to a transformed representation.
+     *
+     * @param  mixed $value              The value in the original representation
+     *
+     * @return mixed                     The value in the transformed representation
+     *
+     * @throws UnexpectedTypeException   when the argument is not a string
+     * @throws DataTransformerException  when the transformation fails
+     */
     public function transform($data)
     {
         return $this->transform->__invoke($data);
     }
 
+    /**
+     * Transforms a value from the transformed representation to its original
+     * representation.
+     *
+     * @param  mixed $value              The value in the transformed representation
+     *
+     * @return mixed                     The value in the original representation
+     *
+     * @throws UnexpectedTypeException   when the argument is not of the expected type
+     * @throws DataTransformerException  when the transformation fails
+     */
     public function reverseTransform($data)
     {
         return $this->reverseTransform->__invoke($data);

+ 7 - 3
src/Symfony/Component/Form/DataTransformerInterface.php

@@ -40,8 +40,10 @@ interface DataTransformerInterface
      * passed.
      *
      * @param  mixed $value              The value in the original representation
+     *
      * @return mixed                     The value in the transformed representation
-     * @throws UnexpectedTypeException   when the argument is no string
+     *
+     * @throws UnexpectedTypeException   when the argument is not a string
      * @throws DataTransformerException  when the transformation fails
      */
     function transform($value);
@@ -65,8 +67,10 @@ interface DataTransformerInterface
      * is passed.
      *
      * @param  mixed $value              The value in the transformed representation
-     * @throws UnexpectedTypeException   when the argument is not of the
-     *                                   expected type
+     *
+     * @return mixed                     The value in the original representation
+     *
+     * @throws UnexpectedTypeException   when the argument is not of the expected type
      * @throws DataTransformerException  when the transformation fails
      */
     function reverseTransform($value);

+ 4 - 4
src/Symfony/Component/Form/Form.php

@@ -77,7 +77,7 @@ class Form implements \IteratorAggregate, FormInterface
 
     /**
      * The children of this form
-     * @var array
+     * @var array An array of FormInterface instances
      */
     private $children = array();
 
@@ -89,7 +89,7 @@ class Form implements \IteratorAggregate, FormInterface
 
     /**
      * The errors of this form
-     * @var array
+     * @var array An array of FromError instances
      */
     private $errors = array();
 
@@ -165,7 +165,7 @@ class Form implements \IteratorAggregate, FormInterface
 
     /**
      * The validators attached to this form
-     * @var array
+     * @var array An array of FormValidatorInterface instances
      */
     private $validators;
 
@@ -252,7 +252,7 @@ class Form implements \IteratorAggregate, FormInterface
     }
 
     /**
-     * Returns the supported types.
+     * Returns the types used by this form.
      *
      * @return array An array of FormTypeInterface
      */

+ 36 - 0
src/Symfony/Component/Form/FormExtensionInterface.php

@@ -11,15 +11,51 @@
 
 namespace Symfony\Component\Form;
 
+/**
+ * Interface for extensions which provide types, type extensions and a guesser.
+ */
 interface FormExtensionInterface
 {
+    /**
+     * Returns a type by name.
+     *
+     * @param string $name The name of the type
+     *
+     * @return FormTypeInterface The type
+     */
     function getType($name);
 
+    /**
+     * Returns whether the given type is supported.
+     *
+     * @param string $name The name of the type
+     *
+     * @return Boolean Whether the type is supported by this extension
+     */
     function hasType($name);
 
+    /**
+     * Returns the extensions for the given type.
+     *
+     * @param string $name The name of the type
+     *
+     * @return array An array of extensions as FormTypeExtensionInterface instances
+     */
     function getTypeExtensions($name);
 
+    /**
+     * Returns whether this extension provides type extensions for the given type.
+     *
+     * @param string $name The name of the type
+     *
+     * @return Boolean Whether the given type has extensions
+     */
     function hasTypeExtensions($name);
 
+    /**
+     * Returns the type guesser provided by this extension.
+     *
+     * @return FormTypeGuesserInterface|null The type guesser
+     */
     function getTypeGuesser();
 }

+ 107 - 4
src/Symfony/Component/Form/FormFactory.php

@@ -16,10 +16,22 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
 
 class FormFactory implements FormFactoryInterface
 {
+    /**
+     * Extensions
+     * @var array An array of FormExtensionInterface
+     */
     private $extensions = array();
 
+    /**
+     * All known types (cache)
+     * @var array An array of FormTypeInterface
+     */
     private $types = array();
 
+    /**
+     * The guesser chain
+     * @var FormTypeGuesserChain
+     */
     private $guesser;
 
     /**
@@ -40,6 +52,17 @@ class FormFactory implements FormFactoryInterface
         $this->extensions = $extensions;
     }
 
+    /**
+     * Returns a type by name.
+     *
+     * This methods registers the type extensions from the form extensions.
+     *
+     * @param string|FormTypeInterface $name The name of the type or a type instance
+     *
+     * @return FormTypeInterface The type
+     *
+     * @throws FormException if the type can not be retrieved from any extension
+     */
     public function getType($name)
     {
         $type = null;
@@ -80,24 +103,74 @@ class FormFactory implements FormFactoryInterface
         return $this->types[$name];
     }
 
+    /**
+     * Returns a form.
+     *
+     * @see createBuilder()
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return Form The form named after the type
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     public function create($type, $data = null, array $options = array())
     {
         return $this->createBuilder($type, $data, $options)->getForm();
     }
 
+    /**
+     * Returns a form.
+     *
+     * @see createNamedBuilder()
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return Form The form
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     public function createNamed($type, $name, $data = null, array $options = array())
     {
         return $this->createNamedBuilder($type, $name, $data, $options)->getForm();
     }
 
     /**
-     * @inheritDoc
+     * Returns a form for a property of a class.
+     *
+     * @see createBuilderForProperty()
+     *
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     * @param mixed  $data      The initial data
+     * @param array  $options   The options for the builder
+     *
+     * @return Form The form named after the property
+     *
+     * @throws FormException if any given option is not applicable to the form type
      */
     public function createForProperty($class, $property, $data = null, array $options = array())
     {
         return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
     }
 
+    /**
+     * Returns a form builder
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return FormBuilder The form builder
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     public function createBuilder($type, $data = null, array $options = array())
     {
         $name = is_object($type) ? $type->getName() : $type;
@@ -105,6 +178,18 @@ class FormFactory implements FormFactoryInterface
         return $this->createNamedBuilder($type, $name, $data, $options);
     }
 
+    /**
+     * Returns a form builder.
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return FormBuilder The form builder
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     public function createNamedBuilder($type, $name, $data = null, array $options = array())
     {
         $builder = null;
@@ -131,10 +216,10 @@ class FormFactory implements FormFactoryInterface
             $type = $type->getParent($options);
         }
 
-        $diff = array_diff($passedOptions, $knownOptions);
+        $extraOptions = array_diff($passedOptions, $knownOptions);
 
-        if (count($diff) > 0) {
-            throw new FormException(sprintf('The options "%s" do not exist', implode('", "', $diff)));
+        if (count($extraOptions) > 0) {
+            throw new FormException(sprintf('The options "%s" do not exist', implode('", "', $extraOptions)));
         }
 
         for ($i = 0, $l = count($types); $i < $l && !$builder; ++$i) {
@@ -156,6 +241,21 @@ class FormFactory implements FormFactoryInterface
         return $builder;
     }
 
+    /**
+     * Returns a form builder for a property of a class.
+     *
+     * If any of the 'max_length', 'required' and type options can be guessed,
+     * and are not provided in the options argument, the guessed value is used.
+     *
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     * @param mixed  $data      The initial data
+     * @param array  $options   The options for the builder
+     *
+     * @return FormBuilder The form builder named after the property
+     *
+     * @throws FormException if any given option is not applicable to the form type
+     */
     public function createBuilderForProperty($class, $property, $data = null, array $options = array())
     {
         if (!$this->guesser) {
@@ -184,6 +284,9 @@ class FormFactory implements FormFactoryInterface
         return $this->createNamedBuilder($type, $property, $data, $options);
     }
 
+    /**
+     * Initializes the guesser chain.
+     */
     private function loadGuesser()
     {
         $guessers = array();

+ 76 - 0
src/Symfony/Component/Form/FormFactoryInterface.php

@@ -13,15 +13,91 @@ namespace Symfony\Component\Form;
 
 interface FormFactoryInterface
 {
+    /**
+     * Returns a form.
+     *
+     * @see createBuilder()
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return Form The form named after the type
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     function create($type, $data = null, array $options = array());
 
+    /**
+     * Returns a form.
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return Form The form
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     function createNamed($type, $name, $data = null, array $options = array());
 
+    /**
+     * Returns a form for a property of a class.
+     *
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     * @param mixed  $data      The initial data
+     * @param array  $options   The options for the builder
+     *
+     * @return Form The form named after the property
+     *
+     * @throws FormException if any given option is not applicable to the form type
+     */
     function createForProperty($class, $property, $data = null, array $options = array());
 
+    /**
+     * Returns a form builder
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return FormBuilder The form builder
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     function createBuilder($type, $data = null, array $options = array());
 
+    /**
+     * Returns a form builder.
+     *
+     * @param string|FormTypeInterface  $type       The type of the form
+     * @param string                    $name       The name of the form
+     * @param mixed                     $data       The initial data
+     * @param array                     $options    The options
+     *
+     * @return FormBuilder The form builder
+     *
+     * @throws FormException if any given option is not applicable to the given type
+     */
     function createNamedBuilder($type, $name, $data = null, array $options = array());
 
+    /**
+     * Returns a form builder for a property of a class.
+     *
+     * If any of the 'max_length', 'required' and type options can be guessed,
+     * and are not provided in the options argument, the guessed value is used.
+     *
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     * @param mixed  $data      The initial data
+     * @param array  $options   The options for the builder
+     *
+     * @return FormBuilder The form builder named after the property
+     *
+     * @throws FormException if any given option is not applicable to the form type
+     */
     function createBuilderForProperty($class, $property, $data = null, array $options = array());
 }

+ 5 - 5
src/Symfony/Component/Form/FormInterface.php

@@ -21,14 +21,14 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
     /**
      * Sets the parent form.
      *
-     * @param FormInterface $parent  The parent form
+     * @param FormInterface $parent The parent form
      */
     function setParent(FormInterface $parent = null);
 
     /**
      * Returns the parent form.
      *
-     * @return FormInterface  The parent form
+     * @return FormInterface The parent form
      */
     function getParent();
 
@@ -49,7 +49,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
     /**
      * Returns whether a child with the given name exists.
      *
-     * @param  string $name
+     * @param string $name
      *
      * @return Boolean
      */
@@ -65,7 +65,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
     /**
      * Returns all children in this group.
      *
-     * @return array
+     * @return array An array of FormInterface instances
      */
     function getChildren();
 
@@ -79,7 +79,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
     /**
      * Returns all errors.
      *
-     * @return array  An array of FormError instances that occurred during binding
+     * @return array An array of FormError instances that occurred during binding
      */
     function getErrors();
 

+ 45 - 0
src/Symfony/Component/Form/FormTypeExtensionInterface.php

@@ -13,13 +13,58 @@ namespace Symfony\Component\Form;
 
 interface FormTypeExtensionInterface
 {
+    /**
+     * Builds the form.
+     *
+     * This method gets called after the extended type has built the form to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildForm()
+     *
+     * @param FormBuilder   $builder The form builder
+     * @param array         $options The options
+     */
     function buildForm(FormBuilder $builder, array $options);
 
+    /**
+     * Builds the view.
+     *
+     * This method gets called after the extended type has built the view to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildView()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     function buildView(FormView $view, FormInterface $form);
 
+    /**
+     * Builds the view.
+     *
+     * This method gets called after the extended type has built the view to
+     * further modify it.
+     *
+     * @see FormTypeInterface::buildViewBottomUp()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     function buildViewBottomUp(FormView $view, FormInterface $form);
 
+    /**
+     * Overrides the default options form the extended type.
+     *
+     * @param array $options
+     *
+     * @return array
+     */
     function getDefaultOptions(array $options);
 
+    /**
+     * Returns the name of the type being extended
+     *
+     * @return string The name of the type being extended
+     */
     function getExtendedType();
 }

+ 1 - 0
src/Symfony/Component/Form/FormTypeGuesserChain.php

@@ -67,6 +67,7 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
      *
      * @param  \Closure $closure  The closure to execute. Accepts a guesser
      *                            as argument and should return a Guess instance
+     * 
      * @return FieldFactoryGuess  The guess with the highest confidence
      */
     private function guess(\Closure $closure)

+ 10 - 7
src/Symfony/Component/Form/FormTypeGuesserInterface.php

@@ -16,17 +16,19 @@ interface FormTypeGuesserInterface
     /**
      * Returns a field guess for a property name of a class
      *
-     * @param  string $class           The fully qualified class name
-     * @param  string $property        The name of the property to guess for
-     * @return TypeGuess  A guess for the field's type and options
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     *
+     * @return TypeGuess A guess for the field's type and options
      */
     function guessType($class, $property);
 
     /**
      * Returns a guess whether a property of a class is required
      *
-     * @param  string $class      The fully qualified class name
-     * @param  string $property   The name of the property to guess for
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     *
      * @return Guess  A guess for the field's required setting
      */
     function guessRequired($class, $property);
@@ -34,8 +36,9 @@ interface FormTypeGuesserInterface
     /**
      * Returns a guess about the field's maximum length
      *
-     * @param  string $class      The fully qualified class name
-     * @param  string $property   The name of the property to guess for
+     * @param string $class     The fully qualified class name
+     * @param string $property  The name of the property to guess for
+     *
      * @return Guess  A guess for the field's maximum length
      */
     function guessMaxLength($class, $property);

+ 40 - 1
src/Symfony/Component/Form/FormTypeInterface.php

@@ -13,10 +13,49 @@ namespace Symfony\Component\Form;
 
 interface FormTypeInterface
 {
+    /**
+     * Builds the form.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the form.
+     *
+     * @see FormTypeExtensionInterface::buildForm()
+     *
+     * @param FormBuilder   $builder The form builder
+     * @param array         $options The options
+     */
     function buildForm(FormBuilder $builder, array $options);
 
+    /**
+     * Builds the form view.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the view.
+     *
+     * @see FormTypeExtensionInterface::buildView()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     function buildView(FormView $view, FormInterface $form);
 
+    /**
+     * Builds the form view.
+     *
+     * This method gets called for each type in the hierarchy starting form the
+     * top most type.
+     * Type extensions can further modify the view.
+     *
+     * Children views have been built when this method gets called so you get
+     * a chance to modify them.
+     *
+     * @see FormTypeExtensionInterface::buildViewBottomUp()
+     *
+     * @param FormView      $view The view
+     * @param FormInterface $form The form
+     */
     function buildViewBottomUp(FormView $view, FormInterface $form);
 
     function createBuilder($name, FormFactoryInterface $factory, array $options);
@@ -35,7 +74,7 @@ interface FormTypeInterface
      *
      * @param array $options
      *
-     * @return string The name of the parent type
+     * @return string|null The name of the parent type if any otherwise null
      */
     function getParent(array $options);
 

+ 1 - 1
src/Symfony/Component/Form/Guess/TypeGuess.php

@@ -34,7 +34,7 @@ class TypeGuess extends Guess
     /**
      * Constructor
      *
-     * @param string $type    The guessed field type
+     * @param string $type          The guessed field type
      * @param array  $options       The options for creating instances of the
      *                              guessed class
      * @param integer $confidence   The confidence that the guessed class name