diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index 2a3afab..65578b3 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -23,7 +23,7 @@ public function getCategories(); /** * Gets sorted definitions. * - * @param array $definitions + * @param array[]|object[]|null $definitions * (optional) The definitions to sort. If omitted, all definitions are used. * * @return array[] @@ -34,13 +34,12 @@ public function getSortedDefinitions(array $definitions = NULL); /** * Gets definitions grouped by category. * - * @param array $definitions + * @param array[]|object[]|null $definitions * (optional) The definitions to group. If omitted, all definitions are * used. * - * @return array[] - * A nested array containing plugin definitions, keyed by category and - * plugin id. + * @return array[]|object + * An array of plugin definitions, keyed by category and plugin ID. */ public function getGroupedDefinitions(array $definitions = NULL); diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index f6f283e..62b5fa7 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -35,7 +35,7 @@ * * If the definition lacks a category, it defaults to the providing module. * - * @param array $definition + * @param array[] $definition * The plugin definition. */ protected function processDefinitionCategory(&$definition) { @@ -69,9 +69,10 @@ protected function getModuleName($module) { } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getCategories(). + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getCategories(). */ public function getCategories() { + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $categories = array_unique(array_values(array_map(function ($definition) { return $definition['category']; }, $this->getDefinitions()))); @@ -80,14 +81,11 @@ public function getCategories() { } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getSortedDefinitions(). - * - * @param string $label_key - * (optional) The key used for the label in plugin definitions. Defaults to - * label. + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getSortedDefinitions(). */ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') { // Sort the plugins first by category, then by label. + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = isset($definitions) ? $definitions : $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { if ($a['category'] != $b['category']) { @@ -99,9 +97,10 @@ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'la } /** - * See \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getGroupedDefinitions(). + * Implements \Drupal\Component\Plugin\CategorizingPluginManagerInterface::getGroupedDefinitions(). */ public function getGroupedDefinitions(array $definitions = NULL) { + /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = isset($definitions) ? $definitions : $this->getDefinitions(); $grouped_definitions = array(); foreach ($definitions as $id => $definition) {