Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables

File /core/modules/block/block.module

Line 513: Unused local variable $block_counter
Line 568: Unused local variable $block_id
Line 582: Unused local variable $block_id
Line 608: Unused local variable $block_id

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

legolasbo’s picture

I've located all four of these variables and have come to the following conclusion.

$block_counter is used as part of the drupal cache process if i've understood the meaning of &drupal_static(__FUNCTION__, array()); correctly.

All instances of $block_id are actually unused, but are (the key) part of a foreach loop. I think removing these won't do the performance of their functions any good, but will reduce code understandability.

In my opinion we should leave these variables untouched.

legolasbo’s picture

Status: Active » Needs review
legolasbo’s picture

Status: Needs review » Needs work

Because of a discussion in #2057157: Remove Unused local variable $plugin from /core/modules/views/views.module the unused foreach key variables will be removed. I'll supply a patch soon.

legolasbo’s picture

Assigned: legolasbo » Unassigned
Status: Needs work » Needs review
FileSize
1.45 KB

Attached patch removes the unused foreach key variables.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

All good.

webchick’s picture

Component: other » block.module
Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.