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

Universal/NoReservedKeywordParameterNames: various improvements #173

Merged

Commits on Dec 4, 2022

  1. Universal/NoReservedKeywordParameterNames: minor code simplification

    ... which can be made now support for PHPCS < 3.7.1 has been dropped.
    
    The sniff now only listens to tokens which are accepted by the `FunctionDeclarations::getParameters()` method, so checking for an exception should be unnecessary.
    
    Includes removing a stray `$paramNames` variable setting, which is never used.
    jrfnl committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    c7827ec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b9dfb4d View commit details
    Browse the repository at this point in the history
  3. Universal/NoReservedKeywordParameterNames: add extra tests

    ... to safeguard bowing out for function declarations without parameters and that the sniff stays silent for unfinished function declarations.
    jrfnl committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    b939740 View commit details
    Browse the repository at this point in the history
  4. Universal/NoReservedKeywordParameterNames: make the check case-insens…

    …itive
    
    While parameters (variables) are case-sensitive in PHP, keywords are not.
    
    This commit improves the sniff to check for the keyword used in parameter names in a case-insensitive manner to make this sniff independent of code style rules regarding the case for parameter names.
    
    Includes additional tests.
    jrfnl committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    e78f25f View commit details
    Browse the repository at this point in the history
  5. Universal/NoReservedKeywordParameterNames: add tests with PHP 8.0 con…

    …structor property promotion
    
    ... to confirm that properties set via the constructor are also checked.
    
    Properties set via the constructor can be _passed_ to the constructor using named parameters, so this check should also apply to those properties.
    jrfnl committed Dec 4, 2022
    Configuration menu
    Copy the full SHA
    35a2e51 View commit details
    Browse the repository at this point in the history