Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Fix some shortcomings of UnusedParameterLinter #506

Merged
merged 1 commit into from
Aug 11, 2022

Commits on Aug 11, 2022

  1. Fix some shortcomings of UnusedParameterLinter

     - Variadic parameters were not checked
       function _(int ... $x): void {} now emits an error for $x.
    - Lambda parameters are now linted in unparenthesized params.
       $x ==> 0 now emits an error for $x.
       Same applies for (int ... $x) ==> 0.
     - Added explicit tests for old style variadics.
       The linter handled them fine, but there was no test for it.
    Checking for unparenthesized lambda parameters required a new linter.
    The UnusedParameterLinter checked against ParameterDeclaration.
    $x ==> 0; does not introduce one, so a new TNode was required.
    This PR may cause old HHAST_FIXME comments to break.
    You will have to upgrade:
    /*HHAST_FIXME[UnusedParameter]*/ ($x) ==> 0; to
    /*HHAST_FIXME[UnusedLambdaParameter]*/ ($x) ==> 0;
    I suspect this linter is rarely suppressed, since the autofix is easier.
    lexidor committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    27aa676 View commit details
    Browse the repository at this point in the history