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:
@@ -10,6 +10,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig;
|
||||
|
||||
/**
|
||||
* Represents a Token.
|
||||
*
|
||||
@@ -17,7 +19,7 @@
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Twig_Token
|
||||
class Token
|
||||
{
|
||||
protected $value;
|
||||
protected $type;
|
||||
@@ -36,6 +38,7 @@ class Twig_Token
|
||||
const PUNCTUATION_TYPE = 9;
|
||||
const INTERPOLATION_START_TYPE = 10;
|
||||
const INTERPOLATION_END_TYPE = 11;
|
||||
const ARROW_TYPE = 12;
|
||||
|
||||
/**
|
||||
* @param int $type The type of the token
|
||||
@@ -62,21 +65,21 @@ class Twig_Token
|
||||
* * type and value (or array of possible values)
|
||||
* * just value (or array of possible values) (NAME_TYPE is used as type)
|
||||
*
|
||||
* @param array|int $type The type to test
|
||||
* @param array|string|int $type The type to test
|
||||
* @param array|string|null $values The token value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function test($type, $values = null)
|
||||
{
|
||||
if (null === $values && !is_int($type)) {
|
||||
if (null === $values && !\is_int($type)) {
|
||||
$values = $type;
|
||||
$type = self::NAME_TYPE;
|
||||
}
|
||||
|
||||
return ($this->type === $type) && (
|
||||
null === $values ||
|
||||
(is_array($values) && in_array($this->value, $values)) ||
|
||||
(\is_array($values) && \in_array($this->value, $values)) ||
|
||||
$this->value == $values
|
||||
);
|
||||
}
|
||||
@@ -155,11 +158,14 @@ class Twig_Token
|
||||
case self::INTERPOLATION_END_TYPE:
|
||||
$name = 'INTERPOLATION_END_TYPE';
|
||||
break;
|
||||
case self::ARROW_TYPE:
|
||||
$name = 'ARROW_TYPE';
|
||||
break;
|
||||
default:
|
||||
throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
|
||||
throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type));
|
||||
}
|
||||
|
||||
return $short ? $name : 'Twig_Token::'.$name;
|
||||
return $short ? $name : 'Twig\Token::'.$name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,10 +204,12 @@ class Twig_Token
|
||||
return 'begin of string interpolation';
|
||||
case self::INTERPOLATION_END_TYPE:
|
||||
return 'end of string interpolation';
|
||||
case self::ARROW_TYPE:
|
||||
return 'arrow function';
|
||||
default:
|
||||
throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
|
||||
throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig_Token', 'Twig\Token', false);
|
||||
class_alias('Twig\Token', 'Twig_Token');
|
||||
|
||||
Reference in New Issue
Block a user