diff --git a/composer.lock b/composer.lock index d40b0a0..fa73dd4 100644 --- a/composer.lock +++ b/composer.lock @@ -1919,16 +1919,16 @@ }, { "name": "twig/twig", - "version": "v1.22.2", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a" + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/79249fc8c9ff62e41e217e0c630e2e00bcadda6a", - "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", "shasum": "" }, "require": { @@ -1941,7 +1941,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.22-dev" + "dev-master": "1.23-dev" } }, "autoload": { @@ -1976,7 +1976,7 @@ "keywords": [ "templating" ], - "time": "2015-09-22 13:59:32" + "time": "2015-11-05 12:49:06" }, { "name": "wikimedia/composer-merge-plugin", @@ -1988,7 +1988,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/ef66d8b92b741d6278dace3658afc35416831ff1", + "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/f770a4dd9771041f713f5ba3d8e4ba702015653d", "reference": "47bb3388cfeae41a38087ac8465a7d08fa92ea2e", "shasum": "" }, diff --git a/core/composer.json b/core/composer.json index fd33b45..afb170a 100644 --- a/core/composer.json +++ b/core/composer.json @@ -17,7 +17,7 @@ "symfony/validator": "2.7.*", "symfony/process": "2.7.*", "symfony/yaml": "2.7.*", - "twig/twig": "^1.22.2", + "twig/twig": "^1.23.1", "doctrine/common": "2.5.*", "doctrine/annotations": "1.2.*", "guzzlehttp/guzzle": "~6.1", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 430e194..229e817 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -107,7 +107,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/ef66d8b92b741d6278dace3658afc35416831ff1", + "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/f770a4dd9771041f713f5ba3d8e4ba702015653d", "reference": "47bb3388cfeae41a38087ac8465a7d08fa92ea2e", "shasum": "" }, @@ -1178,69 +1178,6 @@ ] }, { - "name": "twig/twig", - "version": "v1.22.2", - "version_normalized": "1.22.2.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/79249fc8c9ff62e41e217e0c630e2e00bcadda6a", - "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a", - "shasum": "" - }, - "require": { - "php": ">=5.2.7" - }, - "require-dev": { - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~2.7" - }, - "time": "2015-09-22 13:59:32", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.22-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ] - }, - { "name": "zendframework/zend-diactoros", "version": "1.1.3", "version_normalized": "1.1.3.0", @@ -3858,5 +3795,68 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com" + }, + { + "name": "twig/twig", + "version": "v1.23.1", + "version_normalized": "1.23.1.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "shasum": "" + }, + "require": { + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~2.7" + }, + "time": "2015-11-05 12:49:06", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.23-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ] } ] diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index 90905c0..e8f9da0 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,24 @@ +* 1.23.1 (2015-XX-XX) + + * fixed some exception messages which triggered PHP warnings + * fixed BC on Twig_Test_NodeTestCase + +* 1.23.0 (2015-10-29) + + * deprecated the possibility to override an extension by registering another one with the same name + * deprecated Twig_ExtensionInterface::getGlobals() (added Twig_Extension_GlobalsInterface for BC) + * deprecated Twig_ExtensionInterface::initRuntime() (added Twig_Extension_InitRuntimeInterface for BC) + * deprecated Twig_Environment::computeAlternatives() + +* 1.22.3 (2015-10-13) + + * fixed regression when using null as a cache strategy + * improved performance when checking template freshness + * fixed warnings when loaded templates do not exist + * fixed template class name generation to prevent possible collisions + * fixed logic for custom escapers to call them even on integers and null values + * changed template cache names to take into account the Twig C extension + * 1.22.2 (2015-09-22) * fixed a race condition in template loading diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json index 5d31ac1..339a5d4 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -40,7 +40,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.22-dev" + "dev-master": "1.23-dev" } } } diff --git a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php b/vendor/twig/twig/lib/Twig/Cache/Filesystem.php index 2e1c0a0..2c2182a 100644 --- a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php +++ b/vendor/twig/twig/lib/Twig/Cache/Filesystem.php @@ -38,7 +38,7 @@ public function generateKey($name, $className) { $hash = hash('sha256', $className); - return $this->directory.'/'.$hash[0].'/'.$hash[1].'/'.$hash.'.php'; + return $this->directory.'/'.$hash[0].$hash[1].'/'.$hash.'.php'; } /** @@ -87,6 +87,10 @@ public function write($key, $content) */ public function getTimestamp($key) { + if (!file_exists($key)) { + return 0; + } + return (int) @filemtime($key); } } diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php index 0c32550..99a6b01 100644 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ b/vendor/twig/twig/lib/Twig/Environment.php @@ -16,7 +16,7 @@ */ class Twig_Environment { - const VERSION = '1.22.2'; + const VERSION = '1.23.1'; protected $charset; protected $loader; @@ -48,6 +48,7 @@ class Twig_Environment private $originalCache; private $bcWriteCacheFile = false; private $bcGetCacheFilename = false; + private $lastModifiedExtension = 0; /** * Constructor. @@ -263,6 +264,10 @@ public function setCache($cache) } elseif (false === $cache) { $this->originalCache = $cache; $this->cache = new Twig_Cache_Null(); + } elseif (null === $cache) { + @trigger_error('Using "null" as the cache strategy is deprecated and will be removed in Twig 2.0.', E_USER_DEPRECATED); + $this->originalCache = false; + $this->cache = new Twig_Cache_Null(); } elseif ($cache instanceof Twig_CacheInterface) { $this->originalCache = $this->cache = $cache; } else { @@ -291,14 +296,22 @@ public function getCacheFilename($name) /** * Gets the template class associated with the given string. * - * @param string $name The name for which to calculate the template class name - * @param int $index The index if it is an embedded template + * The generated template class is based on the following parameters: + * + * * The cache key for the given template; + * * The currently enabled extensions; + * * Whether the Twig C extension is available or not. + * + * @param string $name The name for which to calculate the template class name + * @param int|null $index The index if it is an embedded template * * @return string The template class name */ public function getTemplateClass($name, $index = null) { - $key = $this->getLoader()->getCacheKey($name).'__'.implode('__', array_keys($this->extensions)); + $key = $this->getLoader()->getCacheKey($name); + $key .= json_encode(array_keys($this->extensions)); + $key .= function_exists('twig_template_get_attributes'); return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index); } @@ -446,14 +459,16 @@ public function createTemplate($template) */ public function isTemplateFresh($name, $time) { - foreach ($this->extensions as $extension) { - $r = new ReflectionObject($extension); - if (filemtime($r->getFileName()) > $time) { - return false; + if (0 === $this->lastModifiedExtension) { + foreach ($this->extensions as $extension) { + $r = new ReflectionObject($extension); + if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) { + $this->lastModifiedExtension = $extensionTime; + } } } - return $this->getLoader()->isFresh($name, $time); + return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time); } /** @@ -710,12 +725,22 @@ public function getCharset() /** * Initializes the runtime environment. + * + * @deprecated since 1.23 (to be removed in 2.0) */ public function initRuntime() { $this->runtimeInitialized = true; - foreach ($this->getExtensions() as $extension) { + foreach ($this->getExtensions() as $name => $extension) { + if (!$extension instanceof Twig_Extension_InitRuntimeInterface) { + $m = new ReflectionMethod($extension, 'initRuntime'); + + if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) { + @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED); + } + } + $extension->initRuntime($this); } } @@ -755,11 +780,19 @@ public function getExtension($name) */ public function addExtension(Twig_ExtensionInterface $extension) { + $name = $extension->getName(); + if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); + throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $name)); } - $this->extensions[$extension->getName()] = $extension; + if (isset($this->extensions[$name])) { + @trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $name), E_USER_DEPRECATED); + } + + $this->lastModifiedExtension = 0; + + $this->extensions[$name] = $extension; } /** @@ -1218,24 +1251,28 @@ public function getBinaryOperators() return $this->binaryOperators; } + /** + * @deprecated since 1.23 (to be removed in 2.0) + */ public function computeAlternatives($name, $items) { - $alternatives = array(); - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - asort($alternatives); + @trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - return array_keys($alternatives); + return Twig_Error_Syntax::computeAlternatives($name, $items); } protected function initGlobals() { $globals = array(); - foreach ($this->extensions as $extension) { + foreach ($this->extensions as $name => $extension) { + if (!$extension instanceof Twig_Extension_GlobalsInterface) { + $m = new ReflectionMethod($extension, 'getGlobals'); + + if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) { + @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension is deprecated without explicitly implementing Twig_Extension_GlobalsInterface.', $name), E_USER_DEPRECATED); + } + } + $extGlob = $extension->getGlobals(); if (!is_array($extGlob)) { throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension))); diff --git a/vendor/twig/twig/lib/Twig/Error.php b/vendor/twig/twig/lib/Twig/Error.php index 90650c5..37c7435 100644 --- a/vendor/twig/twig/lib/Twig/Error.php +++ b/vendor/twig/twig/lib/Twig/Error.php @@ -155,6 +155,15 @@ public function __call($method, $arguments) throw new BadMethodCallException(sprintf('Method "Twig_Error::%s()" does not exist.', $method)); } + public function appendMessage($rawMessage) + { + $this->rawMessage .= $rawMessage; + $this->updateRepr(); + } + + /** + * @internal + */ protected function updateRepr() { $this->message = $this->rawMessage; @@ -165,6 +174,12 @@ protected function updateRepr() $dot = true; } + $questionMark = false; + if ('?' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $questionMark = true; + } + if ($this->filename) { if (is_string($this->filename) || (is_object($this->filename) && method_exists($this->filename, '__toString'))) { $filename = sprintf('"%s"', $this->filename); @@ -181,8 +196,15 @@ protected function updateRepr() if ($dot) { $this->message .= '.'; } + + if ($questionMark) { + $this->message .= '?'; + } } + /** + * @internal + */ protected function guessTemplateInfo() { $template = null; diff --git a/vendor/twig/twig/lib/Twig/Error/Syntax.php b/vendor/twig/twig/lib/Twig/Error/Syntax.php index 0f5c579..f73730a 100644 --- a/vendor/twig/twig/lib/Twig/Error/Syntax.php +++ b/vendor/twig/twig/lib/Twig/Error/Syntax.php @@ -17,4 +17,37 @@ */ class Twig_Error_Syntax extends Twig_Error { + /** + * Tweaks the error message to include suggestions. + * + * @param string $name The original name of the item that does not exist + * @param array $items An array of possible items + */ + public function addSuggestions($name, array $items) + { + if (!$alternatives = self::computeAlternatives($name, $items)) { + return; + } + + $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives))); + } + + /** + * @internal + * + * To be merged with the addSuggestions() method in 2.0. + */ + public static function computeAlternatives($name, $items) + { + $alternatives = array(); + foreach ($items as $item) { + $lev = levenshtein($name, $item); + if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = $lev; + } + } + asort($alternatives); + + return array_keys($alternatives); + } } diff --git a/vendor/twig/twig/lib/Twig/ExpressionParser.php b/vendor/twig/twig/lib/Twig/ExpressionParser.php index 322976c..cad11af 100644 --- a/vendor/twig/twig/lib/Twig/ExpressionParser.php +++ b/vendor/twig/twig/lib/Twig/ExpressionParser.php @@ -171,7 +171,7 @@ public function parsePrimaryExpression() $negClass = 'Twig_Node_Expression_Unary_Neg'; $posClass = 'Twig_Node_Expression_Unary_Pos'; if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) { - throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s"', $token->getValue()), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getFilename()); } $this->parser->getStream()->next(); @@ -187,7 +187,7 @@ public function parsePrimaryExpression() } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { $node = $this->parseHashExpression(); } else { - throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getFilename()); } } @@ -278,7 +278,7 @@ public function parseHashExpression() } else { $current = $stream->getCurrent(); - throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $this->parser->getFilename()); } $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); @@ -317,11 +317,11 @@ public function getFunctionNode($name, $line) case 'parent': $this->parseArguments(); if (!count($this->parser->getBlockStack())) { - throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden', $line, $this->parser->getFilename()); + throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden.', $line, $this->parser->getFilename()); } if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden', $line, $this->parser->getFilename()); + throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getFilename()); } return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line); @@ -330,7 +330,7 @@ public function getFunctionNode($name, $line) case 'attribute': $args = $this->parseArguments(); if (count($args) < 2) { - throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes)', $line, $this->parser->getFilename()); + throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getFilename()); } return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_Template::ANY_CALL, $line); @@ -384,13 +384,13 @@ public function parseSubscriptExpression($node) if ($node instanceof Twig_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { if (!$arg instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s")', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); } $name = $arg->getAttribute('value'); if ($this->parser->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword', $name), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $this->parser->getFilename()); } $node = new Twig_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno); @@ -500,7 +500,7 @@ public function parseArguments($namedArguments = false, $definition = false) $name = null; if ($namedArguments && $token = $stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { if (!$value instanceof Twig_Node_Expression_Name) { - throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given', get_class($value)), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given.', get_class($value)), $token->getLine(), $this->parser->getFilename()); } $name = $value->getAttribute('name'); @@ -540,7 +540,7 @@ public function parseAssignmentExpression() while (true) { $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to'); if (in_array($token->getValue(), array('true', 'false', 'none'))) { - throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s"', $token->getValue()), $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s".', $token->getValue()), $token->getLine(), $this->parser->getFilename()); } $targets[] = new Twig_Node_Expression_AssignName($token->getValue(), $token->getLine()); @@ -570,12 +570,10 @@ protected function getFunctionNodeClass($name, $line) $env = $this->parser->getEnvironment(); if (false === $function = $env->getFunction($name)) { - $message = sprintf('The function "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFunctions()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } + $e = new Twig_Error_Syntax(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getFilename()); + $e->addSuggestions($name, array_keys($env->getFunctions())); - throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); + throw $e; } if ($function instanceof Twig_SimpleFunction && $function->isDeprecated()) { @@ -600,12 +598,10 @@ protected function getFilterNodeClass($name, $line) $env = $this->parser->getEnvironment(); if (false === $filter = $env->getFilter($name)) { - $message = sprintf('The filter "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFilters()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } + $e = new Twig_Error_Syntax(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getFilename()); + $e->addSuggestions($name, array_keys($env->getFilters())); - throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); + throw $e; } if ($filter instanceof Twig_SimpleFilter && $filter->isDeprecated()) { diff --git a/vendor/twig/twig/lib/Twig/Extension.php b/vendor/twig/twig/lib/Twig/Extension.php index 5c8ad5c..cb03b3d 100644 --- a/vendor/twig/twig/lib/Twig/Extension.php +++ b/vendor/twig/twig/lib/Twig/Extension.php @@ -11,20 +11,16 @@ abstract class Twig_Extension implements Twig_ExtensionInterface { /** - * Initializes the runtime environment. + * {@inheritdoc} * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead */ public function initRuntime(Twig_Environment $environment) { } /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + * {@inheritdoc} */ public function getTokenParsers() { @@ -32,9 +28,7 @@ public function getTokenParsers() } /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances + * {@inheritdoc} */ public function getNodeVisitors() { @@ -42,9 +36,7 @@ public function getNodeVisitors() } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * {@inheritdoc} */ public function getFilters() { @@ -52,9 +44,7 @@ public function getFilters() } /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests + * {@inheritdoc} */ public function getTests() { @@ -62,9 +52,7 @@ public function getTests() } /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions + * {@inheritdoc} */ public function getFunctions() { @@ -72,9 +60,7 @@ public function getFunctions() } /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators + * {@inheritdoc} */ public function getOperators() { @@ -82,9 +68,9 @@ public function getOperators() } /** - * Returns a list of global variables to add to the existing list. + * {@inheritdoc} * - * @return array An array of global variables + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead */ public function getGlobals() { diff --git a/vendor/twig/twig/lib/Twig/Extension/Core.php b/vendor/twig/twig/lib/Twig/Extension/Core.php index f9ec2a4..0aed990 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Core.php +++ b/vendor/twig/twig/lib/Twig/Extension/Core.php @@ -114,11 +114,6 @@ public function getNumberFormat() return $this->numberFormat; } - /** - * Returns the token parser instance to add to the existing list. - * - * @return Twig_TokenParser[] An array of Twig_TokenParser instances - */ public function getTokenParsers() { return array( @@ -140,11 +135,6 @@ public function getTokenParsers() ); } - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ public function getFilters() { $filters = array( @@ -202,11 +192,6 @@ public function getFilters() return $filters; } - /** - * Returns a list of global functions to add to the existing list. - * - * @return array An array of global functions - */ public function getFunctions() { return array( @@ -222,11 +207,6 @@ public function getFunctions() ); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { return array( @@ -245,11 +225,6 @@ public function getTests() ); } - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ public function getOperators() { return array( @@ -340,12 +315,10 @@ protected function getTest(Twig_Parser $parser, $line) } } - $message = sprintf('The test "%s" does not exist', $name); - if ($alternatives = $env->computeAlternatives($name, array_keys($env->getTests()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } + $e = new Twig_Error_Syntax(sprintf('Unknown "%s" test.', $name), $line, $parser->getFilename()); + $e->addSuggestions($name, array_keys($env->getTests())); - throw new Twig_Error_Syntax($message, $line, $parser->getFilename()); + throw $e; } protected function getTestNodeClass(Twig_Parser $parser, $test) @@ -357,11 +330,6 @@ protected function getTestNodeClass(Twig_Parser $parser, $test) return $test instanceof Twig_Test_Node ? $test->getClass() : 'Twig_Node_Expression_Test'; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ public function getName() { return 'core'; @@ -849,9 +817,10 @@ function twig_join_filter($value, $glue = '') * {# returns [aa, bb, cc] #} * * - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit + * @param Twig_Environment $env A Twig_Environment instance + * @param string $value A string + * @param string $delimiter The delimiter + * @param int $limit The limit * * @return array The split string as an array */ @@ -1021,7 +990,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', if (!is_string($string)) { if (is_object($string) && method_exists($string, '__toString')) { $string = (string) $string; - } else { + } elseif (in_array($strategy, array('html', 'js', 'css', 'html_attr', 'url'))) { return $string; } } @@ -1508,8 +1477,9 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a /** * Returns a template content without rendering it. * - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param Twig_Environment $env + * @param string $name The template name + * @param bool $ignoreMissing Whether to ignore missing templates or not * * @return string The template source */ diff --git a/vendor/twig/twig/lib/Twig/Extension/Debug.php b/vendor/twig/twig/lib/Twig/Extension/Debug.php index 86d07c2..42fdb1e 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Debug.php +++ b/vendor/twig/twig/lib/Twig/Extension/Debug.php @@ -10,11 +10,6 @@ */ class Twig_Extension_Debug extends Twig_Extension { - /** - * Returns a list of global functions to add to the existing list. - * - * @return array An array of global functions - */ public function getFunctions() { // dump is safe if var_dump is overridden by xdebug @@ -32,11 +27,6 @@ public function getFunctions() ); } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ public function getName() { return 'debug'; diff --git a/vendor/twig/twig/lib/Twig/Extension/Escaper.php b/vendor/twig/twig/lib/Twig/Extension/Escaper.php index 053a895..0e06693 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Escaper.php +++ b/vendor/twig/twig/lib/Twig/Extension/Escaper.php @@ -24,31 +24,16 @@ public function __construct($defaultStrategy = 'html') $this->setDefaultStrategy($defaultStrategy); } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ public function getTokenParsers() { return array(new Twig_TokenParser_AutoEscape()); } - /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances - */ public function getNodeVisitors() { return array(new Twig_NodeVisitor_Escaper()); } - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ public function getFilters() { return array( @@ -98,11 +83,6 @@ public function getDefaultStrategy($filename) return $this->defaultStrategy; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ public function getName() { return 'escaper'; diff --git a/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php b/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php new file mode 100644 index 0000000..5370b8e --- /dev/null +++ b/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php @@ -0,0 +1,22 @@ + + */ +interface Twig_Extension_GlobalsInterface +{ +} diff --git a/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php b/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php new file mode 100644 index 0000000..7a07582 --- /dev/null +++ b/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php @@ -0,0 +1,22 @@ + + */ +interface Twig_Extension_InitRuntimeInterface +{ +} diff --git a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php b/vendor/twig/twig/lib/Twig/Extension/Optimizer.php index 013fcb6..5a64a1a 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php +++ b/vendor/twig/twig/lib/Twig/Extension/Optimizer.php @@ -17,17 +17,11 @@ public function __construct($optimizers = -1) $this->optimizers = $optimizers; } - /** - * {@inheritdoc} - */ public function getNodeVisitors() { return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); } - /** - * {@inheritdoc} - */ public function getName() { return 'optimizer'; diff --git a/vendor/twig/twig/lib/Twig/Extension/Profiler.php b/vendor/twig/twig/lib/Twig/Extension/Profiler.php index e21fdb6..4d9f97f 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Profiler.php +++ b/vendor/twig/twig/lib/Twig/Extension/Profiler.php @@ -34,17 +34,11 @@ public function leave(Twig_Profiler_Profile $profile) } } - /** - * {@inheritdoc} - */ public function getNodeVisitors() { return array(new Twig_Profiler_NodeVisitor_Profiler($this->getName())); } - /** - * {@inheritdoc} - */ public function getName() { return 'profiler'; diff --git a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php b/vendor/twig/twig/lib/Twig/Extension/Sandbox.php index 3593e9e..760d123 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/Extension/Sandbox.php @@ -20,21 +20,11 @@ public function __construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandb $this->sandboxedGlobally = $sandboxed; } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ public function getTokenParsers() { return array(new Twig_TokenParser_Sandbox()); } - /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances - */ public function getNodeVisitors() { return array(new Twig_NodeVisitor_Sandbox()); @@ -100,11 +90,6 @@ public function ensureToStringAllowed($obj) return $obj; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ public function getName() { return 'sandbox'; diff --git a/vendor/twig/twig/lib/Twig/Extension/Staging.php b/vendor/twig/twig/lib/Twig/Extension/Staging.php index 583e6a9..d21004d 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Staging.php +++ b/vendor/twig/twig/lib/Twig/Extension/Staging.php @@ -32,9 +32,6 @@ public function addFunction($name, $function) $this->functions[$name] = $function; } - /** - * {@inheritdoc} - */ public function getFunctions() { return $this->functions; @@ -45,9 +42,6 @@ public function addFilter($name, $filter) $this->filters[$name] = $filter; } - /** - * {@inheritdoc} - */ public function getFilters() { return $this->filters; @@ -58,9 +52,6 @@ public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) $this->visitors[] = $visitor; } - /** - * {@inheritdoc} - */ public function getNodeVisitors() { return $this->visitors; @@ -71,9 +62,6 @@ public function addTokenParser(Twig_TokenParserInterface $parser) $this->tokenParsers[] = $parser; } - /** - * {@inheritdoc} - */ public function getTokenParsers() { return $this->tokenParsers; @@ -84,9 +72,6 @@ public function addGlobal($name, $value) $this->globals[$name] = $value; } - /** - * {@inheritdoc} - */ public function getGlobals() { return $this->globals; @@ -97,17 +82,11 @@ public function addTest($name, $test) $this->tests[$name] = $test; } - /** - * {@inheritdoc} - */ public function getTests() { return $this->tests; } - /** - * {@inheritdoc} - */ public function getName() { return 'staging'; diff --git a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php b/vendor/twig/twig/lib/Twig/Extension/StringLoader.php index d96673c..2a3ddb6 100644 --- a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php +++ b/vendor/twig/twig/lib/Twig/Extension/StringLoader.php @@ -10,9 +10,6 @@ */ class Twig_Extension_StringLoader extends Twig_Extension { - /** - * {@inheritdoc} - */ public function getFunctions() { return array( @@ -20,9 +17,6 @@ public function getFunctions() ); } - /** - * {@inheritdoc} - */ public function getName() { return 'string_loader'; diff --git a/vendor/twig/twig/lib/Twig/ExtensionInterface.php b/vendor/twig/twig/lib/Twig/ExtensionInterface.php index 49541b0..5cf3f46 100644 --- a/vendor/twig/twig/lib/Twig/ExtensionInterface.php +++ b/vendor/twig/twig/lib/Twig/ExtensionInterface.php @@ -22,13 +22,15 @@ * This is where you can load some file that contains filter functions for instance. * * @param Twig_Environment $environment The current Twig_Environment instance + * + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterace instead */ public function initRuntime(Twig_Environment $environment); /** * Returns the token parser instances to add to the existing list. * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + * @return Twig_TokenParserInterface[] */ public function getTokenParsers(); @@ -42,21 +44,21 @@ public function getNodeVisitors(); /** * Returns a list of filters to add to the existing list. * - * @return array An array of filters + * @return Twig_SimpleFilter[] */ public function getFilters(); /** * Returns a list of tests to add to the existing list. * - * @return array An array of tests + * @return Twig_SimpleTest[] */ public function getTests(); /** * Returns a list of functions to add to the existing list. * - * @return array An array of functions + * @return Twig_SimpleFunction[] */ public function getFunctions(); @@ -71,6 +73,8 @@ public function getOperators(); * Returns a list of global variables to add to the existing list. * * @return array An array of global variables + * + * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead */ public function getGlobals(); diff --git a/vendor/twig/twig/lib/Twig/Lexer.php b/vendor/twig/twig/lib/Twig/Lexer.php index 75f763f..575b4f3 100644 --- a/vendor/twig/twig/lib/Twig/Lexer.php +++ b/vendor/twig/twig/lib/Twig/Lexer.php @@ -129,7 +129,7 @@ public function tokenize($code, $filename = null) if (!empty($this->brackets)) { list($expect, $lineno) = array_pop($this->brackets); - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->filename); } if ($mbEncoding) { @@ -224,7 +224,7 @@ protected function lexExpression() $this->moveCursor($match[0]); if ($this->cursor >= $this->end) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->filename); } } @@ -256,12 +256,12 @@ protected function lexExpression() // closing bracket elseif (false !== strpos(')]}', $this->code[$this->cursor])) { if (empty($this->brackets)) { - throw new Twig_Error_Syntax(sprintf('Unexpected "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->filename); } list($expect, $lineno) = array_pop($this->brackets); if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->filename); } } @@ -281,7 +281,7 @@ protected function lexExpression() } // unlexable else { - throw new Twig_Error_Syntax(sprintf('Unexpected character "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->filename); } } @@ -292,7 +292,7 @@ protected function lexRawData($tag) } if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block', $tag), $this->lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->filename); } $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); @@ -308,7 +308,7 @@ protected function lexRawData($tag) protected function lexComment() { if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax('Unclosed comment', $this->lineno, $this->filename); + throw new Twig_Error_Syntax('Unclosed comment.', $this->lineno, $this->filename); } $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); @@ -327,7 +327,7 @@ protected function lexString() } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { list($expect, $lineno) = array_pop($this->brackets); if ($this->code[$this->cursor] != '"') { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); + throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->filename); } $this->popState(); diff --git a/vendor/twig/twig/lib/Twig/Node.php b/vendor/twig/twig/lib/Twig/Node.php index 40d67fe..45a8976 100644 --- a/vendor/twig/twig/lib/Twig/Node.php +++ b/vendor/twig/twig/lib/Twig/Node.php @@ -101,7 +101,7 @@ public function toXml($asDom = false) $node->appendChild($child); } - return $asDom ? $dom : $dom->saveXml(); + return $asDom ? $dom : $dom->saveXML(); } public function compile(Twig_Compiler $compiler) diff --git a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php b/vendor/twig/twig/lib/Twig/Node/AutoEscape.php index fcabf90..47cc998 100644 --- a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php +++ b/vendor/twig/twig/lib/Twig/Node/AutoEscape.php @@ -27,11 +27,6 @@ public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'a parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->subcompile($this->getNode('body')); diff --git a/vendor/twig/twig/lib/Twig/Node/Block.php b/vendor/twig/twig/lib/Twig/Node/Block.php index 989e4a0..a05af6f 100644 --- a/vendor/twig/twig/lib/Twig/Node/Block.php +++ b/vendor/twig/twig/lib/Twig/Node/Block.php @@ -22,11 +22,6 @@ public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = nul parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/BlockReference.php index a05ea04..9cd1551 100644 --- a/vendor/twig/twig/lib/Twig/Node/BlockReference.php +++ b/vendor/twig/twig/lib/Twig/Node/BlockReference.php @@ -22,11 +22,6 @@ public function __construct($name, $lineno, $tag = null) parent::__construct(array(), array('name' => $name), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Do.php b/vendor/twig/twig/lib/Twig/Node/Do.php index 9981bc1..14fb84e 100644 --- a/vendor/twig/twig/lib/Twig/Node/Do.php +++ b/vendor/twig/twig/lib/Twig/Node/Do.php @@ -21,11 +21,6 @@ public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php b/vendor/twig/twig/lib/Twig/Node/Expression/Array.php index 6cf7ca1..83e583b 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Array.php @@ -60,11 +60,6 @@ public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $ke array_push($this->nodes, $key, $value); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->raw('array('); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php b/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php index 4d5dbdb..ce0c5fb 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php @@ -12,11 +12,6 @@ class Twig_Node_Expression_AssignName extends Twig_Node_Expression_Name { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php index 5c383d1..c821db5 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php @@ -16,11 +16,6 @@ public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php index d3518b5..b606f6d 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php @@ -10,11 +10,6 @@ */ class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->raw('intval(floor('); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php index 1d485b6..9565a60 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php @@ -10,11 +10,6 @@ */ class Twig_Node_Expression_Binary_In extends Twig_Node_Expression_Binary { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php index 8f215f1..49ab39e 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php @@ -10,11 +10,6 @@ */ class Twig_Node_Expression_Binary_NotIn extends Twig_Node_Expression_Binary { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php index 6cd3a21..cd6d046 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php @@ -10,11 +10,6 @@ */ class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php index fc102fe..692ec9c 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php @@ -10,11 +10,6 @@ */ class Twig_Node_Expression_Binary_Range extends Twig_Node_Expression_Binary { - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php index c25aadd..f6ed6ff 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php @@ -22,11 +22,6 @@ public function __construct(Twig_NodeInterface $name, $asString = false, $lineno parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { if ($this->getAttribute('as_string')) { diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php b/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php index db06abb..6140c57 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php @@ -21,11 +21,6 @@ public function __construct($name, $lineno, $tag = null) parent::__construct(array(), array('name' => $name), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php b/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php index bd5024b..694c080 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php @@ -22,11 +22,6 @@ public function __construct($name, $lineno, $tag = null) parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { if ($this->getAttribute('output')) { diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php index 247b2e2..4b4a48a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php @@ -34,7 +34,7 @@ public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $this->changeIgnoreStrictCheck($node); } else { - throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine()); + throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getLine()); } } diff --git a/vendor/twig/twig/lib/Twig/Node/Flush.php b/vendor/twig/twig/lib/Twig/Node/Flush.php index 20d6aab..2af17a4 100644 --- a/vendor/twig/twig/lib/Twig/Node/Flush.php +++ b/vendor/twig/twig/lib/Twig/Node/Flush.php @@ -21,11 +21,6 @@ public function __construct($lineno, $tag) parent::__construct(array(), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/For.php b/vendor/twig/twig/lib/Twig/Node/For.php index a8d199a..2d45093 100644 --- a/vendor/twig/twig/lib/Twig/Node/For.php +++ b/vendor/twig/twig/lib/Twig/Node/For.php @@ -30,11 +30,6 @@ public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Nod parent::__construct(array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body, 'else' => $else), array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/ForLoop.php b/vendor/twig/twig/lib/Twig/Node/ForLoop.php index d330283..2554d48 100644 --- a/vendor/twig/twig/lib/Twig/Node/ForLoop.php +++ b/vendor/twig/twig/lib/Twig/Node/ForLoop.php @@ -21,11 +21,6 @@ public function __construct($lineno, $tag = null) parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { if ($this->getAttribute('else')) { diff --git a/vendor/twig/twig/lib/Twig/Node/If.php b/vendor/twig/twig/lib/Twig/Node/If.php index 1b6104d..caff936 100644 --- a/vendor/twig/twig/lib/Twig/Node/If.php +++ b/vendor/twig/twig/lib/Twig/Node/If.php @@ -22,11 +22,6 @@ public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else parent::__construct(array('tests' => $tests, 'else' => $else), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/vendor/twig/twig/lib/Twig/Node/Import.php b/vendor/twig/twig/lib/Twig/Node/Import.php index 515ff2a..df37af3 100644 --- a/vendor/twig/twig/lib/Twig/Node/Import.php +++ b/vendor/twig/twig/lib/Twig/Node/Import.php @@ -21,11 +21,6 @@ public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $va parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Include.php b/vendor/twig/twig/lib/Twig/Node/Include.php index fecaa82..9952f73 100644 --- a/vendor/twig/twig/lib/Twig/Node/Include.php +++ b/vendor/twig/twig/lib/Twig/Node/Include.php @@ -22,11 +22,6 @@ public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $va parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/vendor/twig/twig/lib/Twig/Node/Macro.php b/vendor/twig/twig/lib/Twig/Node/Macro.php index 03cf4dd..932e795 100644 --- a/vendor/twig/twig/lib/Twig/Node/Macro.php +++ b/vendor/twig/twig/lib/Twig/Node/Macro.php @@ -22,18 +22,13 @@ public function __construct($name, Twig_NodeInterface $body, Twig_NodeInterface { foreach ($arguments as $argumentName => $argument) { if (self::VARARGS_NAME === $argumentName) { - throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getLine()); + throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getLine()); } } parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Module.php b/vendor/twig/twig/lib/Twig/Node/Module.php index 1bc4fea..01161d3 100644 --- a/vendor/twig/twig/lib/Twig/Node/Module.php +++ b/vendor/twig/twig/lib/Twig/Node/Module.php @@ -47,11 +47,6 @@ public function setIndex($index) $this->setAttribute('index', $index); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $this->compileTemplate($compiler); diff --git a/vendor/twig/twig/lib/Twig/Node/Print.php b/vendor/twig/twig/lib/Twig/Node/Print.php index 4263536..7b69ee8 100644 --- a/vendor/twig/twig/lib/Twig/Node/Print.php +++ b/vendor/twig/twig/lib/Twig/Node/Print.php @@ -22,11 +22,6 @@ public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Sandbox.php b/vendor/twig/twig/lib/Twig/Node/Sandbox.php index 8ca772b..cd705e2 100644 --- a/vendor/twig/twig/lib/Twig/Node/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/Node/Sandbox.php @@ -21,11 +21,6 @@ public function __construct(Twig_NodeInterface $body, $lineno, $tag = null) parent::__construct(array('body' => $body), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php b/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php index 823e7ac..148dd2b 100644 --- a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php +++ b/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php @@ -21,16 +21,6 @@ */ class Twig_Node_SandboxedPrint extends Twig_Node_Print { - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct($expr, $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Set.php b/vendor/twig/twig/lib/Twig/Node/Set.php index 407d147..e5a6603 100644 --- a/vendor/twig/twig/lib/Twig/Node/Set.php +++ b/vendor/twig/twig/lib/Twig/Node/Set.php @@ -36,11 +36,6 @@ public function __construct($capture, Twig_NodeInterface $names, Twig_NodeInterf } } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/vendor/twig/twig/lib/Twig/Node/Spaceless.php b/vendor/twig/twig/lib/Twig/Node/Spaceless.php index 1478c59..486e461 100644 --- a/vendor/twig/twig/lib/Twig/Node/Spaceless.php +++ b/vendor/twig/twig/lib/Twig/Node/Spaceless.php @@ -23,11 +23,6 @@ public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless parent::__construct(array('body' => $body), array(), $lineno, $tag); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Node/Text.php b/vendor/twig/twig/lib/Twig/Node/Text.php index 6863604..39879bb 100644 --- a/vendor/twig/twig/lib/Twig/Node/Text.php +++ b/vendor/twig/twig/lib/Twig/Node/Text.php @@ -22,11 +22,6 @@ public function __construct($data, $lineno) parent::__construct(array(), array('data' => $data), $lineno); } - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler $compiler A Twig_Compiler instance - */ public function compile(Twig_Compiler $compiler) { $compiler diff --git a/vendor/twig/twig/lib/Twig/Parser.php b/vendor/twig/twig/lib/Twig/Parser.php index 6f24ee6..ed28a0e 100644 --- a/vendor/twig/twig/lib/Twig/Parser.php +++ b/vendor/twig/twig/lib/Twig/Parser.php @@ -94,10 +94,8 @@ public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = fals try { $body = $this->subparse($test, $dropNeedle); - if (null !== $this->parent) { - if (null === $body = $this->filterBodyNodes($body)) { - $body = new Twig_Node(); - } + if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { + $body = new Twig_Node(); } } catch (Twig_Error_Syntax $e) { if (!$e->getTemplateFile()) { @@ -148,7 +146,7 @@ public function subparse($test, $dropNeedle = false) $token = $this->getCurrentToken(); if ($token->getType() !== Twig_Token::NAME_TYPE) { - throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine(), $this->getFilename()); + throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->getFilename()); } if (null !== $test && call_user_func($test, $token)) { @@ -166,20 +164,17 @@ public function subparse($test, $dropNeedle = false) $subparser = $this->handlers->getTokenParser($token->getValue()); if (null === $subparser) { if (null !== $test) { - $error = sprintf('Unexpected tag name "%s"', $token->getValue()); + $e = new Twig_Error_Syntax(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->getFilename()); + if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) { - $error .= sprintf(' (expecting closing tag for the "%s" tag defined near line %s)', $test[0]->getTag(), $lineno); + $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); } - - throw new Twig_Error_Syntax($error, $token->getLine(), $this->getFilename()); - } - - $message = sprintf('Unknown tag name "%s"', $token->getValue()); - if ($alternatives = $this->env->computeAlternatives($token->getValue(), array_keys($this->env->getTags()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); + } else { + $e = new Twig_Error_Syntax(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->getFilename()); + $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); } - throw new Twig_Error_Syntax($message, $token->getLine(), $this->getFilename()); + throw $e; } $this->stream->next(); @@ -255,7 +250,7 @@ public function hasMacro($name) public function setMacro($name, Twig_Node_Macro $node) { if ($this->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine(), $this->getFilename()); + throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getLine(), $this->getFilename()); } $this->macros[$name] = $node; diff --git a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php index 1ec575e..45ca7dc 100644 --- a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php +++ b/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php @@ -90,13 +90,13 @@ public function getTests($name, $legacyTests = false) if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { $message = $match[1]; $condition = $match[2]; - $templates = $this->parseTemplates($match[3]); + $templates = self::parseTemplates($match[3]); $exception = $match[5]; $outputs = array(array(null, $match[4], null, '')); } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { $message = $match[1]; $condition = $match[2]; - $templates = $this->parseTemplates($match[3]); + $templates = self::parseTemplates($match[3]); $exception = false; preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); } else { @@ -165,7 +165,9 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e $template = $twig->loadTemplate('index.twig'); } catch (Exception $e) { if (false !== $exception) { - $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + $message = $e->getMessage(); + $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $message))); + $this->assertSame('.', substr($message, strlen($message) - 1), $message, 'Exception message must end with a dot.'); return; } diff --git a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php b/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php index 908ef61..e591c1d 100644 --- a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php +++ b/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php @@ -15,17 +15,21 @@ /** * @dataProvider getTests */ - public function testCompile($node, $source, $environment = null) + public function testCompile($node, $source, $environment = null, $isPattern = false) { - $this->assertNodeCompilation($source, $node, $environment); + $this->assertNodeCompilation($source, $node, $environment, $isPattern); } - public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) + public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false) { $compiler = $this->getCompiler($environment); $compiler->compile($node); - $this->assertEquals($source, trim($compiler->getSource())); + if ($isPattern) { + $this->assertStringMatchesFormat($source, trim($compiler->getSource())); + } else { + $this->assertEquals($source, trim($compiler->getSource())); + } } protected function getCompiler(Twig_Environment $environment = null) diff --git a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php b/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php index a8a3d7a..c753e62 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php @@ -29,13 +29,6 @@ */ class Twig_TokenParser_AutoEscape extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -46,7 +39,7 @@ public function parse(Twig_Token $token) } else { $expr = $this->parser->getExpressionParser()->parseExpression(); if (!$expr instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('An escaping strategy must be a string or a Boolean.', $stream->getCurrent()->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getFilename()); } $value = $expr->getAttribute('value'); @@ -79,11 +72,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endautoescape'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'autoescape'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Block.php b/vendor/twig/twig/lib/Twig/TokenParser/Block.php index 0a46200..4ffafbe 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Block.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Block.php @@ -22,20 +22,13 @@ */ class Twig_TokenParser_Block extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); if ($this->parser->hasBlock($name)) { - throw new Twig_Error_Syntax(sprintf("The block '$name' has already been defined line %d", $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename()); } $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno)); $this->parser->pushLocalScope(); @@ -47,7 +40,7 @@ public function parse(Twig_Token $token) $value = $token->getValue(); if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given)', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename()); } } } else { @@ -69,11 +62,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endblock'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'block'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Do.php b/vendor/twig/twig/lib/Twig/TokenParser/Do.php index f50939d..7adb5a0 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Do.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Do.php @@ -14,13 +14,6 @@ */ class Twig_TokenParser_Do extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -30,11 +23,6 @@ public function parse(Twig_Token $token) return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'do'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php b/vendor/twig/twig/lib/Twig/TokenParser/Embed.php index 69cb5f3..e685b95 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Embed.php @@ -14,13 +14,6 @@ */ class Twig_TokenParser_Embed extends Twig_TokenParser_Include { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $stream = $this->parser->getStream(); @@ -54,11 +47,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endembed'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'embed'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php b/vendor/twig/twig/lib/Twig/TokenParser/Extends.php index f5ecee2..510417a 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Extends.php @@ -19,32 +19,20 @@ */ class Twig_TokenParser_Extends extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { if (!$this->parser->isMainScope()) { - throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $this->parser->getFilename()); } if (null !== $this->parser->getParent()) { - throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $this->parser->getFilename()); } $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'extends'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php b/vendor/twig/twig/lib/Twig/TokenParser/Filter.php index 2b97475..b20dd5b 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Filter.php @@ -20,13 +20,6 @@ */ class Twig_TokenParser_Filter extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $name = $this->parser->getVarName(); @@ -49,11 +42,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endfilter'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'filter'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php b/vendor/twig/twig/lib/Twig/TokenParser/Flush.php index 4e15e78..f9ce7c3 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Flush.php @@ -16,13 +16,6 @@ */ class Twig_TokenParser_Flush extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); @@ -30,11 +23,6 @@ public function parse(Twig_Token $token) return new Twig_Node_Flush($token->getLine(), $this->getTag()); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'flush'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/For.php b/vendor/twig/twig/lib/Twig/TokenParser/For.php index 5c07d63..3fac511 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/For.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/For.php @@ -23,13 +23,6 @@ */ class Twig_TokenParser_For extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -86,7 +79,7 @@ public function decideForEnd(Twig_Token $token) protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node) { if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition', $node->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition.', $node->getLine(), $stream->getFilename()); } foreach ($node as $n) { @@ -105,7 +98,7 @@ protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterfa if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { $attribute = $node->getNode('attribute'); if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) { - throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition', $attribute->getAttribute('value')), $node->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getLine(), $stream->getFilename()); } } @@ -123,11 +116,6 @@ protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterfa } } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'for'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/From.php b/vendor/twig/twig/lib/Twig/TokenParser/From.php index 5540efa..f7547eb 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/From.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/From.php @@ -18,13 +18,6 @@ */ class Twig_TokenParser_From extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $macro = $this->parser->getExpressionParser()->parseExpression(); @@ -53,7 +46,7 @@ public function parse(Twig_Token $token) foreach ($targets as $name => $alias) { if ($this->parser->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword', $name), $token->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getFilename()); } $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); @@ -62,11 +55,6 @@ public function parse(Twig_Token $token) return $node; } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'from'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/If.php b/vendor/twig/twig/lib/Twig/TokenParser/If.php index 3d7d1f5..91c0604 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/If.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/If.php @@ -25,13 +25,6 @@ */ class Twig_TokenParser_If extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -63,7 +56,7 @@ public function parse(Twig_Token $token) break; default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); } } @@ -82,11 +75,6 @@ public function decideIfEnd(Twig_Token $token) return $token->test(array('endif')); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'if'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Import.php b/vendor/twig/twig/lib/Twig/TokenParser/Import.php index e7050c7..85c5c03 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Import.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Import.php @@ -18,13 +18,6 @@ */ class Twig_TokenParser_Import extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $macro = $this->parser->getExpressionParser()->parseExpression(); @@ -37,11 +30,6 @@ public function parse(Twig_Token $token) return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'import'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Include.php b/vendor/twig/twig/lib/Twig/TokenParser/Include.php index 9c3099a..0e76dae 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Include.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Include.php @@ -21,13 +21,6 @@ */ class Twig_TokenParser_Include extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -63,11 +56,6 @@ protected function parseArguments() return array($variables, $only, $ignoreMissing); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'include'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php b/vendor/twig/twig/lib/Twig/TokenParser/Macro.php index ad910b5..8a7ebd6 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Macro.php @@ -20,13 +20,6 @@ */ class Twig_TokenParser_Macro extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -42,7 +35,7 @@ public function parse(Twig_Token $token) $value = $token->getValue(); if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given)', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename()); + throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename()); } } $this->parser->popLocalScope(); @@ -56,11 +49,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endmacro'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'macro'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php b/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php index 9457325..1feadd0 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php @@ -22,13 +22,6 @@ */ class Twig_TokenParser_Sandbox extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); @@ -43,7 +36,7 @@ public function parse(Twig_Token $token) } if (!$node instanceof Twig_Node_Include) { - throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section', $node->getLine(), $this->parser->getFilename()); + throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getLine(), $this->parser->getFilename()); } } } @@ -56,11 +49,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endsandbox'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'sandbox'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Set.php b/vendor/twig/twig/lib/Twig/TokenParser/Set.php index 0b41909..5ca614b 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Set.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Set.php @@ -28,13 +28,6 @@ */ class Twig_TokenParser_Set extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -71,11 +64,6 @@ public function decideBlockEnd(Twig_Token $token) return $token->test('endset'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'set'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php b/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php index 1e3fa8f..53d906d 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php @@ -24,13 +24,6 @@ */ class Twig_TokenParser_Spaceless extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -47,11 +40,6 @@ public function decideSpacelessEnd(Twig_Token $token) return $token->test('endspaceless'); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'spaceless'; diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Use.php b/vendor/twig/twig/lib/Twig/TokenParser/Use.php index 3ea68b1..4945d03 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Use.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Use.php @@ -25,13 +25,6 @@ */ class Twig_TokenParser_Use extends Twig_TokenParser { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ public function parse(Twig_Token $token) { $template = $this->parser->getExpressionParser()->parseExpression(); @@ -64,11 +57,6 @@ public function parse(Twig_Token $token) $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ public function getTag() { return 'use'; diff --git a/vendor/twig/twig/lib/Twig/TokenParserBroker.php b/vendor/twig/twig/lib/Twig/TokenParserBroker.php index 6ca73fb..d88bb43 100644 --- a/vendor/twig/twig/lib/Twig/TokenParserBroker.php +++ b/vendor/twig/twig/lib/Twig/TokenParserBroker.php @@ -26,8 +26,9 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface /** * Constructor. * - * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances - * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances + * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances + * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances + * @param bool $triggerDeprecationError */ public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true) { @@ -37,13 +38,13 @@ public function __construct($parsers = array(), $brokers = array(), $triggerDepr foreach ($parsers as $parser) { if (!$parser instanceof Twig_TokenParserInterface) { - throw new LogicException('$parsers must a an array of Twig_TokenParserInterface'); + throw new LogicException('$parsers must a an array of Twig_TokenParserInterface.'); } $this->parsers[$parser->getTag()] = $parser; } foreach ($brokers as $broker) { if (!$broker instanceof Twig_TokenParserBrokerInterface) { - throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface'); + throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface.'); } $this->brokers[] = $broker; } diff --git a/vendor/twig/twig/lib/Twig/TokenStream.php b/vendor/twig/twig/lib/Twig/TokenStream.php index 8d2e220..016f812 100644 --- a/vendor/twig/twig/lib/Twig/TokenStream.php +++ b/vendor/twig/twig/lib/Twig/TokenStream.php @@ -56,7 +56,7 @@ public function injectTokens(array $tokens) public function next() { if (!isset($this->tokens[++$this->current])) { - throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current - 1]->getLine(), $this->filename); + throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->filename); } return $this->tokens[$this->current - 1]; @@ -84,7 +84,7 @@ public function expect($type, $value = null, $message = null) $token = $this->tokens[$this->current]; if (!$token->test($type, $value)) { $line = $token->getLine(); - throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', + throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', $message ? $message.'. ' : '', Twig_Token::typeToEnglish($token->getType()), $token->getValue(), Twig_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), @@ -107,7 +107,7 @@ public function expect($type, $value = null, $message = null) public function look($number = 1) { if (!isset($this->tokens[$this->current + $number])) { - throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current + $number - 1]->getLine(), $this->filename); + throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->filename); } return $this->tokens[$this->current + $number];