minor #11358 [2.3][Form] Cleanup & fix phpdocs (stloyd)
This PR was merged into the 2.3 branch.
Discussion
----------
[2.3][Form] Cleanup & fix phpdocs
| Q | A
| ------------- | ---
| Bug fix? | kinda
| New feature? | no
| BC breaks? | no
| Tests pass? | yes
| License | MIT
This PR was done mostly cause of reports about invalid/not supported types/variables in phpstorm/scrutinizer-ci, and after I started fixing I noticed more problems in those phpdocs so I have cleanedup them a bit.
Commits
-------
a67bc76
[2.3][Form] Cleanup & fix phpdocs
This commit is contained in:
commit
d15fe34c0b
@ -455,8 +455,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
||||
*
|
||||
* @param FormFactoryInterface $formFactory
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function setFormFactory(FormFactoryInterface $formFactory)
|
||||
|
@ -21,7 +21,6 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
*/
|
||||
class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
|
||||
{
|
||||
|
||||
private $divisor;
|
||||
|
||||
public function __construct($precision = null, $grouping = null, $roundingMode = null, $divisor = null)
|
||||
@ -46,7 +45,7 @@ class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransform
|
||||
/**
|
||||
* Transforms a normalized format into a localized money string.
|
||||
*
|
||||
* @param number $value Normalized number
|
||||
* @param int|float $value Normalized number
|
||||
*
|
||||
* @return string Localized money string.
|
||||
*
|
||||
@ -71,7 +70,7 @@ class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransform
|
||||
*
|
||||
* @param string $value Localized money string
|
||||
*
|
||||
* @return number Normalized number
|
||||
* @return int|float Normalized number
|
||||
*
|
||||
* @throws TransformationFailedException If the given value is not a string
|
||||
* or if the value can not be transformed.
|
||||
|
@ -66,9 +66,9 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
||||
/**
|
||||
* Transforms between a normalized format (integer or float) into a percentage value.
|
||||
*
|
||||
* @param number $value Normalized value
|
||||
* @param int|float $value Normalized value
|
||||
*
|
||||
* @return number Percentage value
|
||||
* @return string Percentage value
|
||||
*
|
||||
* @throws TransformationFailedException If the given value is not numeric or
|
||||
* if the value could not be transformed.
|
||||
@ -101,9 +101,9 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
||||
/**
|
||||
* Transforms between a percentage value into a normalized format (integer or float).
|
||||
*
|
||||
* @param number $value Percentage value.
|
||||
* @param string $value Percentage value.
|
||||
*
|
||||
* @return number Normalized value.
|
||||
* @return int|float Normalized value.
|
||||
*
|
||||
* @throws TransformationFailedException If the given value is not a string or
|
||||
* if the value could not be transformed.
|
||||
|
@ -198,6 +198,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
*/
|
||||
public function getFormConfig()
|
||||
{
|
||||
/** @var $config self */
|
||||
$config = parent::getFormConfig();
|
||||
|
||||
$config->children = array();
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\PropertyAccess\PropertyPathInterface;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -88,7 +89,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
||||
* Sets the value for an attribute.
|
||||
*
|
||||
* @param string $name The name of the attribute
|
||||
* @param string $value The value of the attribute
|
||||
* @param mixed $value The value of the attribute
|
||||
*
|
||||
* @return self The configuration object.
|
||||
*/
|
||||
@ -151,7 +152,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
||||
/**
|
||||
* Sets the property path that the form should be mapped to.
|
||||
*
|
||||
* @param null|string|\Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath
|
||||
* @param null|string|PropertyPathInterface $propertyPath
|
||||
* The property path or null if the path should be set
|
||||
* automatically based on the form's name.
|
||||
*
|
||||
|
@ -11,6 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\PropertyAccess\PropertyPathInterface;
|
||||
|
||||
/**
|
||||
* The configuration of a {@link Form} object.
|
||||
*
|
||||
@ -21,7 +24,7 @@ interface FormConfigInterface
|
||||
/**
|
||||
* Returns the event dispatcher used to dispatch form events.
|
||||
*
|
||||
* @return \Symfony\Component\EventDispatcher\EventDispatcherInterface The dispatcher.
|
||||
* @return EventDispatcherInterface The dispatcher.
|
||||
*/
|
||||
public function getEventDispatcher();
|
||||
|
||||
@ -35,7 +38,7 @@ interface FormConfigInterface
|
||||
/**
|
||||
* Returns the property path that the form should be mapped to.
|
||||
*
|
||||
* @return null|\Symfony\Component\PropertyAccess\PropertyPathInterface The property path.
|
||||
* @return null|PropertyPathInterface The property path.
|
||||
*/
|
||||
public function getPropertyPath();
|
||||
|
||||
|
@ -24,22 +24,22 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
||||
private $resolvedTypeFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var FormExtensionInterface[]
|
||||
*/
|
||||
private $extensions = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var FormTypeInterface[]
|
||||
*/
|
||||
private $types = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var FormTypeExtensionInterface[]
|
||||
*/
|
||||
private $typeExtensions = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var FormTypeGuesserInterface[]
|
||||
*/
|
||||
private $typeGuessers = array();
|
||||
|
||||
|
@ -30,7 +30,7 @@ class FormRegistry implements FormRegistryInterface
|
||||
private $extensions = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var FormTypeInterface[]
|
||||
*/
|
||||
private $types = array();
|
||||
|
||||
@ -74,11 +74,9 @@ class FormRegistry implements FormRegistryInterface
|
||||
}
|
||||
|
||||
if (!isset($this->types[$name])) {
|
||||
/** @var FormTypeInterface $type */
|
||||
$type = null;
|
||||
|
||||
foreach ($this->extensions as $extension) {
|
||||
/* @var FormExtensionInterface $extension */
|
||||
if ($extension->hasType($name)) {
|
||||
$type = $extension->getType($name);
|
||||
break;
|
||||
@ -115,7 +113,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
$typeExtensions = array();
|
||||
|
||||
foreach ($this->extensions as $extension) {
|
||||
/* @var FormExtensionInterface $extension */
|
||||
$typeExtensions = array_merge(
|
||||
$typeExtensions,
|
||||
$extension->getTypeExtensions($type->getName())
|
||||
@ -156,7 +153,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
$guessers = array();
|
||||
|
||||
foreach ($this->extensions as $extension) {
|
||||
/* @var FormExtensionInterface $extension */
|
||||
$guesser = $extension->getTypeGuesser();
|
||||
|
||||
if ($guesser) {
|
||||
|
@ -70,19 +70,15 @@ interface FormRendererEngineInterface
|
||||
* The type of the resource is decided by the implementation. The resource
|
||||
* is later passed to {@link renderBlock()} by the rendering algorithm.
|
||||
*
|
||||
* @param FormView $view The view for determining the
|
||||
* used themes. First the themes
|
||||
* attached directly to the view
|
||||
* with {@link setTheme()} are
|
||||
* considered, then the ones of
|
||||
* its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with
|
||||
* the root block at the beginning.
|
||||
* @param int $hierarchyLevel The level in the hierarchy at
|
||||
* which to start looking. Level 0
|
||||
* indicates the root block, i.e.
|
||||
* the first element of
|
||||
* $blockNameHierarchy.
|
||||
* @param FormView $view The view for determining the used themes.
|
||||
* First the themes attached directly to
|
||||
* the view with {@link setTheme()} are
|
||||
* considered, then the ones of its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with the root block
|
||||
* at the beginning.
|
||||
* @param int $hierarchyLevel The level in the hierarchy at which to start
|
||||
* looking. Level 0 indicates the root block, i.e.
|
||||
* the first element of $blockNameHierarchy.
|
||||
*
|
||||
* @return mixed The renderer resource or false, if none was found.
|
||||
*/
|
||||
@ -114,19 +110,15 @@ interface FormRendererEngineInterface
|
||||
* The type of the resource is decided by the implementation. The resource
|
||||
* is later passed to {@link renderBlock()} by the rendering algorithm.
|
||||
*
|
||||
* @param FormView $view The view for determining the
|
||||
* used themes. First the themes
|
||||
* attached directly to the view
|
||||
* with {@link setTheme()} are
|
||||
* considered, then the ones of
|
||||
* its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with
|
||||
* the root block at the beginning.
|
||||
* @param int $hierarchyLevel The level in the hierarchy at
|
||||
* which to start looking. Level 0
|
||||
* indicates the root block, i.e.
|
||||
* the first element of
|
||||
* $blockNameHierarchy.
|
||||
* @param FormView $view The view for determining the used themes.
|
||||
* First the themes attached directly to
|
||||
* the view with {@link setTheme()} are
|
||||
* considered, then the ones of its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with the root block
|
||||
* at the beginning.
|
||||
* @param int $hierarchyLevel The level in the hierarchy at which to start
|
||||
* looking. Level 0 indicates the root block, i.e.
|
||||
* the first element of $blockNameHierarchy.
|
||||
*
|
||||
* @return int|bool The hierarchy level or false, if no resource was found.
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
|
||||
/**
|
||||
* The child views.
|
||||
* @var array
|
||||
* @var FormView[]
|
||||
*/
|
||||
public $children = array();
|
||||
|
||||
|
@ -103,8 +103,8 @@ abstract class Guess
|
||||
/**
|
||||
* Returns the confidence that the guessed value is correct.
|
||||
*
|
||||
* @return int One of the constants VERY_HIGH_CONFIDENCE,
|
||||
* HIGH_CONFIDENCE, MEDIUM_CONFIDENCE and LOW_CONFIDENCE
|
||||
* @return int One of the constants VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE,
|
||||
* MEDIUM_CONFIDENCE and LOW_CONFIDENCE
|
||||
*/
|
||||
public function getConfidence()
|
||||
{
|
||||
|
@ -21,12 +21,12 @@ use Symfony\Component\Form\Exception\InvalidArgumentException;
|
||||
class PreloadedExtension implements FormExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
* @var FormTypeInterface[]
|
||||
*/
|
||||
private $types = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array[FormTypeExtensionInterface[]]
|
||||
*/
|
||||
private $typeExtensions = array();
|
||||
|
||||
|
@ -158,7 +158,6 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
$this->innerType->buildForm($builder, $options);
|
||||
|
||||
foreach ($this->typeExtensions as $extension) {
|
||||
/* @var FormTypeExtensionInterface $extension */
|
||||
$extension->buildForm($builder, $options);
|
||||
}
|
||||
}
|
||||
@ -184,7 +183,6 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
$this->innerType->buildView($view, $form, $options);
|
||||
|
||||
foreach ($this->typeExtensions as $extension) {
|
||||
/* @var FormTypeExtensionInterface $extension */
|
||||
$extension->buildView($view, $form, $options);
|
||||
}
|
||||
}
|
||||
@ -235,7 +233,6 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
$this->innerType->setDefaultOptions($this->optionsResolver);
|
||||
|
||||
foreach ($this->typeExtensions as $extension) {
|
||||
/* @var FormTypeExtensionInterface $extension */
|
||||
$extension->setDefaultOptions($this->optionsResolver);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* A wrapper for a form type and its extensions.
|
||||
*
|
||||
@ -100,7 +102,7 @@ interface ResolvedFormTypeInterface
|
||||
/**
|
||||
* Returns the configured options resolver used for this type.
|
||||
*
|
||||
* @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver.
|
||||
* @return OptionsResolverInterface The options resolver.
|
||||
*/
|
||||
public function getOptionsResolver();
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Form\Test;
|
||||
|
||||
interface FormBuilderInterface extends \Iterator, \Symfony\Component\Form\FormBuilderInterface
|
||||
use Symfony\Component\Form\FormBuilderInterface as BaseFormBuilderInterface;
|
||||
|
||||
interface FormBuilderInterface extends \Iterator, BaseFormBuilderInterface
|
||||
{
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Form\Test;
|
||||
|
||||
use Symfony\Component\Form\Forms;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -19,7 +20,7 @@ use Symfony\Component\Form\Forms;
|
||||
abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\Form\FormFactoryInterface
|
||||
* @var FormFactoryInterface
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Form\Test;
|
||||
|
||||
interface FormInterface extends \Iterator, \Symfony\Component\Form\FormInterface
|
||||
use Symfony\Component\Form\FormInterface as BaseFormInterface;
|
||||
|
||||
interface FormInterface extends \Iterator, BaseFormInterface
|
||||
{
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
|
||||
protected $maxRunningTime = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function runTest()
|
||||
{
|
||||
@ -48,6 +49,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
|
||||
|
||||
/**
|
||||
* @param int $maxRunningTime
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setMaxRunningTime($maxRunningTime)
|
||||
@ -60,8 +62,9 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @since Method available since Release 2.3.0
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxRunningTime()
|
||||
{
|
||||
|
Reference in New Issue
Block a user