Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForbiddenFunctions rule detection problem #174

Open
icedevelopment opened this issue Apr 26, 2021 · 4 comments
Open

ForbiddenFunctions rule detection problem #174

icedevelopment opened this issue Apr 26, 2021 · 4 comments
Labels

Comments

@icedevelopment
Copy link

The ForbiddenFunctions rule added in #67 doesn't detect function calls with spaces before the first parenthesis.

Example:

{% dump (foo) %}
{{ dump (foo) }}

won't be detected but

{% dump(foo) %}
{{ dump(foo) }}

will be.

@Ciloe any chance you could slightly modify the parser to handle these cases?

@Ciloe
Copy link
Collaborator

Ciloe commented Apr 26, 2021

Yes, I will see that. Thanks for your feedback !

@icedevelopment
Copy link
Author

As a side note {% dump %} isn't detected either.

@Ciloe
Copy link
Collaborator

Ciloe commented Apr 27, 2021

Yes, but this is not a real function which is forbidden.

@icedevelopment
Copy link
Author

True, technically its a tag in this case but I think it would be a very useful thing if this rule would detect it as well.
According to the comments in Symfony\Bridge\Twig\TokenParser\DumpTokenParser the syntax should be:

{% dump %}
{% dump foo %}
{% dump foo, bar %}

but it looks like {% dump (foo) %} is syntactically valid. On the other hand {% dump (foo, bar) %} will throw an exception.

@OwlyCode OwlyCode added the bug label Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants