From d6cdd674dc1c8d55dc889e4ef9dbc7c088fe7ade Mon Sep 17 00:00:00 2001 From: catch Date: Wed, 29 Mar 2023 15:27:25 +0100 Subject: [PATCH] Issue #3351004 by Natallia: Deprecations for PHP 8.1 get_class() and get_called_class() without argument (cherry picked from commit decf4529d1dc67045acd899ae3cc8beec09bb3f4) --- .../Drupal/Core/Installer/NormalInstallerServiceProvider.php | 2 +- core/lib/Drupal/Core/Render/Element/StatusMessages.php | 4 ++-- core/lib/Drupal/Core/Url.php | 2 +- core/modules/system/src/Plugin/Block/SystemMenuBlock.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php b/core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php index a35905b5875..507b27c7c4f 100644 --- a/core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php +++ b/core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php @@ -57,7 +57,7 @@ class NormalInstallerServiceProvider implements ServiceProviderInterface { $container->getDefinition('extension.list.theme_engine')->setClass(InstallerThemeEngineExtensionList::class); // Don't register the lazy route provider in the super early installer. - if (get_called_class() === NormalInstallerServiceProvider::class) { + if (static::class === NormalInstallerServiceProvider::class) { $lazy_route_provider = $container->register('router.route_provider.installer'); $lazy_route_provider ->setClass(InstallerRouteProviderLazyBuilder::class) diff --git a/core/lib/Drupal/Core/Render/Element/StatusMessages.php b/core/lib/Drupal/Core/Render/Element/StatusMessages.php index e02c91aef0c..dc63e5eb476 100644 --- a/core/lib/Drupal/Core/Render/Element/StatusMessages.php +++ b/core/lib/Drupal/Core/Render/Element/StatusMessages.php @@ -30,7 +30,7 @@ class StatusMessages extends RenderElement { // of that specific type. '#display' => NULL, '#pre_render' => [ - get_class() . '::generatePlaceholder', + self::class . '::generatePlaceholder', ], '#include_fallback' => FALSE, ]; @@ -47,7 +47,7 @@ class StatusMessages extends RenderElement { */ public static function generatePlaceholder(array $element) { $build = [ - '#lazy_builder' => [get_class() . '::renderMessages', [$element['#display']]], + '#lazy_builder' => [self::class . '::renderMessages', [$element['#display']]], '#create_placeholder' => TRUE, ]; diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 2f1cee32fe9..7af4ff01176 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -777,7 +777,7 @@ class Url implements TrustedCallbackInterface { '#options' => $this->getOptions(), ]; if (!$this->unrouted) { - $render_array['#access_callback'] = [get_class(), 'renderAccess']; + $render_array['#access_callback'] = [self::class, 'renderAccess']; } return $render_array; } diff --git a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php index ed2406034fb..463b6800b8c 100644 --- a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php @@ -85,7 +85,7 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa '#title' => $this->t('Menu levels'), // Open if not set to defaults. '#open' => $defaults['level'] !== $config['level'] || $defaults['depth'] !== $config['depth'], - '#process' => [[get_class(), 'processMenuLevelParents']], + '#process' => [[self::class, 'processMenuLevelParents']], ]; $options = range(0, $this->menuTree->maxDepth());