mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 19:23:27 +02: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,17 +9,23 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Util;
|
||||
|
||||
use Twig\Environment;
|
||||
use Twig\Error\SyntaxError;
|
||||
use Twig\Source;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Twig_Util_DeprecationCollector
|
||||
class DeprecationCollector
|
||||
{
|
||||
private $twig;
|
||||
private $deprecations;
|
||||
|
||||
public function __construct(Twig_Environment $twig)
|
||||
public function __construct(Environment $twig)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
}
|
||||
@@ -34,32 +40,32 @@ class Twig_Util_DeprecationCollector
|
||||
*/
|
||||
public function collectDir($dir, $ext = '.twig')
|
||||
{
|
||||
$iterator = new RegexIterator(
|
||||
new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY
|
||||
$iterator = new \RegexIterator(
|
||||
new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY
|
||||
), '{'.preg_quote($ext).'$}'
|
||||
);
|
||||
|
||||
return $this->collect(new Twig_Util_TemplateDirIterator($iterator));
|
||||
return $this->collect(new TemplateDirIterator($iterator));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns deprecations for passed templates.
|
||||
*
|
||||
* @param Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template)
|
||||
* @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template)
|
||||
*
|
||||
* @return array An array of deprecations
|
||||
*/
|
||||
public function collect(Traversable $iterator)
|
||||
public function collect(\Traversable $iterator)
|
||||
{
|
||||
$this->deprecations = array();
|
||||
$this->deprecations = [];
|
||||
|
||||
set_error_handler(array($this, 'errorHandler'));
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
|
||||
foreach ($iterator as $name => $contents) {
|
||||
try {
|
||||
$this->twig->parse($this->twig->tokenize(new Twig_Source($contents, $name)));
|
||||
} catch (Twig_Error_Syntax $e) {
|
||||
$this->twig->parse($this->twig->tokenize(new Source($contents, $name)));
|
||||
} catch (SyntaxError $e) {
|
||||
// ignore templates containing syntax errors
|
||||
}
|
||||
}
|
||||
@@ -67,7 +73,7 @@ class Twig_Util_DeprecationCollector
|
||||
restore_error_handler();
|
||||
|
||||
$deprecations = $this->deprecations;
|
||||
$this->deprecations = array();
|
||||
$this->deprecations = [];
|
||||
|
||||
return $deprecations;
|
||||
}
|
||||
@@ -83,4 +89,4 @@ class Twig_Util_DeprecationCollector
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Util_DeprecationCollector', 'Twig\Util\DeprecationCollector', false);
|
||||
class_alias('Twig\Util\DeprecationCollector', 'Twig_Util_DeprecationCollector');
|
||||
|
Reference in New Issue
Block a user