mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
Update Twig to v2.15.4
This commit is contained in:
@@ -17,13 +17,10 @@ use Twig\Source;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class DeprecationCollector
|
||||
final class DeprecationCollector
|
||||
{
|
||||
private $twig;
|
||||
private $deprecations;
|
||||
|
||||
public function __construct(Environment $twig)
|
||||
{
|
||||
@@ -58,9 +55,12 @@ class DeprecationCollector
|
||||
*/
|
||||
public function collect(\Traversable $iterator)
|
||||
{
|
||||
$this->deprecations = [];
|
||||
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
$deprecations = [];
|
||||
set_error_handler(function ($type, $msg) use (&$deprecations) {
|
||||
if (\E_USER_DEPRECATED === $type) {
|
||||
$deprecations[] = $msg;
|
||||
}
|
||||
});
|
||||
|
||||
foreach ($iterator as $name => $contents) {
|
||||
try {
|
||||
@@ -72,21 +72,8 @@ class DeprecationCollector
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
$deprecations = $this->deprecations;
|
||||
$this->deprecations = [];
|
||||
|
||||
return $deprecations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function errorHandler($type, $msg)
|
||||
{
|
||||
if (E_USER_DEPRECATED === $type) {
|
||||
$this->deprecations[] = $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig\Util\DeprecationCollector', 'Twig_Util_DeprecationCollector');
|
||||
|
@@ -16,11 +16,19 @@ namespace Twig\Util;
|
||||
*/
|
||||
class TemplateDirIterator extends \IteratorIterator
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return file_get_contents(parent::current());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return (string) parent::key();
|
||||
|
Reference in New Issue
Block a user