Problem/Motivation
In #3323994: Fix PHPStan L1 errors "Constructor of class Foo has an unused parameter $bar" we discovered the $language_manager argument in the constructor of \Drupal\menu_link_content\Form\MenuLinkContentForm is unused.
Let's deprecate it in 10.1 and remove it in 11.0.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3325175
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
spokjeComment #4
spokjeNote: This deprecation was not done according to the documentation here: https://www.drupal.org/about/core/policies/core-change-policies/drupal-d..., but according to this comment by @alexpott here: https://git.drupalcode.org/project/drupal/-/merge_requests/3008#note_135753
If this is the accepted new way of deprecation, we need to update the mentioned documentation.
Comment #6
smustgrave commentedReviewed the changes and they look good and I see they were green before comment #4
#5 appears to be a rebasing.
Comment #7
mondrakeWould it make sense to use union types instead of removing the typehints completely? I will give a try.
Comment #8
mondrakeThis is the idea from #7 in a patch.
Comment #9
mallezieHmm, that does indeed work, although I must say this looks really strange IMO. Not sure i prefer this over losing the type hinting?
Comment #10
xjmI think the union types are a good choice now that we can allow them.
Comment #11
quietone commentedSetting to NR because of the new approach.
Comment #12
smustgrave commentedMoving to NW for the open thread.
Comment #13
spokjeComment #14
spokjeSadly we seem not ready for these kind of changes within a time-frame that's less than one year.
So let's stick with the MR and the official ways.
Comment #15
mondrakeI think now the reference for this type of dances should be #3323209: Deprecate calling Drupal\block\Plugin\migrate\process\BlockTheme::_construct() with the $migration argument. In particular, adding typehinting to the class properties would ease the check that each property gets the expected type.
Comment #16
spokjeI fully agree with @mondrake, but sadly this isn't
The format to use here is not on the deprecation policy page..No matter how much I would like to use the new format, I'm a bit tired of doing do and then having to change everything back to the official way.
So I've gone the official wsy to begin with now.
Let's hope for some official code style changes soon.
Comment #17
mondrakeBut that HAS changed since #9, hasn't it? https://www.drupal.org/about/core/policies/core-change-policies/drupal-d...
And #3323209: Deprecate calling Drupal\block\Plugin\migrate\process\BlockTheme::_construct() with the $migration argument WAS committed.
Anyway, let's RTBC this, and see committers' feedback.
Comment #18
spokjeAFAICT I (tried to) applied the new format. Although the example with only 3 arguments and deprecating the 2nd is a bit sparse for our 6, deprecate 3rd real life situation.
Comment #19
spokjeComment #20
mondrake3 points. The first one is a do-do imho.
Comment #21
spokjeComment #22
spokje@mondrake: Resolved one thread, don't think we can resolve a second one and don't understand the third one.
Comment #23
spokjeComment #24
mondrakeTwo birds with one stone, I think if we fix the 3rd we also implicitly fix the 2nd, see inline
Comment #25
spokjeThanks @mondrake, should have figured that out myself.
Comment #26
mondrakeFew nits in inline comments.
Comment #27
smustgrave commentedChange looks good to me.
All threads resolved.
Lets see if this can make it for 10.1
Comment #28
andypostI bet it needs
DeprecatedServicePropertyTraitto be added for removed serviceComment #29
spokjeThanks @andypost, never knew about the existence of
DeprecatedServicePropertyTrait#TIL
But I don't think it's needed here, since the
$language_managerargument (interestingly) never was a property on theMenuLinkContentFormclass?Comment #30
andypostAs I see there's few contrib modules extending the class, so would be great to provide BC
ref http://codcontrib.hank.vps-private.net/search?text=MenuLinkContentForm&f...
Comment #31
spokjeAdded
DeprecatedServicePropertyTraitComment #32
andypostAdded suggestion as expected property is
languageManagerbut service namelanguage_managerComment #33
spokjeApplied suggestion, closed all open threads.
Comment #34
andypostThank you!
Comment #36
spokjeBased MR on
11.xComment #38
catchLooks good. Committed/pushed to 11.x, thanks! I updated the deprecation message on commit.
Comment #41
quietone commentedPublished change record.