minor #23633 [Form] Add some phpdocs for IDE autocompletion and better SCA (Koc)

This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Add some phpdocs for IDE autocompletion and better SCA

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

@ogizanagi I've tryed add single phpdoc `@method FormInterface[] getIterator()` to `FormInterface` but it not works correctly in PHPStorm. Have you any ideas?

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the 3.4,
  legacy code removals go to the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

Commits
-------

d30c751781 Add some phpdocs for IDE autocompletion and better SCA
This commit is contained in:
Fabien Potencier 2017-07-27 08:21:20 +02:00
commit a96d85ecff
3 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@ use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormInterface;
/**
* Resize a collection form element based on the data sent from the client.
@ -146,6 +147,7 @@ class ResizeFormListener implements EventSubscriberInterface
if ($this->deleteEmpty) {
$previousData = $event->getForm()->getData();
/** @var FormInterface $child */
foreach ($form as $name => $child) {
$isNew = !isset($previousData[$name]);

View File

@ -120,6 +120,7 @@ class ChoiceType extends AbstractType
// Reconstruct the data as mapping from child names to values
$data = array();
/** @var FormInterface $child */
foreach ($form as $child) {
$value = $child->getConfig()->getOption('value');

View File

@ -83,6 +83,7 @@ class FormValidator extends ConstraintValidator
} else {
$childrenSynchronized = true;
/** @var FormInterface $child */
foreach ($form as $child) {
if (!$child->isSynchronized()) {
$childrenSynchronized = false;