Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-13616

Pass lexer directly to TWIG environment

XMLWordPrintable

    Error rendering 'com.atlassian.jira.jira-view-issue-plugin:details-module'. Please contact your Jira administrators.

      The twig lexer is loaded via the service container in the TWIG environment. Why not just pass in the lexer directly and remove the service container?

      https://github.com/phpbb/phpbb/blob/develop/phpBB/phpbb/template/twig/environment.php#L56
      https://github.com/phpbb/phpbb/blob/develop/phpBB/phpbb/template/twig/environment.php#L78

      IRC:
      [2015-02-14 20:04:16] <naderman> I do wonder why the twig environment needs the container itself
      [2015-02-14 20:04:35] <VSE> hmm
      [2015-02-14 20:05:06] <naderman> all it does with it is retrieve the lexer
      [2015-02-14 20:05:11] <naderman> that seems very wrong somehow
      [2015-02-14 20:05:35] <naderman> VSE: can you file a "major" bug report on 3.1 to remove that dependency?
      [2015-02-14 20:06:02] <VSE> sure… https://github.com/phpbb/phpbb/blob/develop/phpBB/phpbb/template/twig/environment.php#L50
      [2015-02-14 20:06:25] <naderman> VSE: yeah but I don't see why one wouldn't just pass in the lexer if needed
      [2015-02-14 20:06:33] <naderman> that's the only thing $this->container is used in there
      [2015-02-14 20:06:38] <naderman> it's protected so can't be used from elsewhere
      [2015-02-14 20:06:42] <naderman> and there are no subclasses either

            nicofuma nicofuma
            VSE Matt Friedman [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: