New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating MtHaml Lexer.php to support twig 1.27+ #1
Conversation
Also the final part should look like this: ```php $source = new Twig_Source($code, $filename); return $this->lexer->tokenize($source); ``` Because, of deprecation [here](https://github.com/twigphp/Twig/blob/1.x/lib/Twig/Lexer.php#L81)
@@ -17,6 +18,12 @@ public function __construct(Environment $environment, \Twig_LexerInterface $lexe | |||
|
|||
public function tokenize($code, $filename = null) | |||
{ | |||
if ($code instanceof Twig_Source) { | |||
if ($filename === null) | |||
$filename = $code->getName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add curly braces around this ? This is required to conform to PSR-2 coding style :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, sure!
@arnaud-lb Done! And, by the way, Нuge thank you for mthaml. Using that for several years, the keystone in my website projects. Now using Bolt.cms (based on silex), integrated mthaml into that cms. |
@arnaud-lb by the way, in twig 2.0 string |
I agree, ideally we should return a Twig_Source when we get a Twig_Source. Do you want to make the change ? |
Done, now it's conditional. |
Thanks! |
Also the final part should look like this:
Because, of deprecation here