Unused variable $display_name.
Unused variable $field_name.
Unused variable $filter_name.

Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

StatusFileSize
new1.31 KB

Kindly review a patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

Each of these changes has an extra space after "as".

hardik_patel_12’s picture

StatusFileSize
new469 bytes

Kindly follow a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
hardik_patel_12’s picture

Assigned: Unassigned » hardik_patel_12
Status: Needs review » Needs work
hardik_patel_12’s picture

StatusFileSize
new1.31 KB
new469 bytes

Kindly review a new patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

I don't think these variables are unused. Naming a key in a loop is useful even if that variable is not used later. It helps if the key is needed later or people looking at the later are wondering what the array is keyed by. Additionally PHPStorm doesn't not consider this variable unused.

As unused variables can be detecting via static analysis of the code potentially we could use https://github.com/sirbrillig/phpcs-variable-analysis + PHPCS to automatically check for unused variables and ensure that core doesn't have any. Doing this will be a bit of a big task because they are quite few patterns Drupal adopts that makes this tricky - for example hooks - even if the argument is not used it is best if it is declared on the hook implementation. So going to close this a won't fix.

If someone want to take on the task of adding the above library as a dev dependency and configuring and getting it to run on core that'd be great.