Add a standard way to indicate that a parameter is unused · Issue #1 · phan/ProposedAnnotations · GitHub
Skip to content

Add a standard way to indicate that a parameter is unused #1

Open

Description

@TysonAndre

Such as @param Type $paramName description @unused-param (on a single line after $paramName)

(Phan uses @phan-unused-param. It suppresses warnings about unused params/variables starting with $unused or with a name of $_)

Activity

  1. TysonAndre commented on Jul 14, 2020

    @TysonAndre
    MemberAuthor

    cc @ondrejmirtes @muglug @staabm - I can see this being useful to avoid the need to rename parameters to suppress warnings for individual parameters, as well as to avoid different suppression annotations for different tools

  2. staabm commented on Jul 14, 2020

    @staabm

    When named parameters are a thing with php8 renaming a parameter could be a bc break, therefore using a annotation to indicate this sounds more robust.

    👍

  3. TysonAndre commented on Aug 5, 2020

    @TysonAndre
    MemberAuthor

    Also, it seems like it would be unnecessarily duplication to need to specify the type, and some tools might treat leaving out the type (@param $arg @unused-param) as hinting something is mixed, or a code smell.

    So adding a new annotation such as /** @unused-param [...]$paramName */ is another possibility, possibly in combination with the modifier on @param (not sure how variadic params should be referred to as)

    • Some tools might treat this as marking the function as unused. That's probably a bug if the hyphen isn't checked for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions