Skip to content
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

Merged
merged 3 commits into from Dec 13, 2016

Conversation

Boorj
Copy link
Contributor

@Boorj Boorj commented Dec 2, 2016

Also the final part should look like this:

$source = new Twig_Source($code, $filename);
return $this->lexer->tokenize($source);

Because, of deprecation here

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();
Copy link
Owner

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sure!

@Boorj
Copy link
Contributor Author

Boorj commented Dec 8, 2016

@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.
Mthaml is lacking full syntax highlighting support in phpstorm, but that's the problem of phpstorm ;) :bowtie:

@Boorj
Copy link
Contributor Author

Boorj commented Dec 8, 2016

@arnaud-lb by the way, in twig 2.0 string $code will be removed and it's currently deprecated. So, maybe, we can make a separate branch and return Twig_source instance instead of $code, $filename. Twig_source also contains path field, as i remember..

@arnaud-lb
Copy link
Owner

I agree, ideally we should return a Twig_Source when we get a Twig_Source. Do you want to make the change ?

@Boorj
Copy link
Contributor Author

Boorj commented Dec 13, 2016

Done, now it's conditional.

@arnaud-lb arnaud-lb merged commit f894bd2 into arnaud-lb:master Dec 13, 2016
@arnaud-lb
Copy link
Owner

Thanks!

@Boorj Boorj deleted the patch-1 branch December 14, 2016 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants