Unused variable are as follows:

In src/Plugin/views/field/FieldPluginBase.php
. Unused variable $tokens

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hardik_Patel_12 created an issue. See original summary.

Hardik_Patel_12’s picture

Kindly review a new patch

Hardik_Patel_12’s picture

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

Title: Remove unused variables and undefined variable from view module » Remove unused variables from view module
Issue summary: View changes
snehalgaikwad’s picture

Status: Needs review » Reviewed & tested by the community

Patch is working fine.

snehalgaikwad’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.64 KB

Found one extra space, here adding a new patch after removing it.

naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

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

#6 patch applied successfully and works fine.
Note: Some coding standards need to be fixed in the above files but as the main purpose of this issue is fixed.

catch’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
    @@ -330,7 +330,7 @@ public function getMenuLinks() {
     
         // Replace % with %views_arg for menu autoloading and add to the
         // page arguments so the argument actually comes through.
    -    foreach ($bits as $pos => $bit) {
    +    foreach ($bits as $bit) {
           if ($bit == '%') {
    

    I personally prefer specifying the keys in foreach loops, even if they're not used - it can help with readability and documentation. So not sure we should do this.

  2. +++ b/core/modules/views/src/Plugin/views/query/Sql.php
    @@ -1345,7 +1345,7 @@ public function query($get_count = FALSE) {
           }
     
    -      foreach ($entity_information as $entity_type_id => $info) {
    +      foreach ($entity_information as $info) {
    

    Same here.

Hardik_Patel_12’s picture

@catch , ok got your point . Kindly review a new patch.

Hardik_Patel_12’s picture

Issue summary: View changes
Status: Needs work » Needs review
bronk’s picture

Status: Needs review » Reviewed & tested by the community

Additional patch in #10 also works. #9 is some subjectivity that we shouldn't inject into this issue as that is not a current coding standard. Whether it is preferred or not, I don't think it should hold up this fix.

  • catch committed 140b0a6 on 9.0.x
    Issue #3105984 by Hardik_Patel_12, snehalgaikwad, bronk: Remove unused...

  • catch committed d15c8b2 on 8.9.x
    Issue #3105984 by Hardik_Patel_12, snehalgaikwad, bronk: Remove unused...
catch’s picture

Version: 9.0.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 140b0a6 and pushed to 9.0.x. Thanks!

Might be worth a separate coding standards issue to discuss the foreach() stuff.

Status: Fixed » Closed (fixed)

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