Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Oct 2021 at 08:09 UTC
Updated:
21 Jan 2023 at 21:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #5
alexpottI don't think this should be a service. I think this should be a utility class and the class should require the path to the settings file to be pass in.
I.e. the class should not do:
of have
$this->sitePathinjected. The constructor should just accept a string and it should be a path to a settings file to rewrite.Comment #6
volegerRerolled, and addressed #5
Comment #7
volegerrebased
Comment #8
volegerUpdated the title as we do not introduce the service
Comment #9
volegerBump
Comment #10
andypostLooks good, needs to edit CR and could be rtbc
The trick is to document that argument order is opposite
Comment #11
volegerDone
Comment #12
andypostThank you, looks ready
Comment #13
alexpottPosted some review comments plus there's quite a few mentions of drupal_rewrite_settings() even in new code that should be fixed.
Comment #14
volegerThanks for the review @alexpott
Addressed all review comments.
Comment #15
volegerBump
Comment #16
darvanenTaking a look at
per #13
Comment #17
darvanenAh, no I see that has already been handled.
I first came here to provide a review.
I've had a look through the code and see nothing out of place, test coverage looks good and is passing. The CR conveys the necessary information and is up to date.
I would make this RTBC except for the number of times I've seen issues rejected because the issue summary is not up to date, so, tagging for that.
Comment #18
volegerUpdated IS
Comment #19
longwaveThis looks ready to me.
Comment #20
alexpottThis now fails the new tighter PHPStan rules...
Comment #21
alexpottWe need to fix the one on line 107 and regenerate the baseline for the others as they will move from install.inc to this file.
Comment #22
volegerAddressed
Nice new rules strictness BTW
Comment #23
longwaveNot sure that this commit is quite correct, given it is changing the refactored code but the PHPStan baseline changes refer to the original code?
Comment #24
volegeraddressed review comment
Comment #25
volegerTests passed, so I think that can back to RTBC
Comment #26
volegerRebased against the latest 10.1.x
Comment #28
xjmOops, something ate my comment...
Thanks for your work on this API improvement!
I left a number of comments on the merge request. I tried to skip past any issues with what are essentially moved/copied lines and focused instead on the high-level naming and structure of the new API.
Comment #29
volegerAddressed review comments and updated CR.
Comment #30
xjmThanks! I polished the text of the CR a little, and left a few more suggestions on the MR.
Comment #31
volegerSuggestions were applied, and legacy tests were updated. Ready for review again.
Comment #32
longwaveAll review points were resolved, this looks good to me.
Comment #33
xjmI was hopeful that the (comparatively speaking) new git option for moved lines would be helpful here, so I tried this locally:
git diff --color-moved --staged -wUnfortunately, this does not quite have the expected results, e.g., it works as expected for the PHPStan baseline:

But not so much for the actual function:

So, I had to get a bit creative, and put the original and new versions of each method into its own file, and diffed them using
git diff --no-index --color-words -w. Using this method, I confirmed that for the most part, the only changes to the individual methods are :::rewrite().\Exceptioninstead ofExceptionsince it is no longer in the global namespace.Other changes include:
==to===and!=to!==in various methods.$refparameter fromarray|nulltomixedelse:Only that last two changes seemed off.
Looking at the code for #5, the
iffor thatelsethrows an exception, so the code would not run anyway if the condition were met. So that is a good cleanup too.However, I don't see the purpose/value in the lattermost addition and I could not find it in the original code. It also led to me noticing that the docblock is out of order; all the how-to-use-it docs should come above the
@param.Comment #34
xjmI pushed a couple commits to address #33.6.
Comment #36
xjmAlright. I considered tagging this for framework manager review, but since @alexpott's earlier review already gave feedback on the architectural aspects of this I'd be concerned about, I think that is sufficient.
There might be further improvements and refactoring that could be made for this code, but I think it's best to scope any further improvement to followups, since it's already hard enough to review the changes as per #33.
The changes I made to the docblock are very minor, and my other suggestions got a +1 from longwave as well as implicitly from @voleger by accepting them, so I'm comfortable committing this.
Committed to 10.1.x, and published the change record. Thanks!
Comment #38
xjm