Skip to content

Commit

Permalink
minor #16568 [Form] Enhance some FormRegistry deprecation messages (n…
Browse files Browse the repository at this point in the history
…icolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Enhance some FormRegistry deprecation messages

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

Commits
-------

02d2148 [Form] Enhance some FormRegistry deprecation messages
  • Loading branch information
Tobion committed Nov 17, 2015
2 parents cfc1e3a + 02d2148 commit 1760838
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Expand Up @@ -67,7 +67,7 @@ public function process(ContainerBuilder $container)
@trigger_error('The alias option of the form.type_extension tag is deprecated since version 2.8 and will be removed in 3.0. Use the extended_type option instead.', E_USER_DEPRECATED);
$extendedType = $tag[0]['alias'];
} else {
@trigger_error('The extended_type option of the form.type_extension tag is required since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The extended_type option of the form.type_extension tag is required since version 2.8.', E_USER_DEPRECATED);
$extendedType = $serviceId;
}

Expand Down
13 changes: 5 additions & 8 deletions src/Symfony/Component/Form/FormRegistry.php
Expand Up @@ -120,22 +120,19 @@ private function resolveAndAddType(FormTypeInterface $type)
$hasCustomName = $name !== $fqcn;

if ($parentType instanceof FormTypeInterface) {
@trigger_error('Returning a FormTypeInterface from FormTypeInterface::getParent() is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error(sprintf('Returning a FormTypeInterface from %s::getParent() is deprecated since version 2.8 and will be removed in 3.0. Return the fully-qualified type class name instead.', $fqcn), E_USER_DEPRECATED);

$this->resolveAndAddType($parentType);
$parentType = $parentType->getName();
}

if ($hasCustomName) {
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
$extension->getTypeExtensions($name)
);
}
if ($x = $extension->getTypeExtensions($name)) {
@trigger_error(sprintf('Returning a type name from %s::getExtendedType() is deprecated since version 2.8 and will be removed in 3.0. Return the fully-qualified type class name instead.', get_class($x[0])), E_USER_DEPRECATED);

if ($typeExtensions) {
@trigger_error('Returning a type name from FormTypeExtensionInterface::getExtendedType() is deprecated since version 2.8 and will be removed in 3.0. Return the fully-qualified type class name instead.', E_USER_DEPRECATED);
$typeExtensions = array_merge($typeExtensions, $x);
}
}
}

Expand Down

0 comments on commit 1760838

Please sign in to comment.