Tweak twig_constant()
authorEugene Leonovich <gen.work@gmail.com>
Wed, 16 Jan 2013 08:40:49 +0000 (09:40 +0100)
committerEugene Leonovich <gen.work@gmail.com>
Wed, 16 Jan 2013 08:40:49 +0000 (09:40 +0100)
lib/Twig/Extension/Core.php

index 2110120..c1a37d8 100644 (file)
@@ -1267,10 +1267,9 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
  */
 function twig_constant($constant, $object = null)
 {
-    if (!$object) {
-        return constant($constant);
+    if ($object) {
+        $constant = get_class($object).'::'.$constant;
     }
-    $class = get_class($object);
 
-    return constant($class.'::'.$constant);
+    return constant($constant);
 }