diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index b09dab6532d670f77e50634c209033e36332281a..f1f8ceb847a36c7851fb8a1291661a35262a57b9 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -1501,18 +1501,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Action/ActionInterface.php', ]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Action/ActionManager.php', -]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getSortedDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Action/ActionManager.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Core\\\\Action\\\\ActionManager\\:\\:processDefinitionCategory\\(\\) has no return type specified\\.$#', @@ -2042,14 +2030,8 @@ 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockBase.php', ]; $ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', -]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getSortedDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', + // identifier: arguments.count + 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockManager\\:\\:getSortedDefinitions\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#', 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', ]; @@ -3049,18 +3031,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Condition/ConditionInterface.php', ]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Condition/ConditionManager.php', -]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getSortedDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Condition/ConditionManager.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Core\\\\Condition\\\\ConditionManager\\:\\:getDefinitionsForContexts\\(\\) has no return type specified\\.$#', @@ -7386,18 +7356,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Field/FieldStorageDefinitionListenerInterface.php', ]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Field/FieldTypePluginManager.php', -]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getSortedDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Field/FieldTypePluginManager.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Core\\\\Field\\\\FieldTypePluginManager\\:\\:getGroupedDefinitionsTrait\\(\\) has no return type specified\\.$#', @@ -61558,18 +61516,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php', ]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php', -]; -$ignoreErrors[] = [ - // identifier: class.notFound - 'message' => '#^Call to method getSortedDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Plugin\\\\CategorizingPluginManager\\:\\:processDefinitionCategory\\(\\) has no return type specified\\.$#', diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index e7dde93d0f8458b2f13bc4ecbcca17fe3439ca64..5f341f07ce78132902ce475fca180fed7ec3a800 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -124,7 +124,6 @@ public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'l * {@inheritdoc} */ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') { - /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key); $grouped_definitions = []; foreach ($definitions as $id => $definition) { @@ -133,4 +132,9 @@ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = ' return $grouped_definitions; } + /** + * {@inheritdoc} + */ + abstract public function getDefinitions(); + }