Issue #3424177 by longwave, andypost: Remove ContainerAwareInterface from DrupalKernelInterface

merge-requests/6820/head
catch 2024-02-28 18:11:01 +00:00
parent 7beb999e4b
commit a6ba33b204
3 changed files with 4 additions and 34 deletions

View File

@ -549,20 +549,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
return $this->container;
}
/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = NULL): void {
if (isset($this->container)) {
throw new \Exception('The container should not override an existing container.');
}
if ($this->booted) {
throw new \Exception('The container cannot be set after a booted kernel.');
}
$this->container = $container;
}
/**
* {@inheritdoc}
*/
@ -940,22 +926,15 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
$all_messages = $this->container->get('messenger')->all();
}
// If we haven't booted yet but there is a container, then we're asked to
// boot the container injected via setContainer().
// @see \Drupal\KernelTests\KernelTestBase::setUp()
if (isset($this->container) && !$this->booted) {
$container = $this->container;
}
// If the module list hasn't already been set in updateModules and we are
// not forcing a rebuild, then try and load the container from the cache.
if (empty($this->moduleList) && !$this->containerNeedsRebuild) {
$container_definition = $this->getCachedContainerDefinition();
}
// If there is no container and no cached container definition, build a new
// one from scratch.
if (!isset($container) && !isset($container_definition)) {
// If there is no cached container definition, build a new container from
// scratch.
if (!isset($container_definition)) {
$container = $this->compileContainer();
// Only dump the container if dumping is allowed. This is useful for

View File

@ -2,7 +2,6 @@
namespace Drupal\Core;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
@ -12,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
* This interface extends Symfony's KernelInterface and adds methods for
* responding to modules being enabled or disabled during its lifetime.
*/
interface DrupalKernelInterface extends HttpKernelInterface, ContainerAwareInterface {
interface DrupalKernelInterface extends HttpKernelInterface {
/**
* Event fired when the service container finished initializing in subrequest.

View File

@ -432,14 +432,6 @@ parameters:
count: 1
path: lib/Drupal/Core/DrupalKernel.php
-
message: """
#^Interface Drupal\\\\Core\\\\DrupalKernelInterface extends deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\:
since Symfony 6\\.4, use dependency injection instead$#
"""
count: 1
path: lib/Drupal/Core/DrupalKernelInterface.php
-
message: "#^Method Drupal\\\\Core\\\\Entity\\\\ContentEntityConfirmFormBase\\:\\:save\\(\\) should return int but return statement is missing\\.$#"
count: 1