Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables
File /core/modules/datetime/datetime.module
Line 816: Unused local variable $has_time
Line 864: Unused local variable $has_time
Line 850: Unused local variable $has_time
Line 857: Unused local variable $has_time
Line 843: Unused local variable $has_time
Line 998: Unused local variable $title
Line 1052: Unused local variable $hour
Comment | File | Size | Author |
---|---|---|---|
#6 | 2080067-remove_unused_variables-6.patch | 2.35 KB | netsensei |
#6 | interdiff.txt | 1.01 KB | netsensei |
#4 | 2080067-remove_unused_variables-4.patch | 1.01 KB | beowulf1416 |
#1 | 2080067-remove_unused_variable-1.patch | 1.54 KB | beowulf1416 |
Comments
Comment #1
beowulf1416 CreditAttribution: beowulf1416 commentedremoved unused variable $has_time. I was unable to run DateTimePlus test because I haven't installed the Intl PECL extension
Comment #2
YesCT CreditAttribution: YesCT commented@beowulf1416 Thanks for making so many patches. How are you feeling about them?
I added some reviewer notes to the meta. If you review a few of these unused var patches, and have advice to add to the meta, please go ahead and edit that meta issue summary. Anyone can edit it.
If you jump into irc http://drupal.org/irc into #drupal-contribute or the core mentoring office hours https://drupal.org/core-mentoring , we can help match you up with some different issues in some other areas.
Comment #3
CaptainWonky CreditAttribution: CaptainWonky commentedPatch applies ok.
All instances of
$has_time
have been removed, so the patch works as far as the issue title is concerned.However, the issue summary includes two other variables:
$title
and$hour
$title
seems to be an unused local variable.$hour
is used, but I assume it's the statement$hour = 0
which needs to be removed, since$hour
is not used afterwards.Comment #4
beowulf1416 CreditAttribution: beowulf1416 commentedremoving $hour and $title also.
great eyes!
Comment #5
rhm5000 CreditAttribution: rhm5000 commentedThe #4 patch is not quite correct, should include changes made in #1 as the patch has not been reviewed and commited. Changes in #4 otherwise seem fine and patch applies. Changing status to needs work.
Comment #6
netsensei CreditAttribution: netsensei commentedOkay. Rerolled the patch. With an interdiff showing the integration of #4 in #1.
Comment #7
areke CreditAttribution: areke commentedThis applies cleanly and doesn't break any functionality; it works well. Thank you!
Comment #8
areke CreditAttribution: areke commentedComment #9
catchCommitted/pushed to 8.x, thanks!