Update Twig to v2.15.4

This commit is contained in:
slawkens
2023-02-02 10:37:45 +01:00
parent e552bcfe82
commit 130f7ba405
309 changed files with 3802 additions and 4005 deletions

View File

@@ -14,14 +14,14 @@ namespace Twig\Profiler;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
* @final since Twig 2.4.0
*/
class Profile implements \IteratorAggregate, \Serializable
{
const ROOT = 'ROOT';
const BLOCK = 'block';
const TEMPLATE = 'template';
const MACRO = 'macro';
public const ROOT = 'ROOT';
public const BLOCK = 'block';
public const TEMPLATE = 'template';
public const MACRO = 'macro';
private $template;
private $name;
@@ -30,8 +30,12 @@ class Profile implements \IteratorAggregate, \Serializable
private $ends = [];
private $profiles = [];
public function __construct($template = 'main', $type = self::ROOT, $name = 'main')
public function __construct(string $template = 'main', string $type = self::ROOT, string $name = 'main')
{
if (__CLASS__ !== static::class) {
@trigger_error('Overriding '.__CLASS__.' is deprecated since Twig 2.4.0 and the class will be final in 3.0.', \E_USER_DEPRECATED);
}
$this->template = $template;
$this->type = $type;
$this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name;
@@ -153,17 +157,18 @@ class Profile implements \IteratorAggregate, \Serializable
$this->enter();
}
public function getIterator()
#[\ReturnTypeWillChange]
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->profiles);
}
public function serialize()
public function serialize(): string
{
return serialize($this->__serialize());
}
public function unserialize($data)
public function unserialize($data): void
{
$this->__unserialize(unserialize($data));
}
@@ -171,7 +176,7 @@ class Profile implements \IteratorAggregate, \Serializable
/**
* @internal
*/
public function __serialize()
public function __serialize(): array
{
return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles];
}
@@ -179,7 +184,7 @@ class Profile implements \IteratorAggregate, \Serializable
/**
* @internal
*/
public function __unserialize(array $data)
public function __unserialize(array $data): void
{
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data;
}