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

Squiz/MultiLineFunctionDeclaration: bug fix - skip over attributes #609

Commits on Sep 14, 2024

  1. Squiz/MultiLineFunctionDeclaration: bug fix - skip over attributes

    The sniff looks for `T_COMMA` tokens to find the start of the next parameter and skips over parenthesis sets and square brackets sets (like short arrays) to prevent mismatching on a `T_COMMA` which is not a parameter separator.
    
    This logic did not take parameter attributes into account, which can contain multiple comma-separated attributes, so should also be skipped over.
    
    Fixed now. Includes plenty of tests.
    
    Also includes minor stability fix for the parentheses/square brackets skipping.
    
    Notes:
    * It could be argued that the sniff should use the `File::getMethodParameters()` method to do the parameter parsing instead. This could be done in a future iteration, but will need to be evaluated carefully for side-effects.
    * This sniff extends the PEAR `FunctionDeclaration` sniff. It has been verified that that sniff is not affected by this bug.
    
    Fixes 608
    jrfnl committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    f39847a View commit details
    Browse the repository at this point in the history