bug #16615 fix type assignement (rande)

This PR was squashed before being merged into the 3.0-dev branch (closes #16615).

Discussion
----------

fix type assignement

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

This PR make sure the original key is used when the type is resolved. Also the code now respect the PHPDoc.

Commits
-------

cc26454 fix type assignement
This commit is contained in:
Fabien Potencier 2015-11-25 16:48:43 +01:00
commit cd0ffc9a41

View File

@ -88,7 +88,7 @@ class FormRegistry implements FormRegistryInterface
} }
} }
$this->resolveAndAddType($type); $this->types[$name] = $this->resolveType($type);
} }
return $this->types[$name]; return $this->types[$name];
@ -102,7 +102,7 @@ class FormRegistry implements FormRegistryInterface
* *
* @return ResolvedFormTypeInterface The resolved type. * @return ResolvedFormTypeInterface The resolved type.
*/ */
private function resolveAndAddType(FormTypeInterface $type) private function resolveType(FormTypeInterface $type)
{ {
$typeExtensions = array(); $typeExtensions = array();
$parentType = $type->getParent(); $parentType = $type->getParent();
@ -115,13 +115,11 @@ class FormRegistry implements FormRegistryInterface
); );
} }
$resolvedType = $this->resolvedTypeFactory->createResolvedType( return $this->resolvedTypeFactory->createResolvedType(
$type, $type,
$typeExtensions, $typeExtensions,
$parentType ? $this->getType($parentType) : null $parentType ? $this->getType($parentType) : null
); );
$this->types[$fqcn] = $resolvedType;
} }
/** /**