minor #31779 [Form] do not iterate twice on the extended types (Tobion)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Form] do not iterate twice on the extended types

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

Simplification of #31703

Commits
-------

75179d3114 [Form] do not iterate twice on the extended types
This commit is contained in:
Nicolas Grekas 2019-06-01 08:55:32 +02:00
commit 371dfc7f45

View File

@ -175,12 +175,7 @@ abstract class AbstractExtension implements FormExtensionInterface
throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface');
}
$extendedTypes = [];
foreach ($extension::getExtendedTypes() as $extendedType) {
$extendedTypes[] = $extendedType;
}
foreach ($extendedTypes as $extendedType) {
$this->typeExtensions[$extendedType][] = $extension;
}
}