title: Symfony 4 TwigFunction does not get registered
body: <p>I am writing a Twig function in Symfony 4 but I cannot get it to work...</p>
  
  <blockquote>
    <p>The extension class</p>
  </blockquote>
  
  <pre><code>&lt;?php
  
  namespace App\Twig;
  
  use App\Utils\XXX;
  use Twig\Extension\AbstractExtension;
  use Twig\TwigFunction;
  
  class XXXExtension extends AbstractExtension
  {
      /**
       * @return array|TwigFunction|TwigFunction[]
       */
      public function getFunctions()
      {
          return new TwigFunction('showControllerName', [$this, 'showControllerName']);
      }
  
  
      public function showControllerName($sControllerPath)
      {
          return XXX::getControllerName($sControllerPath);
      }
  }
  </code></pre>
  
  <p>I have <strong>autowire</strong> set to <strong>true</strong> in <strong>services.yaml</strong> but just in case i tried with this also:</p>
  
  <pre><code>    App\Twig\XXXExtension:
          public: true
          tags:
              - { name: twig.extension }
  
  </code></pre>
  
  <blockquote>
    <p>usage in html.twig</p>
  </blockquote>
  
  <pre><code>{% set controllerName = showControllerName(app.request.get('_controller')) %}
  </code></pre>
  
  <p>and the response i get after this is:</p>
  
  <pre><code>HTTP 500 Internal Server Error
  Unknown "showControllerName" function.
  </code></pre>