From 02d2148f370d45f846e75e94c1335b667f9c8358 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 16 Nov 2015 20:24:50 +0100 Subject: [PATCH] [Form] Enhance some FormRegistry deprecation messages --- .../DependencyInjection/Compiler/FormPass.php | 2 +- src/Symfony/Component/Form/FormRegistry.php | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php index 4b36468aa3..c5d639b808 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php @@ -67,7 +67,7 @@ class FormPass implements CompilerPassInterface @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; } diff --git a/src/Symfony/Component/Form/FormRegistry.php b/src/Symfony/Component/Form/FormRegistry.php index 66d5a1f7c2..a8995afe89 100644 --- a/src/Symfony/Component/Form/FormRegistry.php +++ b/src/Symfony/Component/Form/FormRegistry.php @@ -120,7 +120,7 @@ class FormRegistry implements FormRegistryInterface $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(); @@ -128,14 +128,11 @@ class FormRegistry implements FormRegistryInterface 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); + } } }