diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php index c2c28b38e7749393bf96e82a167fa3499c26b9e6..0cae61c39f771ddbf097ecd81c260671c7d0f94c 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php @@ -4,6 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Registers all event subscribers to the event dispatcher. @@ -27,9 +28,8 @@ public function process(ContainerBuilder $container) { // the service is created by a factory. $class = $container->getDefinition($id)->getClass(); - $refClass = new \ReflectionClass($class); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - if (!$refClass->implementsInterface($interface)) { + $interface = EventSubscriberInterface::class; + if (!is_subclass_of($class, $interface)) { throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); } diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php index c4187aaf60b9ef16b5cc354f8a1b1c7fd9c412c6..b39d7f3d25492cfdbfeca616154bc5c66f05a107 100644 --- a/core/modules/language/src/ConfigurableLanguageManager.php +++ b/core/modules/language/src/ConfigurableLanguageManager.php @@ -405,9 +405,7 @@ public function getFallbackCandidates(array $context = []) { public function getLanguageSwitchLinks($type, Url $url) { if ($this->negotiator) { foreach ($this->negotiator->getNegotiationMethods($type) as $method_id => $method) { - $reflector = new \ReflectionClass($method['class']); - - if ($reflector->implementsInterface('\Drupal\language\LanguageSwitcherInterface')) { + if (is_subclass_of($method['class'], LanguageSwitcherInterface::class)) { $original_languages = $this->negotiatedLanguages; $result = $this->negotiator->getNegotiationMethodInstance($method_id)->getLanguageSwitchLinks($this->requestStack->getCurrentRequest(), $type, $url); diff --git a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php index a5d5ecbb80b4eccb3ef7fd7ba4284748853510fd..3aed7ecc2a8fc97108e9f0865b5300910faf0aab 100644 --- a/core/modules/language/src/HttpKernel/PathProcessorLanguage.php +++ b/core/modules/language/src/HttpKernel/PathProcessorLanguage.php @@ -129,14 +129,13 @@ public function processOutbound($path, &$options = [], Request $request = NULL, * The scope of the processors: "inbound" or "outbound". */ protected function initProcessors($scope) { - $interface = '\Drupal\Core\PathProcessor\\' . Unicode::ucfirst($scope) . 'PathProcessorInterface'; + $interface = 'Drupal\Core\PathProcessor\\' . Unicode::ucfirst($scope) . 'PathProcessorInterface'; $this->processors[$scope] = []; $weights = []; foreach ($this->languageManager->getLanguageTypes() as $type) { foreach ($this->negotiator->getNegotiationMethods($type) as $method_id => $method) { if (!isset($this->processors[$scope][$method_id])) { - $reflector = new \ReflectionClass($method['class']); - if ($reflector->implementsInterface($interface)) { + if (is_subclass_of($method['class'], $interface)) { $this->processors[$scope][$method_id] = $this->negotiator->getNegotiationMethodInstance($method_id); $weights[$method_id] = $method['weight']; }