mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Merge branch '1.x'
* 1.x: bumped version to 1.21.2-DEV prepared the 1.21.1 release fixed support for Twig_Test_* classes bumped version to 1.21.1-DEV prepared the 1.21.0 release
This commit is contained in:
@@ -13,7 +13,15 @@
|
||||
* improved the performance of the filesystem loader
|
||||
* removed features that were deprecated in 1.x
|
||||
|
||||
* 1.21.0 (2015-XX-XX)
|
||||
* 1.21.2 (2015-XX-XX)
|
||||
|
||||
* n/a
|
||||
|
||||
* 1.21.1 (2015-08-26)
|
||||
|
||||
* fixed regression when using the deprecated Twig_Test_* classes
|
||||
|
||||
* 1.21.0 (2015-08-24)
|
||||
|
||||
* added deprecation notices for deprecated features
|
||||
* added a deprecation "framework" for filters/functions/tests and test fixtures
|
||||
|
||||
@@ -311,25 +311,24 @@ class Twig_Extension_Core extends Twig_Extension
|
||||
$stream = $parser->getStream();
|
||||
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
||||
$env = $parser->getEnvironment();
|
||||
$testMap = $env->getTests();
|
||||
|
||||
if (isset($testMap[$name])) {
|
||||
return $testMap[$name];
|
||||
if ($test = $env->getTest($name)) {
|
||||
return $test;
|
||||
}
|
||||
|
||||
if ($stream->test(Twig_Token::NAME_TYPE)) {
|
||||
// try 2-words tests
|
||||
$name = $name.' '.$parser->getCurrentToken()->getValue();
|
||||
|
||||
if (isset($testMap[$name])) {
|
||||
if ($test = $env->getTest($name)) {
|
||||
$parser->getStream()->next();
|
||||
|
||||
return $testMap[$name];
|
||||
return $test;
|
||||
}
|
||||
}
|
||||
|
||||
$message = sprintf('The test "%s" does not exist', $name);
|
||||
if ($alternatives = $env->computeAlternatives($name, array_keys($testMap))) {
|
||||
if ($alternatives = $env->computeAlternatives($name, array_keys($env->getTests()))) {
|
||||
$message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user