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

File /core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php

Line 93: Unused local variable $display_id
Line 112: Unused local variable $display_id
Line 334: Unused local variable $types

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jlindsey15’s picture

Status: Active » Needs review
FileSize
1.39 KB
phiit’s picture

Assigned: jlindsey15 » Unassigned
Status: Needs review » Reviewed & tested by the community

Applied the patch and everything seems to be in order.

phiit’s picture

Status: Reviewed & tested by the community » Needs review

Having seconds thoughts, looks to me as the patch is removing some functionality. Someone else needs to look at this as well. :)

If this condition in the code is useless then everything would seem fine in my eyes.

-    if ($this->view->display_handler->isDefaulted($plural)) {
-      $display_id = 'default';
-    }
benjy’s picture

Status: Needs review » Reviewed & tested by the community

Everything looks fine in the current patch. Just one thing:

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -331,7 +327,6 @@ public function usesGroupBy() {
   public function buildGroupByForm(&$form, &$form_state) {

Maybe here we should initiate $group_types to an empty array?

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I must've somehow committed this in my last commit spree.

Committed and pushed to 8.x.

tstoeckler’s picture

Status: Fixed » Needs work
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -108,9 +107,6 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     if (isset($types[$plural]['plural'])) {
       $plural = $types[$plural]['plural'];
     }
-    if ($this->view->display_handler->isDefaulted($plural)) {

This in fact removes the only usage of $plural, so $plural is now an unnused local variable.

sandergo90’s picture

Wrote a new patch because the other patch is already committed in 8.x branch. This patch removes plural definition because it's unused in the init() function.

sandergo90’s picture

Status: Needs work » Needs review
oriol_e9g’s picture

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

Status: Reviewed & tested by the community » Fixed

Committed a34cb25 and pushed to 8.x. Thanks!

Committed as part of a merged commit for #2002650: [meta, no patch] improve maintainability by removing unused local variables

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