mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +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:
19
system/libs/Twig/Node/Expression/Test/Constant.php → system/libs/Twig/Node/Expression/Test/ConstantTest.php
Executable file → Normal file
19
system/libs/Twig/Node/Expression/Test/Constant.php → system/libs/Twig/Node/Expression/Test/ConstantTest.php
Executable file → Normal file
@@ -9,20 +9,23 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a variable is the exact same value as a constant.
|
||||
*
|
||||
* <pre>
|
||||
* {% if post.status is constant('Post::PUBLISHED') %}
|
||||
* the status attribute is exactly the same as Post::PUBLISHED
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {% if post.status is constant('Post::PUBLISHED') %}
|
||||
* the status attribute is exactly the same as Post::PUBLISHED
|
||||
* {% endif %}
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
|
||||
class ConstantTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(')
|
||||
@@ -45,4 +48,4 @@ class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Constant', 'Twig\Node\Expression\Test\ConstantTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\ConstantTest', 'Twig_Node_Expression_Test_Constant');
|
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if a variable is defined in the current context.
|
||||
*
|
||||
* <pre>
|
||||
* {# defined works with variable names and variable attributes #}
|
||||
* {% if foo is defined %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test
|
||||
{
|
||||
public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
|
||||
{
|
||||
if ($node instanceof Twig_Node_Expression_Name) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof Twig_Node_Expression_GetAttr) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
$this->changeIgnoreStrictCheck($node);
|
||||
} elseif ($node instanceof Twig_Node_Expression_BlockReference) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof Twig_Node_Expression_Function && 'constant' === $node->getAttribute('name')) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) {
|
||||
$node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine());
|
||||
} else {
|
||||
throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getTemplateLine());
|
||||
}
|
||||
|
||||
parent::__construct($node, $name, $arguments, $lineno);
|
||||
}
|
||||
|
||||
protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node)
|
||||
{
|
||||
$node->setAttribute('ignore_strict_check', true);
|
||||
|
||||
if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) {
|
||||
$this->changeIgnoreStrictCheck($node->getNode('node'));
|
||||
}
|
||||
}
|
||||
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
{
|
||||
$compiler->subcompile($this->getNode('node'));
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Defined', 'Twig\Node\Expression\Test\DefinedTest', false);
|
71
system/libs/Twig/Node/Expression/Test/DefinedTest.php
Normal file
71
system/libs/Twig/Node/Expression/Test/DefinedTest.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Error\SyntaxError;
|
||||
use Twig\Node\Expression\ArrayExpression;
|
||||
use Twig\Node\Expression\BlockReferenceExpression;
|
||||
use Twig\Node\Expression\ConstantExpression;
|
||||
use Twig\Node\Expression\FunctionExpression;
|
||||
use Twig\Node\Expression\GetAttrExpression;
|
||||
use Twig\Node\Expression\NameExpression;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a variable is defined in the current context.
|
||||
*
|
||||
* {# defined works with variable names and variable attributes #}
|
||||
* {% if foo is defined %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class DefinedTest extends TestExpression
|
||||
{
|
||||
public function __construct(\Twig_NodeInterface $node, $name, \Twig_NodeInterface $arguments = null, $lineno)
|
||||
{
|
||||
if ($node instanceof NameExpression) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof GetAttrExpression) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
$this->changeIgnoreStrictCheck($node);
|
||||
} elseif ($node instanceof BlockReferenceExpression) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof FunctionExpression && 'constant' === $node->getAttribute('name')) {
|
||||
$node->setAttribute('is_defined_test', true);
|
||||
} elseif ($node instanceof ConstantExpression || $node instanceof ArrayExpression) {
|
||||
$node = new ConstantExpression(true, $node->getTemplateLine());
|
||||
} else {
|
||||
throw new SyntaxError('The "defined" test only works with simple variables.', $lineno);
|
||||
}
|
||||
|
||||
parent::__construct($node, $name, $arguments, $lineno);
|
||||
}
|
||||
|
||||
protected function changeIgnoreStrictCheck(GetAttrExpression $node)
|
||||
{
|
||||
$node->setAttribute('ignore_strict_check', true);
|
||||
|
||||
if ($node->getNode('node') instanceof GetAttrExpression) {
|
||||
$this->changeIgnoreStrictCheck($node->getNode('node'));
|
||||
}
|
||||
}
|
||||
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler->subcompile($this->getNode('node'));
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig\Node\Expression\Test\DefinedTest', 'Twig_Node_Expression_Test_Defined');
|
13
system/libs/Twig/Node/Expression/Test/Divisibleby.php → system/libs/Twig/Node/Expression/Test/DivisiblebyTest.php
Executable file → Normal file
13
system/libs/Twig/Node/Expression/Test/Divisibleby.php → system/libs/Twig/Node/Expression/Test/DivisiblebyTest.php
Executable file → Normal file
@@ -9,18 +9,21 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a variable is divisible by a number.
|
||||
*
|
||||
* <pre>
|
||||
* {% if loop.index is divisible by(3) %}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test
|
||||
class DivisiblebyTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(0 == ')
|
||||
@@ -32,4 +35,4 @@ class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Divisibleby', 'Twig\Node\Expression\Test\DivisiblebyTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\DivisiblebyTest', 'Twig_Node_Expression_Test_Divisibleby');
|
13
system/libs/Twig/Node/Expression/Test/Even.php → system/libs/Twig/Node/Expression/Test/EvenTest.php
Executable file → Normal file
13
system/libs/Twig/Node/Expression/Test/Even.php → system/libs/Twig/Node/Expression/Test/EvenTest.php
Executable file → Normal file
@@ -9,18 +9,21 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a number is even.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is even }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test
|
||||
class EvenTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(')
|
||||
@@ -31,4 +34,4 @@ class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Even', 'Twig\Node\Expression\Test\EvenTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\EvenTest', 'Twig_Node_Expression_Test_Even');
|
13
system/libs/Twig/Node/Expression/Test/Null.php → system/libs/Twig/Node/Expression/Test/NullTest.php
Executable file → Normal file
13
system/libs/Twig/Node/Expression/Test/Null.php → system/libs/Twig/Node/Expression/Test/NullTest.php
Executable file → Normal file
@@ -9,18 +9,21 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks that a variable is null.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is none }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
|
||||
class NullTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(null === ')
|
||||
@@ -30,4 +33,4 @@ class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Null', 'Twig\Node\Expression\Test\NullTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\NullTest', 'Twig_Node_Expression_Test_Null');
|
13
system/libs/Twig/Node/Expression/Test/Odd.php → system/libs/Twig/Node/Expression/Test/OddTest.php
Executable file → Normal file
13
system/libs/Twig/Node/Expression/Test/Odd.php → system/libs/Twig/Node/Expression/Test/OddTest.php
Executable file → Normal file
@@ -9,18 +9,21 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a number is odd.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is odd }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test
|
||||
class OddTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(')
|
||||
@@ -31,4 +34,4 @@ class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Odd', 'Twig\Node\Expression\Test\OddTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\OddTest', 'Twig_Node_Expression_Test_Odd');
|
11
system/libs/Twig/Node/Expression/Test/Sameas.php → system/libs/Twig/Node/Expression/Test/SameasTest.php
Executable file → Normal file
11
system/libs/Twig/Node/Expression/Test/Sameas.php → system/libs/Twig/Node/Expression/Test/SameasTest.php
Executable file → Normal file
@@ -9,14 +9,19 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node\Expression\Test;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
|
||||
/**
|
||||
* Checks if a variable is the same as another one (=== in PHP).
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
|
||||
class SameasTest extends TestExpression
|
||||
{
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(')
|
||||
@@ -28,4 +33,4 @@ class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Node_Expression_Test_Sameas', 'Twig\Node\Expression\Test\SameasTest', false);
|
||||
class_alias('Twig\Node\Expression\Test\SameasTest', 'Twig_Node_Expression_Test_Sameas');
|
Reference in New Issue
Block a user