Skip to content

Commit 2b6930a

Browse files
Niklanmglaman
andcommitted
Sync DrupalKernel synthetic services (#823)
* Sync DrupalKernel synthetic services * Add alias for DrupalContainer --------- Co-authored-by: Matt Glaman <[email protected]> (cherry picked from commit e804eff)
1 parent 40ddc27 commit 2b6930a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Drupal/DrupalAutoloader.php

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace mglaman\PHPStanDrupal\Drupal;
44

55
use Composer\Autoload\ClassLoader;
6+
use Drupal\Component\DependencyInjection\Container as DrupalContainer;
67
use Drupal\Core\DependencyInjection\ContainerNotInitializedException;
78
use Drupal\Core\DrupalKernelInterface;
89
use Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter;
@@ -12,6 +13,7 @@
1213
use PHPUnit\Framework\Test;
1314
use ReflectionClass;
1415
use RuntimeException;
16+
use Symfony\Component\DependencyInjection\ContainerInterface;
1517
use Symfony\Component\Finder\Finder;
1618
use Symfony\Component\Yaml\Yaml;
1719
use Throwable;
@@ -108,7 +110,10 @@ public function register(Container $container): void
108110
// Attach synthetic services
109111
// @see \Drupal\Core\DrupalKernel::attachSynthetic
110112
$this->serviceMap['kernel'] = ['class' => DrupalKernelInterface::class];
113+
$this->serviceMap[DrupalKernelInterface::class] = ['alias' => 'kernel'];
111114
$this->serviceMap['class_loader'] = ['class' => ClassLoader::class];
115+
$this->serviceMap['service_container'] = ['class' => DrupalContainer::class];
116+
$this->serviceMap[ContainerInterface::class] = ['alias' => 'service_container'];
112117

113118
$extensionDiscovery = new ExtensionDiscovery($this->drupalRoot);
114119
$extensionDiscovery->setProfileDirectories([]);

0 commit comments

Comments
 (0)