Issue #3214234 by alexpott: Add core/class_aliases.php

merge-requests/659/head^2
Lee Rowlands 2021-05-17 15:43:37 +10:00
parent 85ee5e164b
commit a9fbf2709a
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
5 changed files with 19 additions and 8 deletions

3
composer.lock generated
View File

@ -530,7 +530,7 @@
"dist": { "dist": {
"type": "path", "type": "path",
"url": "core", "url": "core",
"reference": "84de0d6ef4eda33dd426005557f64496a2fd02d1" "reference": "874a51210b265aa07599dc966748e43cf31a0321"
}, },
"require": { "require": {
"asm89/stack-cors": "^1.1", "asm89/stack-cors": "^1.1",
@ -759,6 +759,7 @@
"lib/Drupal/Core/Site/Settings.php" "lib/Drupal/Core/Site/Settings.php"
], ],
"files": [ "files": [
"class_aliases.php",
"includes/bootstrap.inc" "includes/bootstrap.inc"
] ]
}, },

12
core/class_aliases.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/**
* @file
* Contains class_aliases that will be added by the autoloader.
*
* @see core/composer.json
*/
// @todo https://www.drupal.org/project/drupal/issues/3197482 Remove this class
// alias once Drupal is running Symfony 5.3 or higher.
class_alias('Drupal\Core\Http\KernelEvent', 'Symfony\Component\HttpKernel\Event\KernelEvent', TRUE);

View File

@ -201,7 +201,10 @@
"lib/Drupal/Core/Installer/InstallerRedirectTrait.php", "lib/Drupal/Core/Installer/InstallerRedirectTrait.php",
"lib/Drupal/Core/Site/Settings.php" "lib/Drupal/Core/Site/Settings.php"
], ],
"files": [ "includes/bootstrap.inc" ] "files": [
"class_aliases.php",
"includes/bootstrap.inc"
]
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"

View File

@ -18,7 +18,6 @@ use Drupal\Core\DependencyInjection\YamlFileLoader;
use Drupal\Core\Extension\ExtensionDiscovery; use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\File\MimeType\MimeTypeGuesser; use Drupal\Core\File\MimeType\MimeTypeGuesser;
use Drupal\Core\Http\InputBag; use Drupal\Core\Http\InputBag;
use Drupal\Core\Http\KernelEvent;
use Drupal\Core\Http\TrustedHostsRequestFactory; use Drupal\Core\Http\TrustedHostsRequestFactory;
use Drupal\Core\Installer\InstallerKernel; use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Installer\InstallerRedirectTrait; use Drupal\Core\Installer\InstallerRedirectTrait;
@ -40,10 +39,6 @@ use TYPO3\PharStreamWrapper\Manager as PharStreamWrapperManager;
use TYPO3\PharStreamWrapper\Behavior as PharStreamWrapperBehavior; use TYPO3\PharStreamWrapper\Behavior as PharStreamWrapperBehavior;
use TYPO3\PharStreamWrapper\PharStreamWrapper; use TYPO3\PharStreamWrapper\PharStreamWrapper;
// @todo https://www.drupal.org/project/drupal/issues/3197482 Remove this class
// alias once Drupal is running Symfony 5.3 or higher.
class_alias(KernelEvent::class, 'Symfony\Component\HttpKernel\Event\KernelEvent', TRUE);
/** /**
* The DrupalKernel class is the core of Drupal itself. * The DrupalKernel class is the core of Drupal itself.
* *

View File

@ -19,7 +19,7 @@ class DrupalKernelLegacyTest extends UnitTestCase {
* @covers ::isMasterRequest * @covers ::isMasterRequest
*/ */
public function testKernelEventDeprecation() { public function testKernelEventDeprecation() {
$kernel = new DrupalKernel('test', NULL); $kernel = $this->createMock(DrupalKernel::class);
$request = $this->createMock(Request::class); $request = $this->createMock(Request::class);
$event = new KernelEvent($kernel, $request, $kernel::MASTER_REQUEST); $event = new KernelEvent($kernel, $request, $kernel::MASTER_REQUEST);