Fix type hinting of Twig engine

Similar to https://github.com/symfony/symfony/issues/4742