10000 [Form] fix PhpDoc by Tobion · Pull Request #4353 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] fix PhpDoc #4353

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
May 22, 2012
Merged
Show file tree
Hide file tree
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
30 changes: 5 additions & 25 deletions src/Symfony/Component/Form/AbstractExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ abstract class AbstractExtension implements FormExtensionInterface
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
* {@inheritdoc}
*/
public function getType($name)
{
Expand All @@ -66,11 +60,7 @@ public 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
* {@inheritdoc}
*/
public function hasType($name)
{
Expand All @@ -82,11 +72,7 @@ public 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
* {@inheritdoc}
*/
public function getTypeExtensions($name)
{
Expand All @@ -100,11 +86,7 @@ public 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
* {@inheritdoc}
*/
public function hasTypeExtensions($name)
{
Expand All @@ -116,9 +98,7 @@ public function hasTypeExtensions($name)
}

/**
* Returns the type guesser provided by this extension.
*
* @return FormTypeGuesserInterface|null The type guesser
* {@inheritdoc}
*/
public function getTypeGuesser()
{
Expand Down
71 changes: 9 additions & 62 deletions src/Symfony/Component/Form/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,111 +22,60 @@ abstract class AbstractType implements FormTypeInterface
private $extensions = array();

/**
* Builds the form.
*
* This method gets called for each type in the hierarchy starting from 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
* {@inheritdoc}
*/
public function buildForm(FormBuilder $builder, array $options)
{
}

/**
* Builds the form view.
*
* This method gets called for each type in the hierarchy starting from the
* top most type.
* Type extensions can further modify the view.
*
* @see FormTypeExtensionInterface::buildView()
*
* @param FormView $view The view
* @param FormInterface $form The form
* {@inheritdoc}
*/
public function buildView(FormView $view, FormInterface $form)
{
}

/**
* Builds the form view.
*
* This method gets called for each type in the hierarchy starting from 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
* {@inheritdoc}
*/
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
* {@inheritdoc}
*/
public function createBuilder($name, FormFactoryInterface $factory, array $options)
{
return null;
}

/**
* Returns the default options for this type.
*
* @return array The default options
* {@inheritdoc}
*/
public function getDefaultOptions()
{
return array();
}

/**
* Returns the allowed option values for each option (if any).
*
* @return array The allowed option values
* {@inheritdoc}
*/
public function getAllowedOptionValues()
{
return array();
}

/**
* Returns the name of the parent type.
*
* @param array $options
*
* @return string|null The name of the parent type if any otherwise null
* {@inheritdoc}
*/
public function getParent(array $options)
{
return 'form';
}

/**
* Adds extensions for this type.
*
* @param array $extensions An array of FormTypeExtensionInterface
*
* @throws UnexpectedTypeException if any extension does not implement FormTypeExtensionInterface
* {@inheritdoc}
*/
public function setExtensions(array $extensions)
{
Expand All @@ -140,9 +89,7 @@ public function setExtensions(array $extensions)
}

/**
* Returns the extensions associated with this type.
*
* @return array An array of FormTypeExtensionInterface
* {@inheritdoc}
*/
public function getExtensions()
{
Expand Down
38 changes: 5 additions & 33 deletions src/Symfony/Component/Form/AbstractTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,64 +14,36 @@
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
* {@inheritdoc}
*/
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
* {@inheritdoc}
*/
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
* {@inheritdoc}
*/
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
}

/**
* Overrides the default options form the extended type.
*
* @return array
* {@inheritdoc}
*/
public function getDefaultOptions()
{
return array();
}

/**
* Returns the allowed option values for each option (if any).
*
* @return array The allowed option values
* {@inheritdoc}
*/
public function getAllowedOptionValues()
{
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Form/DataMapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

interface DataMapperInterface
{
/**
* @param dataClass $data
* @param array $forms
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
*/
function mapDataToForms($data, array $forms);

function mapDataToForm($data, FormInterface $form);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ public function __construct($dataClass = null)
}

/**
* @param dataClass $data
* @param array $forms
*
* @throws UnexpectedTypeException if the type of the data parameter is not supported
* {@inheritdoc}
*/
public function mapDataToForms($data, array $forms)
{
Expand All @@ -56,6 +53,9 @@ public function mapDataToForms($data, array $forms)
}
}

/**
* {@inheritdoc}
*/
public function mapDataToForm($data, FormInterface $form)
{
if (!empty($data)) {
Expand All @@ -73,6 +73,9 @@ public function mapDataToForm($data, FormInterface $form)
}
}

/**
* {@inheritdoc}
*/
public function mapFormsToData(array $forms, &$data)
{
$iterator = new VirtualFormAwareIterator($forms);
Expand All @@ -83,6 +86,9 @@ public function mapFormsToData(array $forms, &$data)
}
}

/**
* {@inheritdoc}
*/
public function mapFormToData(FormInterface $form, &$data)
{
$propertyPath = $form->getAttribute('property_path');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Form\AbstractExtension;

/**
* This extension protects forms by using a CSRF token
* This extension protects forms by using a CSRF token.
*/
class CsrfExtension extends AbstractExtension
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;

/**
* Default implementation of CsrfProviderInterface
* Default implementation of CsrfProviderInterface.
*
* This provider uses the session ID returned by session_id() as well as a
* user-defined secret value to secure the CSRF token.
Expand Down Expand Up @@ -57,11 +57,11 @@ public function isCsrfTokenValid($intention, $token)
}

/**
* Returns the ID of the user session
* Returns the ID of the user session.
*
* Automatically starts the session if necessary.
*
* @return string The session ID
* @return string The session ID
*/
protected function getSessionId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

/**
* This provider uses a Symfony2 Session object to retrieve the user's
* session ID
* session ID.
*
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
* @see DefaultCsrfProvider
*
* @see DefaultCsrfProvider
* @author Bernhard Schussek <bernhard.schussek@symfony.com>
*/
class SessionCsrfProvider extends DefaultCsrfProvider
{
Expand All @@ -30,7 +30,7 @@ class SessionCsrfProvider extends DefaultCsrfProvider
protected $session;

/**
* Initializes the provider with a Session object and a secret value
* Initializes the provider with a Session object and a secret value.
*
* A recommended value for the secret is a generated value with at least
* 32 characters and mixed letters, digits and special characters.
Expand All @@ -46,11 +46,7 @@ public function __construct(Session $session, $secret)
}

/**
* Returns the ID of the user session
*
* Automatically starts the session if necessary.
*
* @return string The session ID
* {@inheritdoc}
*/
protected function getSessionId()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Form/FormExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ interface FormExtensionInterface
* @param string $name The name of the type
*
* @return FormTypeInterface The type
*
* @throws Exception\FormException if the given type is not supported by this extension
*/
function getType($name);

Expand Down
Loading
0