From: nikic <+@ni-po.com> Date: Tue, 14 Dec 2010 15:46:28 +0000 (+0100) Subject: allow null filenames X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a349b243067202a6a1684265c345cbce9427b2b7;p=web%2Fkonrad%2Ftwig.git allow null filenames --- diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 96af3ff..d7afc2c 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -259,7 +259,7 @@ class Twig_Environment $lexer->setEnvironment($this); } - public function tokenize($source, $name) + public function tokenize($source, $name = null) { return $this->getLexer()->tokenize($source, $name); } @@ -304,7 +304,7 @@ class Twig_Environment return $this->getCompiler()->compile($node)->getSource(); } - public function compileSource($source, $name) + public function compileSource($source, $name = null) { return $this->compile($this->parse($this->tokenize($source, $name))); } diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index d15b690..a119e1e 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -59,7 +59,7 @@ class Twig_Lexer implements Twig_LexerInterface * * @return Twig_TokenStream A token stream instance */ - public function tokenize($code, $filename = 'n/a') + public function tokenize($code, $filename = null) { if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { $mbEncoding = mb_internal_encoding(); @@ -132,11 +132,11 @@ class Twig_Lexer implements Twig_LexerInterface return $tokens; } // empty array, call again - else if (empty($tokens)) { + elseif (empty($tokens)) { return $this->nextToken(); } // if we have multiple items we push them to the buffer - else if (count($tokens) > 1) { + elseif (count($tokens) > 1) { $first = array_shift($tokens); $this->pushedBack = $tokens;