Problem/Motivation
In #3209617: [Symfony 6] Symfony\Component\HttpFoundation\RequestStack::getMasterRequest() is deprecated, use getMainRequest() instead we added a BC shim that supports RequestStack that could have either getMainRequest() or getMasterRequest() methods.
Now Drupal 10 has moved to Symfony 6 we can deprecate the code that handles the getMasterRequest() method, so we can use the Symfony class directly again in D10 and remove the shim in #3265121: Remove Symfony 4 RequestStack BC shim in 11.0.x.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#24 | 3265356-24.patch | 6.03 KB | andypost |
#24 | interdiff.txt | 1.08 KB | andypost |
Issue fork drupal-3265356
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
andypostComment #4
SpokjeDon't think deprecation in D9.4 can happen, since we're on Symfony 4, so we need the shim there.
Let's see if we can deprecate in D10.0 and remove in D10.1.
Comment #7
SpokjeComment #8
SpokjeSince the is blocking #3227033: Remove Quick Edit from core which has priority Major, I think this issue should also have that priority.
Comment #9
SpokjeOk, at least the appeases the PHPStan/PHPCS/Spellcheck and Testbot gods...
Undoubtedly there can be improvements of wording in CR and thus the deprecation messages, may somebody can even find a clever way to deprecate this in D9.4 already, but this is the best I can do and as far as I can take this issue.
BTW: This issue not only blocks #3227033: Remove Quick Edit from core but in fact _any_ patch/MR that includes changes in the PHPStan baseline (
core/phpstan-baseline.neon
).Comment #10
SpokjeComment #11
SpokjeRight, the age-old rule C-before-C (Coffee-before-Commit) proven once again.
I think we can deprecate in
9.4.x-dev
after all.Comment #13
SpokjeAccording to @catch here #3209617-21: [Symfony 6] Symfony\Component\HttpFoundation\RequestStack::getMasterRequest() is deprecated, use getMainRequest() instead we can only deprecate for removal in D11, so let's roll with that.
Which would mean changes in
10.0.x-dev
and another MR for9.4.x-dev
.Comment #16
SpokjeSorry for the noise and the MR graveyard this is turned into :/
Comment #18
catchfwiw I think #3209617-21: [Symfony 6] Symfony\Component\HttpFoundation\RequestStack::getMasterRequest() is deprecated, use getMainRequest() instead is still right, it lets 9.4.x-compatible modules start using the Symfony 5/6 API in 9.4, but then once they're using in 9.4, we don't want to break them in 10.x if they use the shim directly, so deprecating for removal 11.x works.
Agree with removing the support for getMasterRequest() from 10.x, which is already in the MR.
Comment #20
SpokjeThanks @catch, so deprecating for removal in 11.x is the way to go (is this the first one? Do we get a prize?)
So do/can we deprecate in 9.4.x already, or should we do that in 10.0.x?
The current MRs/CR is based on that assumption, if we get onboard of the 10.0.x-deprecation-train, we need to close the 9.4.x MR, change the deprecation error in the 10.0.x and the CR and we should be good to go.
Comment #21
andypostAs I got catch we should just deprecate in D10 for removal in D11, so you need to revert change to masterRequest and just update its deprecation message to include a link to https://www.drupal.org/node/3253744
Comment #22
andypostI mean the already deprecated
getMasterRequest()
should be removed in D10 sametime as the shim deprecatedHere's my vision
Comment #23
SpokjeThanks @andypost.
If you're vision is the correct one (which is probably is), I think it should mention remove in Drupal 11 in the
@todo
s instead of the currently mentioned 10. I think there are 2 of them. To late down here to do a full review, and I can't RTBC it anyway.+ * @todo Remove this in Drupal 10 https://www.drupal.org/node/3265121
Comment #24
andypostThank you! nice catch!
Comment #25
andypostbtw there's only 2 references explaining how to provide link to removal https://www.drupal.org/about/core/policies/core-change-policies/drupal-d...
Comment #26
neclimdulI wonder if we really need to deprecate this method or if we can just have an empty class. Its seems likely to trigger in correct code that's having the wrong class injected.
Anyways, that's not a critical change. With the @todo fixed to 11 I think this is an easy RTBC.
Comment #27
andypostFiled follow-up for 9.4.x #3265419: Improve deprecation message for RequestStack::getMasterRequest()
Comment #28
andypostComment #29
andypostComment #30
andypost@neclimdul Re#26 the reason to provide this message is to catch unit-tests which used to call the method, no idea if class load is enough
Comment #33
SpokjeChanged CR to deprecation in D10.0.0.
Buried outdated CRs
Comment #35
catchSo I think the other option here just to make phpstan quiet would have been to remove the ::getMasterRequest() method without deprecating.
That would mean we'd need a follow-up to deprecate in 10.1.x to remove in 11.x, but ::getMasterRequest() is only used by a handful of modules in contrib: http://grep.xnddx.ru/search?text=getMasterRequest&filename= - and a similarly small number that directly use Symfony's RequestStack. Only the intersection of the two (which I did not check, but must be lower) would be affected by the deprecation here.
So I think the number of contrib modules that will need to actually use the shim in 9.4.x will be very low, meaning the number affected by it being deprecated in Drupal 10.0.x will also be very low.
We can't deprecated it in 9.4.x for removal in 11.x because we don't have the new RequestStack object available yet, and also because core uses it.
Committed bc964dc and pushed to 10.0.x. Thanks!
Comment #36
andypostAdded related #3213895: [META] Remove deprecated classes, methods, procedural functions and code paths outside of deprecated modules on the Drupal 10 branch