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/link/lib/Drupal/link/Plugin/field/field_type/LinkItem.php
Line 112: Unused local variable $item
Comment | File | Size | Author |
---|---|---|---|
#6 | 2081169-6.patch | 649 bytes | rivimey |
#3 | 2081169-3.patch | 1007 bytes | areke |
#1 | drupal8.other_.2081169-1.patch | 653 bytes | smira |
Comments
Comment #1
smira CreditAttribution: smira commentedComment #2
parthipanramesh CreditAttribution: parthipanramesh commentedsorry, patch failed..
Comment #3
areke CreditAttribution: areke commentedComment #5
areke CreditAttribution: areke commented3: 2081169-3.patch queued for re-testing.
Comment #6
rivimeyReviewed the patch and it seems perfectly sane. Applied the patch to current 8.x HEAD and it applies ok with an offset of 3 lines. I have attched a reroll of the patch to make it current. Recommend RTBC
Comment #7
xjmLet's also check the rest of the module and confirm that there are no other unused local variables.
Comment #8
rivimeyThe rest of that file (LinkItem.php) looks fine w.r.t unused variables: there aren't many to not be used.
The only thing I could possibly question is in function isEmpty() at line 121, where it seems to be assumed that get('url') returns an object that can have getValue applied. Is there any point in checking get()'s return value before dereferencing?
Comment #9
enhdless CreditAttribution: enhdless commentedPatch #3 works great!
Comment #10
webchickCommitted and pushed to 8.x. Thanks!