vendor/sonata-project/twig-extensions/src/Node/DeprecatedTemplateNode.php line 38

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of the Sonata Project package.
  5.  *
  6.  * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Sonata\Twig\Node;
  12. use Twig\Compiler;
  13. use Twig\Node\Expression\AbstractExpression;
  14. use Twig\Node\Node;
  15. /**
  16.  * @author Marko Kunic <kunicmarko20@gmail.com>
  17.  *
  18.  * @final since sonata-project/twig-extensions 0.x
  19.  */
  20. class DeprecatedTemplateNode extends Node
  21. {
  22.     public function __construct(AbstractExpression $newTemplate$line$tag null)
  23.     {
  24.         parent::__construct(['newTemplate' => $newTemplate], [], $line$tag);
  25.     }
  26.     public function compile(Compiler $compiler)
  27.     {
  28.         @trigger_error(sprintf(
  29.             'The "%s" template is deprecated. Use "%s" instead.',
  30.             $this->getTemplateName(),
  31.             $this->getNode('newTemplate')->getAttribute('value')
  32.         ), E_USER_DEPRECATED);
  33.     }
  34. }