Closed OwnerOfThisIsle closed 3 years ago
I saw the same, investigated a bit and it seems it just fails to lint due to Twig saying:
The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().
So that would need to be fixed for linter to work. Also would be good to report all Twig errors/warnings as currently those are hidden. Probably would need to set up error handler with set_error_handler()
There is actually more errors that I see right of the bat, without fixing anything:
Unknown error type: [16384] The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().
Unknown error type: [16384] The possibility to register the same extension twice ("core") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.
Unknown error type: [16384] The Twig_TokenParserBroker class is deprecated since version 1.12 and will be removed in 2.0.
Unknown error type: [16384] Passing a string as the $source argument of Twig_Environment::tokenize() is deprecated since version 1.27. Pass a Twig_Source instance instead.
Unknown error type: [16384] The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.
Unknown error type: [16384] The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.
Unknown error type: [16384] The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.
Unknown error type: [16384] The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.
I'm afraid this won't be fixed as this project seems dead.
I guessing we need a story around different Twig version. I'll file a separate issue.
There is an Atom linter Provider that has twig-lint as prerequisite, so I gave it a try.
But my templates do not report any linter warnings (or Errors), even if i try to do some ugly code.
Calling twig-lint in cmd line makes no difference. I always get OK in path\filename as an answer.
So I have to ask, what rules are checked by the linter?