Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Ignoring dynamically Globals failing test#38

Open
raffaelecarelle wants to merge 2 commits into
twigstan:mainfrom
raffaelecarelle:globals-failing-test
Open

Fix Ignoring dynamically Globals failing test#38
raffaelecarelle wants to merge 2 commits into
twigstan:mainfrom
raffaelecarelle:globals-failing-test

Conversation

@raffaelecarelle
Copy link
Copy Markdown
Contributor

@raffaelecarelle raffaelecarelle commented Sep 23, 2024

No description provided.

Implemented a new test suite to validate Twig global variables. Introduced `TemplateDataExtension` to manage global variables, and updated `twig-loader` to use this extension. Added corresponding end-to-end test cases and sample Twig template.
@raffaelecarelle
Copy link
Copy Markdown
Contributor Author

It would usefull add in twig {% phpstan_ignore "variable.undefined" %} thats add // @phpstan-ignore "variable.undefined" comment up to variable to be ignored.

Any suggestion @ruudk?

@ruudk
Copy link
Copy Markdown
Contributor

ruudk commented Sep 24, 2024

Wouldn't this be solved with the baseline feature?

@raffaelecarelle
Copy link
Copy Markdown
Contributor Author

most likely yes. With Baseline I can add to ignoreErrors the variable.undefined error I want to

@ruudk
Copy link
Copy Markdown
Contributor

ruudk commented Oct 22, 2024

I was thinking about this.

It would be solved if Symfony always passes the current request as request variable on the context to the Twig Template.

It's kind of weird that they have app.request which reads from the RequestStack. I wonder why they decided to do it like this.

I'll try to do some research on this and see if I can raise an issue for it upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants