diff --git a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php index a073665..11ed449 100644 --- a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -51,7 +51,7 @@ class AnnotatedClassDiscovery implements DiscoveryInterface { * * @var string[] */ - protected $annotationNamespaces = array(); + protected $annotationNamespaces = []; /** * Constructs a new instance. @@ -65,7 +65,7 @@ class AnnotatedClassDiscovery implements DiscoveryInterface { * @param string[] $annotation_namespaces * (optional) Additional namespaces to be scanned for annotation classes. */ - function __construct($plugin_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin', array $annotation_namespaces = array()) { + function __construct($plugin_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin', array $annotation_namespaces = []) { $this->pluginNamespaces = $plugin_namespaces; $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name; $this->annotationNamespaces = $annotation_namespaces; @@ -84,8 +84,11 @@ protected function getAnnotationReader() { // Add the namespaces from the main plugin annotation, like @EntityType. $namespace = substr($this->pluginDefinitionAnnotationName, 0, strrpos($this->pluginDefinitionAnnotationName, '\\')); $this->annotationReader->addNamespace($namespace); + // Register additional namespaces to be scanned for annotations. - array_walk($this->annotationNamespaces, [$this->annotationReader, 'addNamespace']); + foreach ($this->annotationNamespaces as $namespace) { + $this->annotationReader->addNamespace($namespace); + } } return $this->annotationReader; } diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 065e99a..0232fbe 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -42,7 +42,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt * * @var array */ - protected $cacheTags = array(); + protected $cacheTags = []; /** * Name of the alter hook if one should be invoked. @@ -73,7 +73,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt * * @var array */ - protected $defaults = array(); + protected $defaults = []; /** * The name of the annotation that contains the plugin definition. @@ -103,7 +103,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt * * @var string[] */ - protected $annotationNamespaces = array(); + protected $annotationNamespaces = []; /** * Creates the discovery object. @@ -123,7 +123,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt * @param string[] $annotation_namespaces * (optional) Additional namespaces to scan for annotation definitions. */ - public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface = NULL, $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin', array $annotation_namespaces = array()) { + public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface = NULL, $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin', array $annotation_namespaces = []) { $this->subdir = $subdir; $this->namespaces = $namespaces; $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name; @@ -248,29 +248,6 @@ public function useCaches($use_caches = FALSE) { } /** - * Fetches from the cache backend, respecting the use caches flag. - * - * @see \Drupal\Core\Cache\CacheBackendInterface::get() - */ - protected function cacheGet($cid) { - if ($this->useCaches && $this->cacheBackend) { - return $this->cacheBackend->get($cid); - } - return FALSE; - } - - /** - * Stores data in the persistent cache, respecting the use caches flag. - * - * @see \Drupal\Core\Cache\CacheBackendInterface::set() - */ - protected function cacheSet($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) { - if ($this->cacheBackend && $this->useCaches) { - $this->cacheBackend->set($cid, $data, $expire, $tags); - } - } - - /** * Performs extra processing on plugin definitions. * * By default we add defaults for the type to the definition. If a type has