Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Twig] Wrong type hint for app variable in Symfony 2.7+ and 3.x #903

Copy link
Copy link
Closed
@King2500

Description

@King2500
Issue body actions

Starting from Symfony 2.7 the global Twig variable app is from type Symfony\Bridge\Twig\AppVariable instead of Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables.

This did not made any problem, since until Sf 3.2 the methods of both classes are the same. But starting from Sf 3.3 there will be a method called getFlashes (see symfony/symfony#21819) which is only defined in AppVariable.

Since the AppVariable class only exists since Sf 2.7, the best solution would be to (dynamically) read the configuration from src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml and find the actual class of app variable:
image

References:
https://github.com/symfony/symfony/blob/2.6/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.