Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
In core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php file $route variable is initialized in multiple function but never used .
Proposed resolution
Remove unused $route variables.
Comment | File | Size | Author |
---|---|---|---|
unsused-variable-removed.patch | 1.73 KB | Hardik_Patel_12 | |
Comments
Comment #2
siddhant.bhosale CreditAttribution: siddhant.bhosale as a volunteer and at QED42 commentedComment #3
siddhant.bhosale CreditAttribution: siddhant.bhosale as a volunteer and at QED42 commentedHi, the patch applies cleanly. There are no test errors. Looks good to be merged.
Comment #4
apadernoWe need to check if it's just a matter of initialized variables that aren't used, or it's a bigger issue, for example code that has been wrongly removed.
We need to verify in which commit the variables have been introduced, and which commit removed the code using those variables.
Comment #5
paulocsSo lets go per parts:
The lines 39, 41 and 75 were added in the issue #2481453: Implement query parameter based content negotiation as alternative to extensions and as I see, it is no problem to remove them.
The line 106 were added in the issue #2854560: \Drupal\Core\Routing\RequestFormatRouteFilter::filter() is too HTML-centric and it is no problem to remove too.
Comment #6
apadernoThe first patch added all the
testFilter()
code; the second patch moved part of the code in a data provider.In neither the cases, the
$route
variable was used. It's not the case of removed code that should not have been removed, then. The patch is correctly fixing the code by removing the unused variables.Comment #7
alexpottCommitted and pushed 87713ec20e to 9.1.x and 5679afdce0 to 9.0.x and 464b755f85 to 8.9.x. Thanks!
Fixed on commit.
Backported to 8.9.x to keep the tests aligned.