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

Mark implicit macro argument default values as such with an attribute #4010

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Commits on Mar 16, 2024

  1. Mark implicit macro argument default values as such with an attribute

    This change causes no difference to compiled templates or to macro argument semantics.
    
    Consider the following macro:
    ```twig
    {% macro marco(po, lo = null) %}{% endmacro %}
    ```
    
    With this change, the `ConstantExpression` for argument `po` will have an attribute `isImplicit`, whose value will be `true`. (Note that `lo` will not have that attribute.)
    
    This allows node visitors to distinguish between arguments that do and those that do not have
    explicit default values even if the value is `null`.
    
    This is useful for [static code analysis](twigphp#4003).
    
    For example, a static analysis tool might consider arguments with no explicit default value as non-optional.
    drjayvee committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    6128528 View commit details
    Browse the repository at this point in the history