mirror of
https://github.com/slawkens/myaac.git
synced 2025-11-29 06:36:51 +01:00
Update Twig from 1.35.0 to 1.42.4 (PHP 5.5 is now required!)
This fixes some errors on PHP 7.4 and contains even more fixes Also bumped PHP version to 5.5 as Twig requires it.
This commit is contained in:
@@ -9,12 +9,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Profiler;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
class Profile implements \IteratorAggregate, \Serializable
|
||||
{
|
||||
const ROOT = 'ROOT';
|
||||
const BLOCK = 'block';
|
||||
@@ -24,9 +26,9 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
private $template;
|
||||
private $name;
|
||||
private $type;
|
||||
private $starts = array();
|
||||
private $ends = array();
|
||||
private $profiles = array();
|
||||
private $starts = [];
|
||||
private $ends = [];
|
||||
private $profiles = [];
|
||||
|
||||
public function __construct($template = 'main', $type = self::ROOT, $name = 'main')
|
||||
{
|
||||
@@ -76,7 +78,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
return $this->profiles;
|
||||
}
|
||||
|
||||
public function addProfile(Twig_Profiler_Profile $profile)
|
||||
public function addProfile(self $profile)
|
||||
{
|
||||
$this->profiles[] = $profile;
|
||||
}
|
||||
@@ -84,7 +86,7 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
/**
|
||||
* Returns the duration in microseconds.
|
||||
*
|
||||
* @return int
|
||||
* @return float
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
@@ -126,11 +128,11 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
*/
|
||||
public function enter()
|
||||
{
|
||||
$this->starts = array(
|
||||
$this->starts = [
|
||||
'wt' => microtime(true),
|
||||
'mu' => memory_get_usage(),
|
||||
'pmu' => memory_get_peak_usage(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,33 +140,49 @@ class Twig_Profiler_Profile implements IteratorAggregate, Serializable
|
||||
*/
|
||||
public function leave()
|
||||
{
|
||||
$this->ends = array(
|
||||
$this->ends = [
|
||||
'wt' => microtime(true),
|
||||
'mu' => memory_get_usage(),
|
||||
'pmu' => memory_get_peak_usage(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->starts = $this->ends = $this->profiles = array();
|
||||
$this->starts = $this->ends = $this->profiles = [];
|
||||
$this->enter();
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->profiles);
|
||||
return new \ArrayIterator($this->profiles);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles));
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data);
|
||||
$this->__unserialize(unserialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data;
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Profiler_Profile', 'Twig\Profiler\Profile', false);
|
||||
class_alias('Twig\Profiler\Profile', 'Twig_Profiler_Profile');
|
||||
|
||||
Reference in New Issue
Block a user