New deprecations at 9.1 due to [#2273381} committed on 16 Oct

202x: Drupal\Core\Plugin\ContextAwarePluginBase is deprecated in drupal:9.1.0 and will be removed before drupal:10.0.0. Instead, use \Drupal\Core\Plugin\ContextAwarePluginTrait. See https://www.drupal.org/node/3120980

CR https://www.drupal.org/node/3120980

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
661 bytes

Here's a patch for .travis.yml to cater for the extra 202 deprecations and allow the tests to pass. Then any new deprecations will show up when we get new failures.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC so that this can be committed. Then we can work on the actual correction in due course.

  • TR committed 1407fbc on 8.x-3.x authored by jonathan1055
    Issue #3178551 by jonathan1055: [9.1] Drupal\Core\Plugin\...
TR’s picture

Status: Reviewed & tested by the community » Active

Committed #2 to remove the deprecations for now.

I saw that CR, and it worries me because it was handled in a way typical for core issues - major potentially disruptive changes were slipped in as incidental to the real issue, and were not discussed beforehand.

The CR and the issue is about "Deprecate passing context values to plugins through configuration and remove ContextAwarePluginBase (component & core) in favor of a new trait"

This sounds like a trivial structural change that shouldn't pose a problem for anyone. Therefore, little thought has been put into approving and committing that change. If that's all there was to it, then it wouldn't need much thought or discussion. But at the end of the CR, as an afterthought, there's this statement: "passing context values to plugins via configuration has been deprecated". That little afterthought may be fatal for Rules, depending on what it means (which is not explained) and how it is implemented, because storing context values in configuration is fundamental to Rules. The CR doesn't discuss this. Now maybe this won't affect us, but it makes me nervous - Rules is the major consumer of Context, so Rules suffers all the consequences of "trivial" changes that core makes to the Context code. We saw that with EntityContextDefintion (which we still have to get fixed in core, BTW), and I'm afraid this might be another "trivial" change which costs us months or years of extra work.

TR’s picture

ContextAwarePluginTrait is a mess - most of the methods are entirely undocumented, and it assumes that the class using it extends certain unspecified base classes and implements certain unspecified interfaces. Plus it changed the visibility of at least one interface-defined method, if you happen to be using that interface.

The change record is incomplete and leaves out some essential information.

But the biggest problem for the future is probably going to be what I mentioned above: "passing context values to plugins via configuration has been deprecated".

I will have to start a core issue for all of this - just writing it up is going to be hours of work, and who knows if it will ever be fixed.

Regardless, here's a work-around that I think will take care of the immediate deprecation problem.

@jonathan1055, can you want adjust the deprecation warnings in .travis.yml ?

jonathan1055’s picture

Yes all of the "Drupal\Core\Plugin\ContextAwarePluginBase is deprecated" messages have been removed with your patch. As requested I have added an update to .travis.yml with the new deprecation numbers. I also removed testing at Drupal 8 and added other improvements which I already had in the pipeline, but did not raise a separate issue as I know Travis is not part of your main testing infrastucture. However, if you are going to commit a change to .travis.yml then it would be nice to have these new changes in too.

You can see we have a new deprecation at 9.2
The "core/jquery.ui" asset library is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3067969. I will create a new issue for this.

jonathan1055’s picture

TR’s picture

What about D10 testing, is that something you would want to add to the travis configuration now? It's currently working on DrupalCI, testing against D10 on a weekly basis in order to give us early warning.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

What about D10 testing, is that something you would want to add to the travis configuration now?

Thanks but let's go with what we have at the moment, and get the changes in. It's good that you have set up a weekly D10 test on drupal.org.
I will look at adding it to travis in due course.

ps. Sorry about causing you extra work on #3257978: The "core/jquery.ui" asset library is deprecated in drupal:9.2. I just created the issue to record the fact, I did not expect someone to raise a MR and start coding changes without discussing it first on the issue.

  • TR committed 8a63c77 on 8.x-3.x
    Issue #3178551 by jonathan1055, TR: [9.1] Drupal\Core\Plugin\...
TR’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. Committed.

No problem with #3257978: The "core/jquery.ui" asset library is deprecated in drupal:9.2 - if someone wants to help out that's good with me! Hopefully they'll take the review and make the changes, if not at least we now have more relevant information there, should someone else want to get involved.

TR’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.