Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables
File /core/modules/views/lib/Drupal/views/ManyToOneHelper.php
Line 223: Unused local variable $alias
Comment | File | Size | Author |
---|---|---|---|
#10 | views-2067529-10.patch | 1.47 KB | mrded |
#7 | views-2067529-7.patch | 1.47 KB | mrded |
Comments
Comment #1
jlindsey15 CreditAttribution: jlindsey15 commentedLooking at the code:
it doesn't seem like $alias is unused, unless I'm being stupid.
Comment #2
rhm5000 CreditAttribution: rhm5000 commented@jlindsey15 Yes after looking at the code:
local variable $alias is not unused.
Comment #3
alexanderpas CreditAttribution: alexanderpas commentedIt seems like$this->handler->tableAliases
always gets one value on this line,causing the conditionalif (empty($this->handler->tableAlias))
to always return FALSE.as a result, the variable $alias seems to be unused.In addition in the case$this->handler->tableAliases
is empty,$alias
must be empty too,$alias
is equal to an item in$this->handler->tableAliases
Comment #4
rhm5000 CreditAttribution: rhm5000 commented@alexanderpas The conditional
if (empty($this->handler->tableAlias))
is checking$this->handler->tableAlias
not$this->handler->tableAliases
, thusif (empty($this->handler->tableAlias))
can return True. I agree if$this->handler->tableAliases
is empty,$alias
must be empty, meaning$this->handler->tableAlias = $alias;
could return empty causing the conditionalif (empty($this->handler->tableAlias))
to be insufficient or wrong conditional.Comment #5
joelpittetComment #6
mrded CreditAttribution: mrded commentedComment #7
mrded CreditAttribution: mrded commentedI have also changed comment to drupal code standards.
Comment #8
thomas.fleming CreditAttribution: thomas.fleming commentedThe code style looks fine, and the patch applies.
Comment #9
alexpottLet's fix up the comment here too.. No need to start with "And" and we are not longer setting
table_alias
Comment #10
mrded CreditAttribution: mrded commentedComment #11
joelpittetBack to RTBC.
Comment #12
Xano10: views-2067529-10.patch queued for re-testing.
Comment #13
Xano10: views-2067529-10.patch queued for re-testing.
Comment #14
webchickCommitted and pushed to 8.x. Thanks!