Fixes more deprecation notices as per @stof review.
This commit is contained in:
parent
fd47c07253
commit
f9fbb4f55e
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\TwigBundle\Extension;
|
namespace Symfony\Bundle\TwigBundle\Extension;
|
||||||
|
|
||||||
trigger_error('The '.__NAMESPACE__.'\ActionsExtension class is deprecated since version 2.2 and will be removed in Symfony 3.0.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
|
use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
||||||
@ -31,14 +29,14 @@ class ActionsExtension extends \Twig_Extension
|
|||||||
/**
|
/**
|
||||||
* @param FragmentHandler|ContainerInterface $handler
|
* @param FragmentHandler|ContainerInterface $handler
|
||||||
*
|
*
|
||||||
* @deprecated Passing a ContainerInterface as a first argument is deprecated as of 2.7 and will be removed in 3.0.
|
* @deprecated Passing a ContainerInterface as a first argument is deprecated since 2.7 and will be removed in 3.0.
|
||||||
*/
|
*/
|
||||||
public function __construct($handler)
|
public function __construct($handler)
|
||||||
{
|
{
|
||||||
if ($handler instanceof FragmentHandler) {
|
if ($handler instanceof FragmentHandler) {
|
||||||
$this->handler = $handler;
|
$this->handler = $handler;
|
||||||
} elseif ($handler instanceof ContainerInterface) {
|
} elseif ($handler instanceof ContainerInterface) {
|
||||||
trigger_error(sprintf('The ability to pass a ContainerInterface instance as a first argument to %s was deprecated in 2.7 and will be removed in 3.0. Please, pass a FragmentHandler instance instead.', __METHOD__), E_USER_DEPRECATED);
|
trigger_error('The ability to pass a ContainerInterface instance as a first argument to '.__METHOD__.' method is deprecated since version 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 {
|
||||||
|
@ -42,23 +42,23 @@ class TwigEngine extends BaseEngine implements EngineInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since version 2.3, to be removed in 3.0.
|
* @deprecated since version 2.7, to be removed in 3.0.
|
||||||
* Inject the escaping strategy on \Twig_Environment instead.
|
* Inject the escaping strategy on \Twig_Environment instead.
|
||||||
*/
|
*/
|
||||||
public function setDefaultEscapingStrategy($strategy)
|
public function setDefaultEscapingStrategy($strategy)
|
||||||
{
|
{
|
||||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED);
|
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
|
$this->environment->getExtension('escaper')->setDefaultStrategy($strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since version 2.3, to be removed in 3.0.
|
* @deprecated since version 2.7, to be removed in 3.0.
|
||||||
* Use TwigDefaultEscapingStrategy instead.
|
* Use TwigDefaultEscapingStrategy instead.
|
||||||
*/
|
*/
|
||||||
public function guessDefaultEscapingStrategy($filename)
|
public function guessDefaultEscapingStrategy($filename)
|
||||||
{
|
{
|
||||||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy::guess method instead.', E_USER_DEPRECATED);
|
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy::guess method instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
return TwigDefaultEscapingStrategy::guess($filename);
|
return TwigDefaultEscapingStrategy::guess($filename);
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,4 @@ namespace Symfony\Component\Form\Util;
|
|||||||
*/
|
*/
|
||||||
class InheritDataAwareIterator extends VirtualFormAwareIterator
|
class InheritDataAwareIterator extends VirtualFormAwareIterator
|
||||||
{
|
{
|
||||||
public function __construct(\Traversable $iterator)
|
|
||||||
{
|
|
||||||
// Do not trigger deprecation notice in parent construct method
|
|
||||||
// when using this class instead of the deprecated parent one.
|
|
||||||
parent::__construct($iterator, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,15 @@ namespace Symfony\Component\Form\Util;
|
|||||||
*/
|
*/
|
||||||
class VirtualFormAwareIterator extends \IteratorIterator implements \RecursiveIterator
|
class VirtualFormAwareIterator extends \IteratorIterator implements \RecursiveIterator
|
||||||
{
|
{
|
||||||
public function __construct(\Traversable $iterator, $triggerDeprecationNotice = true)
|
public function __construct(\Traversable $iterator)
|
||||||
{
|
{
|
||||||
/**
|
/*
|
||||||
* Prevent to trigger deprecation notice when already using the
|
* Prevent to trigger deprecation notice when already using the
|
||||||
* InheritDataAwareIterator class that extends this deprecated one.
|
* InheritDataAwareIterator class that extends this deprecated one.
|
||||||
* The {@link Symfony\Component\Form\Util\InheritDataAwareIterator::__construct} method
|
* The {@link Symfony\Component\Form\Util\InheritDataAwareIterator::__construct} method
|
||||||
* forces this argument to false.
|
* forces this argument to false.
|
||||||
*/
|
*/
|
||||||
if ($triggerDeprecationNotice) {
|
if (__CLASS__ === get_class($this)) {
|
||||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\Util\InheritDataAwareIterator class instead.', E_USER_DEPRECATED);
|
trigger_error('The '.__CLASS__.' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\Util\InheritDataAwareIterator class instead.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +187,6 @@ class ExecutionContext implements ExecutionContextInterface
|
|||||||
// API, as they are not present in the new interface anymore.
|
// API, as they are not present in the new interface anymore.
|
||||||
// You should use buildViolation() instead.
|
// You should use buildViolation() instead.
|
||||||
if (func_num_args() > 2) {
|
if (func_num_args() > 2) {
|
||||||
trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
|
|
||||||
|
|
||||||
throw new BadMethodCallException(
|
throw new BadMethodCallException(
|
||||||
'The parameters $invalidValue, $plural and $code are '.
|
'The parameters $invalidValue, $plural and $code are '.
|
||||||
'not supported anymore as of Symfony 2.5. Please use '.
|
'not supported anymore as of Symfony 2.5. Please use '.
|
||||||
@ -288,11 +286,7 @@ class ExecutionContext implements ExecutionContextInterface
|
|||||||
*/
|
*/
|
||||||
public function getClassName()
|
public function getClassName()
|
||||||
{
|
{
|
||||||
if ($this->metadata instanceof ClassBasedInterface) {
|
return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null;
|
||||||
return $this->metadata->getClassName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,9 +99,7 @@ interface ExecutionContextInterface
|
|||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*
|
*
|
||||||
* @deprecated since version 2.5.
|
* @deprecated the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0.
|
||||||
* The parameters $invalidValue, $plural and $code will be removed
|
|
||||||
* in 3.0.
|
|
||||||
*/
|
*/
|
||||||
public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null);
|
public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null);
|
||||||
|
|
||||||
|
@ -46,9 +46,7 @@ class Yaml
|
|||||||
*
|
*
|
||||||
* @throws ParseException If the YAML is not valid
|
* @throws ParseException If the YAML is not valid
|
||||||
*
|
*
|
||||||
* @deprecated since version 2.2, to be removed in 3.0.
|
* @deprecated The ability to pass file names to the Yaml::parse method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.
|
||||||
* The ability to pass file names to the parse() method is
|
|
||||||
* deprecated. Pass the YAML contents of the file instead.
|
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user