improve deprecation messages

This commit is contained in:
Christian Flothmann 2018-07-05 19:06:52 +02:00
parent 1da4252262
commit 39cb2a99ba
2 changed files with 2 additions and 4 deletions

View File

@ -38,8 +38,6 @@ class ActionsExtension extends AbstractExtension
if ($handler instanceof FragmentHandler) { if ($handler instanceof FragmentHandler) {
$this->handler = $handler; $this->handler = $handler;
} elseif ($handler instanceof ContainerInterface) { } elseif ($handler instanceof ContainerInterface) {
@trigger_error('The ability to pass a ContainerInterface instance as a first argument to '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0. Pass a FragmentHandler instance instead.', E_USER_DEPRECATED);
$this->handler = $handler->get('fragment.handler'); $this->handler = $handler->get('fragment.handler');
} else { } else {
throw new \BadFunctionCallException(sprintf('%s takes a FragmentHandler or a ContainerInterface object as its first argument.', __METHOD__)); throw new \BadFunctionCallException(sprintf('%s takes a FragmentHandler or a ContainerInterface object as its first argument.', __METHOD__));

View File

@ -158,7 +158,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
*/ */
public function setCamelizedAttributes(array $camelizedAttributes) public function setCamelizedAttributes(array $camelizedAttributes)
{ {
@trigger_error(sprintf('%s is deprecated since Symfony 2.7 and will be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 2.7 and will be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', __METHOD__), E_USER_DEPRECATED);
if ($this->nameConverter && !$this->nameConverter instanceof CamelCaseToSnakeCaseNameConverter) { if ($this->nameConverter && !$this->nameConverter instanceof CamelCaseToSnakeCaseNameConverter) {
throw new LogicException(sprintf('%s cannot be called if a custom Name Converter is defined.', __METHOD__)); throw new LogicException(sprintf('%s cannot be called if a custom Name Converter is defined.', __METHOD__));
@ -237,7 +237,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
*/ */
protected function formatAttribute($attributeName) protected function formatAttribute($attributeName)
{ {
@trigger_error(sprintf('%s is deprecated since Symfony 2.7 and will be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', __METHOD__), E_USER_DEPRECATED); @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 2.7 and will be removed in 3.0. Use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter instead.', __METHOD__), E_USER_DEPRECATED);
return $this->nameConverter ? $this->nameConverter->normalize($attributeName) : $attributeName; return $this->nameConverter ? $this->nameConverter->normalize($attributeName) : $attributeName;
} }