Closed BusterNeece closed 2 years ago
Fixed in v1.3.1. Thanks!
Hi @oscarotero! I'm running into the same error when scanning a PHP-files, specifically compiled Twig-templates. Other PHP-files will pass without problem. I haven't opened a separate issue yet, since I'm not sure if this is a bug or me misusing this library..
Would you mind taking a look at my code?
An example of a compiled Twig-template can be found here. I'm trying to catch the ->trans(...)
calls here.
I've been banging my head against the wall on this for quite some time, so your help would be much appreciated!
I think the problem is in this line: https://gist.github.com/tvdijen/fc1016fbaa3aeac5a2bd50dad2e73114#file-compiledtwigtemplate-php-L69
The trans
function contains a expression instead a string with the id string of the text.
btw, there's a twig scanner (https://github.com/php-gettext/Twig-Scanner) but it's not stable enough so maybe it doesn't work either.
Thanks @oscarotero ! I did find the twig-scanner, but the warning in the readme, and the lack of a stable release held me from trying it. I also understand from the open issues that it lacks support for Twig filters, and it lacks PHP 8 support. I was hoping I could work around that by compiling the templates, but I guess it's not gonna work.
In the process of trying to upgrade from
php-gettext
version 4.x to 5.x in my code, and the following example code:Yields the error:
I believe this is because the parser isn't correctly handling the multiline string inside the function call.