Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables
File /core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
Line 1031: Unused local variable $key
Line 1230: Unused local variable $joins
Line 1231: Unused local variable $fields
Line 1324: Unused local variable $group
Line 1327: Unused local variable $group
Line 1369: Unused local variable $external
Line 1385: Unused local variable $items
Line 1545: Unused local variable $index
Comment | File | Size | Author |
---|---|---|---|
#9 | core-remove-unused-vars-sql.php-2072603-9.patch | 2.58 KB | legolasbo |
#3 | core-remove-unused-vars-sql.php-2072603-3.patch | 2.82 KB | legolasbo |
#1 | core-remove-unused-vars-sql.php-2072603-1.patch | 2.58 KB | legolasbo |
Comments
Comment #1
legolasboRemoved the unused variables
Comment #2
phiit CreditAttribution: phiit commentedThanks for the patch!
Reviewed and this patch looks good, except I think that the declaration of $fields variable at the start of Sql class could be cleaned up? Since after the patch the use (or in this case the unuse) of the variable is removed from the code completely.
Wondering if this chunk could be cleaned up as well? Starting at row 77 after applying the patch:
Comment #3
legolasboAttached patch also removes code chunk mentioned above.
Comment #5
legolasboThe removal of $fields causes exceptions in 3 tests. I'll look into these tests to see if they should also be cleaned up.
Comment #6
phiit CreditAttribution: phiit commentedI was probably wrong about removing the $fields completely. I think the first patch you did will work fine in this case as it removes the unused variable issue here.
Comment #7
legolasboI agree you could be wrong about removing $fields completely, however I do think we should at least review the failing code to see how $fields is used there. Perhaps it is just legacy code doing stuff with an always empty array.
Comment #8
dawehnerat least $this->fields is 100% used in the class.
Comment #9
legolasboYou are right dawehner, i feel kinda stupid for not looking for $this->fields.
I've attached a reroll of the original patch to be reviewed once again.
Comment #10
dawehnerThis change looks odd but these variables are indeed not needed.
Comment #11
webchickCommitted and pushed to 8.x. Thanks!