diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php index 2088ae1..7bf4bfc 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -69,9 +69,8 @@ public function getDefinitions() { $reader->addNamespace('Drupal\Core\Annotation', array(DRUPAL_ROOT . '/core/lib/Drupal/Core/Annotation')); // Add the namespaces from the main plugin annotation, like @EntityType. - $explode = explode('\\', $this->pluginDefinitionAnnotationName); - array_pop($explode); - $reader->addNamespace(implode('\\', $explode)); + $namespace = substr($this->pluginDefinitionAnnotationName, 0, strrpos($this->pluginDefinitionAnnotationName, '\\')); + $reader->addNamespace($namespace); // Clear the annotation loaders of any previous annotation classes. AnnotationRegistry::reset();