arnaud-lb / MtHaml

Multi target HAML (HAML for PHP, Twig, <your language here>)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MtHaml Twig Loader is not compatible with Twig 2.x

ZaDarkSide opened this issue · comments

Class MtHaml\Support\Twig\Loader.php

Has method public function getSource($name) but should be named public function getSourceContext($name) actually

or PHP will throw an error:

Class MtHaml\Support\Twig\Loader contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Twig_LoaderInterface::getSourceContext)

class Loader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface
{
    ...

    public function getSource($name)  // <------ SHOULD BE getSourceContext
    {
        ...
    }

    ...

But Twig class expects in Twig\LoaderInterface.php:

interface Twig_LoaderInterface
{
    ...

    /**
     * Returns the source context for a given template logical name.
     *
     * @param string $name The template logical name
     *
     * @return Twig_Source
     *
     * @throws Twig_Error_Loader When $name is not found
     */
    public function getSourceContext($name); // <------ NEEDS THIS NAME
    {
        ...
    }

    ...