if (null === $object) {
$message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item);
+ } elseif (is_array($object)) {
+ $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item);
} else {
$message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object);
}
continue;
}
- if (!isset($cache[$name])) {
- $cache[$name] = $method;
- }
- if (!isset($cache[$lcName])) {
- $cache[$lcName] = $method;
+ // skip get() and is() methods (in which case, $name is empty)
+ if ($name) {
+ if (!isset($cache[$name])) {
+ $cache[$name] = $method;
+ }
+ if (!isset($cache[$lcName])) {
+ $cache[$lcName] = $method;
+ }
}
}
self::$cache[$class] = $cache;
}
@trigger_error($message, E_USER_DEPRECATED);
- return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset());
+ return '' === $ret ? '' : new Twig_Markup($ret, $this->env->getCharset());
}
return $ret;
}
}
+
+class_alias('Twig_Template', 'Twig\Template', false);