Replace usage of deprecated trait Drupal\Component\DependencyInjection\ServiceIdHashTrait

Created on 25 August 2023, over 1 year ago

Problem/Motivation

As (soon to be) discovered by mglaman/phpstan-drupal 1.2.0 (see πŸ“Œ Bump mglaman/phpstan-drupal to latest to make daily "updated deps" QA run pass again Fixed ), we are using some deprecated functionality throughout Drupal core.

This issue is for dealing with:

 ------ ------------------------------------------------------------------- 
  Line   core/lib/Drupal/Component/DependencyInjection/Container.php        
 ------ ------------------------------------------------------------------- 
  48     Usage of deprecated trait                                          
         Drupal\Component\DependencyInjection\ServiceIdHashTrait in class   
         Drupal\Component\DependencyInjection\Container:                    
         in drupal:9.5.1 and is removed from drupal:11.0.0. Use the         
           'Drupal\Component\DependencyInjection\ReverseContainer' service  
         instead.                                                           
 ------ ------------------------------------------------------------------- 

and

 ------ ------------------------------------------------------------------- 
  Line   core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php      
 ------ ------------------------------------------------------------------- 
  22     Usage of deprecated trait                                          
         Drupal\Component\DependencyInjection\ServiceIdHashTrait in class   
         Drupal\Core\DependencyInjection\ContainerBuilder:                  
         in drupal:9.5.1 and is removed from drupal:11.0.0. Use the         
           'Drupal\Component\DependencyInjection\ReverseContainer' service  
         instead.                                                           
 ------ ------------------------------------------------------------------- 

Note: Depending on the landing of πŸ“Œ Bump mglaman/phpstan-drupal to latest to make daily "updated deps" QA run pass again Fixed before the landing of this issue, we also might need to remove two suppressions from core/phpstan-baseline.neon

Steps to reproduce

Proposed resolution


The trait is needed to fulfil the methods defined in \Drupal\Component\DependencyInjection\ContainerInterface.
As soon as the two deprecated methods are removed from that interface in d11.0.0, the use of the trait can be removed.

Trying to do this before d11.0.0 seems to be not worth the effort.

Let's keep these two suppressions in the baseline until then.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Closed: won't fix

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡³πŸ‡±Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024