From fd86d7bd6c7db2dd01f3a495d686e460481b7c17 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 13:24:22 +0000 Subject: [PATCH 01/16] Update 4 files - /core/lib/Drupal/Core/Executable/ExecutableInterface.php - /core/lib/Drupal/Core/Block/BlockManager.php - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php - /core/.phpstan-baseline.php --- core/.phpstan-baseline.php | 18 ------------------ core/lib/Drupal/Core/Block/BlockManager.php | 6 ++---- .../Core/Executable/ExecutableInterface.php | 5 ++++- .../Plugin/CategorizingPluginManagerTrait.php | 2 +- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 6f4a52139f11..8b6bcefcebd6 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -1225,12 +1225,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Action/ActionBase.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Core\\\\Executable\\\\ExecutableInterface\\:\\:execute\\(\\) invoked with 1 parameter, 0 required\\.$#', - 'identifier' => 'arguments.count', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Action/ActionBase.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Core\\\\Action\\\\ActionInterface\\:\\:executeMultiple\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -1765,12 +1759,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockBase.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockManager\\:\\:getSortedDefinitions\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#', - 'identifier' => 'arguments.count', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockManager\\:\\:processDefinition\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -5959,12 +5947,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Core\\\\Entity\\\\Sql\\\\SqlContentEntityStorageSchema\\:\\:addUniqueKey\\(\\) invoked with 4 parameters, 3 required\\.$#', - 'identifier' => 'arguments.count', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Core\\\\Entity\\\\Sql\\\\SqlContentEntityStorageSchema\\:\\:copyData\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php index 284cd72220df..7382a62cdd58 100644 --- a/core/lib/Drupal/Core/Block/BlockManager.php +++ b/core/lib/Drupal/Core/Block/BlockManager.php @@ -20,9 +20,7 @@ */ class BlockManager extends DefaultPluginManager implements BlockManagerInterface, FallbackPluginManagerInterface { - use CategorizingPluginManagerTrait { - getSortedDefinitions as traitGetSortedDefinitions; - } + use CategorizingPluginManagerTrait; use FilteredPluginManagerTrait; /** @@ -73,7 +71,7 @@ public function processDefinition(&$definition, $plugin_id) { */ public function getSortedDefinitions(?array $definitions = NULL) { // Sort the plugins first by category, then by admin label. - $definitions = $this->traitGetSortedDefinitions($definitions, 'admin_label'); + $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); // Do not display the 'broken' plugin in the UI. unset($definitions['broken']); return $definitions; diff --git a/core/lib/Drupal/Core/Executable/ExecutableInterface.php b/core/lib/Drupal/Core/Executable/ExecutableInterface.php index b5967505540a..b8d0c9aabbb9 100644 --- a/core/lib/Drupal/Core/Executable/ExecutableInterface.php +++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php @@ -11,7 +11,10 @@ interface ExecutableInterface { /** * Executes the plugin. + * + * @param object|null $object + * (Optional) An object to execute the plugin on/with. */ - public function execute(); + public function execute(?object $object = NULL); } diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 5f341f07ce78..e1980cad84cb 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -108,7 +108,7 @@ public function getCategories() { /** * {@inheritdoc} */ - public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label') { + public function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, $label_key = 'label') { // Sort the plugins first by category, then by label. $definitions = $definitions ?? $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { -- GitLab From 6cb34660c898c3a1038f3583cdfc879c1b24bb26 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 13:37:50 +0000 Subject: [PATCH 02/16] Update file CategorizingPluginManagerTrait.php --- .../Core/Plugin/CategorizingPluginManagerTrait.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index e1980cad84cb..c05d3fdf98b9 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -108,7 +108,14 @@ public function getCategories() { /** * {@inheritdoc} */ - public function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, $label_key = 'label') { + public function getSortedDefinitions(?array $definitions = NULL) { + return $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'label'); + } + + /** + * {@inheritdoc} + */ + protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, $label_key = 'label') { // Sort the plugins first by category, then by label. $definitions = $definitions ?? $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { -- GitLab From 62a650b56cde83acba8de866961be445442ea51f Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 13:51:37 +0000 Subject: [PATCH 03/16] Update 3 files - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php - /core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php - /core/.phpstan-baseline.php --- core/.phpstan-baseline.php | 6 ------ .../Entity/Sql/SqlContentEntityStorageSchema.php | 12 +++++------- .../Core/Plugin/CategorizingPluginManagerTrait.php | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 8b6bcefcebd6..b26f1ddc26d9 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -1771,12 +1771,6 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockManager\\:\\:traitGetSortedDefinitions\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockPluginInterface\\:\\:blockSubmit\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 6473a846133f..87fde408a6f9 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1935,17 +1935,12 @@ protected function createEntitySchemaIndexes(array $entity_schema, ?FieldStorage $column_names = $table_mapping->getColumnNames($storage_definition->getName()); } - $index_keys = [ - 'indexes' => 'addIndex', - 'unique keys' => 'addUniqueKey', - ]; - foreach ($this->getEntitySchemaData($this->entityType, $entity_schema) as $table_name => $schema) { // Add fields schema because database driver may depend on this data to // perform index normalization. $schema['fields'] = $entity_schema[$table_name]['fields']; - foreach ($index_keys as $key => $add_method) { + foreach (['indexes', 'unique keys'] as $key) { if (!empty($schema[$key])) { foreach ($schema[$key] as $name => $specifier) { // If a set of field columns were specified we process only indexes @@ -1968,7 +1963,10 @@ protected function createEntitySchemaIndexes(array $entity_schema, ?FieldStorage } } if ($create) { - $this->{$add_method}($table_name, $name, $specifier, $schema); + match ($key) { + 'indexes' => $this->addIndex($table_name, $name, $specifier, $schema); + 'unique keys' => $this->addUniqueKey($table_name, $name, $specifier); + }; } } } diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index c05d3fdf98b9..145991131dd4 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -115,7 +115,7 @@ public function getSortedDefinitions(?array $definitions = NULL) { /** * {@inheritdoc} */ - protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, $label_key = 'label') { + protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { // Sort the plugins first by category, then by label. $definitions = $definitions ?? $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { -- GitLab From bf0624a9f6f7d313dddfd3c54cac42775ab37f15 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 13:55:06 +0000 Subject: [PATCH 04/16] Update file SqlContentEntityStorageSchema.php --- .../Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 87fde408a6f9..f09c590693ee 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1964,8 +1964,8 @@ protected function createEntitySchemaIndexes(array $entity_schema, ?FieldStorage } if ($create) { match ($key) { - 'indexes' => $this->addIndex($table_name, $name, $specifier, $schema); - 'unique keys' => $this->addUniqueKey($table_name, $name, $specifier); + 'indexes' => $this->addIndex($table_name, $name, $specifier, $schema), + 'unique keys' => $this->addUniqueKey($table_name, $name, $specifier), }; } } -- GitLab From 73d5eaf191a312a57ee35acf5dbdc6ac08906c1b Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 14:09:34 +0000 Subject: [PATCH 05/16] Update 3 files - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php - /core/lib/Drupal/Core/Executable/ExecutableInterface.php - /core/lib/Drupal/Core/Action/ActionBase.php --- core/lib/Drupal/Core/Action/ActionBase.php | 1 + core/lib/Drupal/Core/Executable/ExecutableInterface.php | 6 +++++- .../Drupal/Core/Plugin/CategorizingPluginManagerTrait.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Action/ActionBase.php b/core/lib/Drupal/Core/Action/ActionBase.php index cb009c30efd5..5c8ccbca1e1b 100644 --- a/core/lib/Drupal/Core/Action/ActionBase.php +++ b/core/lib/Drupal/Core/Action/ActionBase.php @@ -19,6 +19,7 @@ abstract class ActionBase extends PluginBase implements ActionInterface { */ public function executeMultiple(array $entities) { foreach ($entities as $entity) { + // @phpstan-ignore arguments.count $this->execute($entity); } } diff --git a/core/lib/Drupal/Core/Executable/ExecutableInterface.php b/core/lib/Drupal/Core/Executable/ExecutableInterface.php index b8d0c9aabbb9..235169cdc38e 100644 --- a/core/lib/Drupal/Core/Executable/ExecutableInterface.php +++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php @@ -12,9 +12,13 @@ interface ExecutableInterface { /** * Executes the plugin. * + * phpcs:disable Drupal.Commenting + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 + * * @param object|null $object * (Optional) An object to execute the plugin on/with. */ - public function execute(?object $object = NULL); + public function execute(/* ?object $object = NULL */); } diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 145991131dd4..169d1de96bdc 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -131,7 +131,7 @@ protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = * {@inheritdoc} */ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') { - $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key); + $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions ?? $this->getDefinitions(), $label_key); $grouped_definitions = []; foreach ($definitions as $id => $definition) { $grouped_definitions[(string) $definition['category']][$id] = $definition; -- GitLab From bd051f80bcf666e1c3f379faed0f6b3f454cafc9 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 14:34:19 +0000 Subject: [PATCH 06/16] debug --- core/.deprecation-ignore.txt | 2 +- core/lib/Drupal/Core/Block/BlockManager.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index 72eb56119715..a2769e5e789f 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,4 +40,4 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% - +%The "Drupal\\.*::execute()" method will require a new "object\|null $object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"% diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php index 7382a62cdd58..2735356e11e4 100644 --- a/core/lib/Drupal/Core/Block/BlockManager.php +++ b/core/lib/Drupal/Core/Block/BlockManager.php @@ -72,6 +72,7 @@ public function processDefinition(&$definition, $plugin_id) { public function getSortedDefinitions(?array $definitions = NULL) { // Sort the plugins first by category, then by admin label. $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); + dump($definitions); // Do not display the 'broken' plugin in the UI. unset($definitions['broken']); return $definitions; -- GitLab From 9d000ff1ebb4101878759d3907a29d26371b5a7f Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 14:52:39 +0000 Subject: [PATCH 07/16] debug --- core/.deprecation-ignore.txt | 2 +- core/lib/Drupal/Core/Block/BlockManager.php | 1 - core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index a2769e5e789f..a82673048c64 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,4 +40,4 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% -%The "Drupal\\.*::execute()" method will require a new "object\|null $object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"% +%The "Drupal\\.*::execute\(\)" method will require a new "object\|null \$object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"% diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php index 2735356e11e4..7382a62cdd58 100644 --- a/core/lib/Drupal/Core/Block/BlockManager.php +++ b/core/lib/Drupal/Core/Block/BlockManager.php @@ -72,7 +72,6 @@ public function processDefinition(&$definition, $plugin_id) { public function getSortedDefinitions(?array $definitions = NULL) { // Sort the plugins first by category, then by admin label. $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); - dump($definitions); // Do not display the 'broken' plugin in the UI. unset($definitions['broken']); return $definitions; diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 169d1de96bdc..b5c275cae823 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -131,7 +131,9 @@ protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = * {@inheritdoc} */ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') { + dump($definitions, $label_key); $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions ?? $this->getDefinitions(), $label_key); + dump($definitions); $grouped_definitions = []; foreach ($definitions as $id => $definition) { $grouped_definitions[(string) $definition['category']][$id] = $definition; -- GitLab From 36a1b675c87894b4c6bc23de1aacaf62df2c5bd4 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Wed, 23 Apr 2025 15:20:03 +0000 Subject: [PATCH 08/16] debug --- core/lib/Drupal/Core/Block/BlockManager.php | 10 ++++++++++ .../Core/Plugin/CategorizingPluginManagerTrait.php | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php index 7382a62cdd58..36053d7f89c8 100644 --- a/core/lib/Drupal/Core/Block/BlockManager.php +++ b/core/lib/Drupal/Core/Block/BlockManager.php @@ -77,6 +77,16 @@ public function getSortedDefinitions(?array $definitions = NULL) { return $definitions; } + /** + * {@inheritdoc} + */ + public function getGroupedDefinitions(?array $definitions = NULL) { + $definitions = $this->getGroupedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); + // Do not display the 'broken' plugin in the UI. + unset($definitions['broken']); + return $definitions; + } + /** * {@inheritdoc} */ diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index b5c275cae823..5842993d61bd 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -130,14 +130,20 @@ protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = /** * {@inheritdoc} */ - public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') { - dump($definitions, $label_key); + public function getGroupedDefinitions(?array $definitions = NULL) { + return $this->getGroupedDefinitionsByCategoryAndLabel($definitions, 'label'); + } + + /** + * {@inheritdoc} + */ + protected function getGroupedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions ?? $this->getDefinitions(), $label_key); - dump($definitions); $grouped_definitions = []; foreach ($definitions as $id => $definition) { $grouped_definitions[(string) $definition['category']][$id] = $definition; } + dump($grouped_definitions); return $grouped_definitions; } -- GitLab From 41b7fe62d5920875baa1ac2379abb87524c87c3a Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Thu, 24 Apr 2025 08:44:47 +0000 Subject: [PATCH 09/16] Update 5 files - /core/.deprecation-ignore.txt - /core/modules/user/src/Plugin/Action/AddRoleUser.php - /core/modules/user/src/Plugin/Action/RemoveRoleUser.php - /core/lib/Drupal/Core/Field/FieldTypePluginManager.php - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php --- core/.deprecation-ignore.txt | 1 - .../Core/Field/FieldTypePluginManager.php | 6 ++--- .../Plugin/CategorizingPluginManagerTrait.php | 27 ++++++++++++++++--- .../user/src/Plugin/Action/AddRoleUser.php | 5 ++-- .../user/src/Plugin/Action/RemoveRoleUser.php | 5 ++-- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index a82673048c64..d6ee5a699ccb 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,4 +40,3 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% -%The "Drupal\\.*::execute\(\)" method will require a new "object\|null \$object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"% diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 5927e6a1ea3b..1e937a093de2 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -18,9 +18,7 @@ */ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePluginManagerInterface { - use CategorizingPluginManagerTrait { - getGroupedDefinitions as protected getGroupedDefinitionsTrait; - } + use CategorizingPluginManagerTrait; /** * Constructs the FieldTypePluginManager object. @@ -174,7 +172,7 @@ public function getFieldSettingsSummary(FieldDefinitionInterface $field_definiti * plugin IDs and the values are plugin definitions. */ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label', $category_label_key = 'label') { - $grouped_categories = $this->getGroupedDefinitionsTrait($definitions, $label_key); + $grouped_categories = $this->getGroupedDefinitionsByCategoryAndLabel($definitions, $label_key); $category_info = $this->fieldTypeCategoryManager->getDefinitions(); // Ensure that all the referenced categories exist. diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 5842993d61bd..7c9a59a076e4 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -113,7 +113,16 @@ public function getSortedDefinitions(?array $definitions = NULL) { } /** - * {@inheritdoc} + * Gets sorted plugin definitions. + * + * @param array[]|null $definitions + * (optional) The plugin definitions to sort. If omitted, all plugin + * definitions are used. + * @param string $label_key + * (optional) The key to be used as a label for sorting. + * + * @return array[] + * An array of plugin definitions, sorted by category and label. */ protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { // Sort the plugins first by category, then by label. @@ -135,7 +144,20 @@ public function getGroupedDefinitions(?array $definitions = NULL) { } /** - * {@inheritdoc} + * Gets sorted plugin definitions grouped by category. + * + * In addition to grouping, both categories and its entries are sorted, + * whereas plugin definitions are sorted by label. + * + * @param array[]|null $definitions + * (optional) The plugin definitions to group. If omitted, all plugin + * definitions are used. + * @param string $label_key + * (optional) The key to be used as a label for sorting. + * + * @return array[] + * Keys are category names, and values are arrays of which the keys are + * plugin IDs and the values are plugin definitions. */ protected function getGroupedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions ?? $this->getDefinitions(), $label_key); @@ -143,7 +165,6 @@ protected function getGroupedDefinitionsByCategoryAndLabel(?array $definitions = foreach ($definitions as $id => $definition) { $grouped_definitions[(string) $definition['category']][$id] = $definition; } - dump($grouped_definitions); return $grouped_definitions; } diff --git a/core/modules/user/src/Plugin/Action/AddRoleUser.php b/core/modules/user/src/Plugin/Action/AddRoleUser.php index 11a425c63cb7..b42b971b5d07 100644 --- a/core/modules/user/src/Plugin/Action/AddRoleUser.php +++ b/core/modules/user/src/Plugin/Action/AddRoleUser.php @@ -18,10 +18,11 @@ class AddRoleUser extends ChangeUserRoleBase { /** * {@inheritdoc} */ - public function execute($account = NULL) { + public function execute(?object $object = NULL) { + $account = $object; $rid = $this->configuration['rid']; // Skip adding the role to the user if they already have it. - if ($account !== FALSE && !$account->hasRole($rid)) { + if ($account !== NULL && !$account->hasRole($rid)) { // For efficiency manually save the original account before applying // any changes. $account->setOriginal(clone $account); diff --git a/core/modules/user/src/Plugin/Action/RemoveRoleUser.php b/core/modules/user/src/Plugin/Action/RemoveRoleUser.php index 2bc8e7e84d81..8514510730e9 100644 --- a/core/modules/user/src/Plugin/Action/RemoveRoleUser.php +++ b/core/modules/user/src/Plugin/Action/RemoveRoleUser.php @@ -18,10 +18,11 @@ class RemoveRoleUser extends ChangeUserRoleBase { /** * {@inheritdoc} */ - public function execute($account = NULL) { + public function execute(?object $object = NULL) { + $account = $object; $rid = $this->configuration['rid']; // Skip removing the role from the user if they already don't have it. - if ($account !== FALSE && $account->hasRole($rid)) { + if ($account !== NULL && $account->hasRole($rid)) { // For efficiency manually save the original account before applying // any changes. $account->setOriginal(clone $account); -- GitLab From b1c2745603b9ae43c09ffdc133741feb5e312ff2 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Thu, 24 Apr 2025 09:02:01 +0000 Subject: [PATCH 10/16] Update 4 files - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php - /core/lib/Drupal/Core/Field/FieldTypePluginManager.php - /core/lib/Drupal/Core/Block/BlockManager.php - /core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php --- .../CategorizingPluginManagerInterface.php | 16 ++++++- core/lib/Drupal/Core/Block/BlockManager.php | 16 ++----- .../Core/Field/FieldTypePluginManager.php | 6 ++- .../Plugin/CategorizingPluginManagerTrait.php | 42 ++----------------- 4 files changed, 25 insertions(+), 55 deletions(-) diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index d6d1e37067ef..17dcd81418c3 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -15,17 +15,23 @@ interface CategorizingPluginManagerInterface extends PluginManagerInterface { */ public function getCategories(); + // phpcs:disable Drupal.Commenting + /** * Gets sorted plugin definitions. * * @param array[]|null $definitions * (optional) The plugin definitions to sort. If omitted, all plugin * definitions are used. + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 + * @param string $label_key + * (optional) The key to be used as a label for sorting. * * @return array[] * An array of plugin definitions, sorted by category and label. */ - public function getSortedDefinitions(?array $definitions = NULL); + public function getSortedDefinitions(?array $definitions = NULL /*, string $label_key = 'label' */); /** * Gets sorted plugin definitions grouped by category. @@ -36,11 +42,17 @@ public function getSortedDefinitions(?array $definitions = NULL); * @param array[]|null $definitions * (optional) The plugin definitions to group. If omitted, all plugin * definitions are used. + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 + * @param string $label_key + * (optional) The key to be used as a label for sorting. * * @return array[] * Keys are category names, and values are arrays of which the keys are * plugin IDs and the values are plugin definitions. */ - public function getGroupedDefinitions(?array $definitions = NULL); + public function getGroupedDefinitions(?array $definitions = NULL /*, string $label_key = 'label' */); + + // phpcs:enable } diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php index 36053d7f89c8..284cd72220df 100644 --- a/core/lib/Drupal/Core/Block/BlockManager.php +++ b/core/lib/Drupal/Core/Block/BlockManager.php @@ -20,7 +20,9 @@ */ class BlockManager extends DefaultPluginManager implements BlockManagerInterface, FallbackPluginManagerInterface { - use CategorizingPluginManagerTrait; + use CategorizingPluginManagerTrait { + getSortedDefinitions as traitGetSortedDefinitions; + } use FilteredPluginManagerTrait; /** @@ -71,17 +73,7 @@ public function processDefinition(&$definition, $plugin_id) { */ public function getSortedDefinitions(?array $definitions = NULL) { // Sort the plugins first by category, then by admin label. - $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); - // Do not display the 'broken' plugin in the UI. - unset($definitions['broken']); - return $definitions; - } - - /** - * {@inheritdoc} - */ - public function getGroupedDefinitions(?array $definitions = NULL) { - $definitions = $this->getGroupedDefinitionsByCategoryAndLabel($definitions, 'admin_label'); + $definitions = $this->traitGetSortedDefinitions($definitions, 'admin_label'); // Do not display the 'broken' plugin in the UI. unset($definitions['broken']); return $definitions; diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 1e937a093de2..5927e6a1ea3b 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -18,7 +18,9 @@ */ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePluginManagerInterface { - use CategorizingPluginManagerTrait; + use CategorizingPluginManagerTrait { + getGroupedDefinitions as protected getGroupedDefinitionsTrait; + } /** * Constructs the FieldTypePluginManager object. @@ -172,7 +174,7 @@ public function getFieldSettingsSummary(FieldDefinitionInterface $field_definiti * plugin IDs and the values are plugin definitions. */ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label', $category_label_key = 'label') { - $grouped_categories = $this->getGroupedDefinitionsByCategoryAndLabel($definitions, $label_key); + $grouped_categories = $this->getGroupedDefinitionsTrait($definitions, $label_key); $category_info = $this->fieldTypeCategoryManager->getDefinitions(); // Ensure that all the referenced categories exist. diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 7c9a59a076e4..67b1c93253a3 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -108,23 +108,7 @@ public function getCategories() { /** * {@inheritdoc} */ - public function getSortedDefinitions(?array $definitions = NULL) { - return $this->getSortedDefinitionsByCategoryAndLabel($definitions, 'label'); - } - - /** - * Gets sorted plugin definitions. - * - * @param array[]|null $definitions - * (optional) The plugin definitions to sort. If omitted, all plugin - * definitions are used. - * @param string $label_key - * (optional) The key to be used as a label for sorting. - * - * @return array[] - * An array of plugin definitions, sorted by category and label. - */ - protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { + public function getSortedDefinitions(?array $definitions = NULL, string $label_key = 'label') { // Sort the plugins first by category, then by label. $definitions = $definitions ?? $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { @@ -139,28 +123,8 @@ protected function getSortedDefinitionsByCategoryAndLabel(?array $definitions = /** * {@inheritdoc} */ - public function getGroupedDefinitions(?array $definitions = NULL) { - return $this->getGroupedDefinitionsByCategoryAndLabel($definitions, 'label'); - } - - /** - * Gets sorted plugin definitions grouped by category. - * - * In addition to grouping, both categories and its entries are sorted, - * whereas plugin definitions are sorted by label. - * - * @param array[]|null $definitions - * (optional) The plugin definitions to group. If omitted, all plugin - * definitions are used. - * @param string $label_key - * (optional) The key to be used as a label for sorting. - * - * @return array[] - * Keys are category names, and values are arrays of which the keys are - * plugin IDs and the values are plugin definitions. - */ - protected function getGroupedDefinitionsByCategoryAndLabel(?array $definitions = NULL, string $label_key = 'label'): array { - $definitions = $this->getSortedDefinitionsByCategoryAndLabel($definitions ?? $this->getDefinitions(), $label_key); + public function getGroupedDefinitions(?array $definitions = NULL, string $label_key = 'label') { + $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key); $grouped_definitions = []; foreach ($definitions as $id => $definition) { $grouped_definitions[(string) $definition['category']][$id] = $definition; -- GitLab From 0d3a5d413f18c6a4e75b533b89b72b89f24942d9 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Thu, 24 Apr 2025 09:17:11 +0000 Subject: [PATCH 11/16] Update 3 files - /core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php - /core/.phpstan-baseline.php - /core/.deprecation-ignore.txt --- core/.deprecation-ignore.txt | 1 + core/.phpstan-baseline.php | 6 ++++++ .../Drupal/Core/Plugin/CategorizingPluginManagerTrait.php | 1 + 3 files changed, 8 insertions(+) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index d6ee5a699ccb..82261b193ba2 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,3 +40,4 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% +%The "Drupal\\.*::get(?:Sorted|Grouped)Definitions\(\)" method will require a new "string \$label_key" argument in the next major version of its interface "Drupal\\Component\\Plugin\\CategorizingPluginManagerInterface"% \ No newline at end of file diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index b26f1ddc26d9..8b6bcefcebd6 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -1771,6 +1771,12 @@ 'count' => 1, 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockManager\\:\\:traitGetSortedDefinitions\\(\\) has no return type specified\\.$#', + 'identifier' => 'missingType.return', + 'count' => 1, + 'path' => __DIR__ . '/lib/Drupal/Core/Block/BlockManager.php', +]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Core\\\\Block\\\\BlockPluginInterface\\:\\:blockSubmit\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 67b1c93253a3..b1239e2e71a1 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -124,6 +124,7 @@ public function getSortedDefinitions(?array $definitions = NULL, string $label_k * {@inheritdoc} */ public function getGroupedDefinitions(?array $definitions = NULL, string $label_key = 'label') { + // @phpstan-ignore arguments.count $definitions = $this->getSortedDefinitions($definitions ?? $this->getDefinitions(), $label_key); $grouped_definitions = []; foreach ($definitions as $id => $definition) { -- GitLab From 00a448e1f38f9fda637b56f9738dc3acd36e41f5 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Thu, 24 Apr 2025 09:17:48 +0000 Subject: [PATCH 12/16] Edit .deprecation-ignore.txt --- core/.deprecation-ignore.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index 82261b193ba2..1099b764c366 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,4 +40,4 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% -%The "Drupal\\.*::get(?:Sorted|Grouped)Definitions\(\)" method will require a new "string \$label_key" argument in the next major version of its interface "Drupal\\Component\\Plugin\\CategorizingPluginManagerInterface"% \ No newline at end of file +%The "Drupal\\.*::get(?:Sorted|Grouped)Definitions\(\)" method will require a new "string \$label_key" argument in the next major version of its interface "Drupal\\Component\\Plugin\\CategorizingPluginManagerInterface"% -- GitLab From 36c56c08c3319a32c088123a9ec6afd99fcb0ef8 Mon Sep 17 00:00:00 2001 From: mondrake <28163-mondrake@users.noreply.drupalcode.org> Date: Thu, 24 Apr 2025 09:38:17 +0000 Subject: [PATCH 13/16] Update 3 files - /core/.deprecation-ignore.txt - /core/modules/user/src/Plugin/Action/RemoveRoleUser.php - /core/modules/user/src/Plugin/Action/AddRoleUser.php --- core/.deprecation-ignore.txt | 1 + core/modules/user/src/Plugin/Action/AddRoleUser.php | 5 ++--- core/modules/user/src/Plugin/Action/RemoveRoleUser.php | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index 1099b764c366..bc9bbb405197 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -40,4 +40,5 @@ %The "Drupal\\Core\\Database\\Query\\SelectExtender::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAllTags\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% %The "Drupal\\Core\\Entity\\Query\\QueryBase::hasAnyTag\(\)" method will require a new "string \.\.\. \$tags" argument in the next major version of its interface% +%The "Drupal\\.*::execute\(\)" method will require a new "object\|null \$object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"% %The "Drupal\\.*::get(?:Sorted|Grouped)Definitions\(\)" method will require a new "string \$label_key" argument in the next major version of its interface "Drupal\\Component\\Plugin\\CategorizingPluginManagerInterface"% diff --git a/core/modules/user/src/Plugin/Action/AddRoleUser.php b/core/modules/user/src/Plugin/Action/AddRoleUser.php index b42b971b5d07..11a425c63cb7 100644 --- a/core/modules/user/src/Plugin/Action/AddRoleUser.php +++ b/core/modules/user/src/Plugin/Action/AddRoleUser.php @@ -18,11 +18,10 @@ class AddRoleUser extends ChangeUserRoleBase { /** * {@inheritdoc} */ - public function execute(?object $object = NULL) { - $account = $object; + public function execute($account = NULL) { $rid = $this->configuration['rid']; // Skip adding the role to the user if they already have it. - if ($account !== NULL && !$account->hasRole($rid)) { + if ($account !== FALSE && !$account->hasRole($rid)) { // For efficiency manually save the original account before applying // any changes. $account->setOriginal(clone $account); diff --git a/core/modules/user/src/Plugin/Action/RemoveRoleUser.php b/core/modules/user/src/Plugin/Action/RemoveRoleUser.php index 8514510730e9..2bc8e7e84d81 100644 --- a/core/modules/user/src/Plugin/Action/RemoveRoleUser.php +++ b/core/modules/user/src/Plugin/Action/RemoveRoleUser.php @@ -18,11 +18,10 @@ class RemoveRoleUser extends ChangeUserRoleBase { /** * {@inheritdoc} */ - public function execute(?object $object = NULL) { - $account = $object; + public function execute($account = NULL) { $rid = $this->configuration['rid']; // Skip removing the role from the user if they already don't have it. - if ($account !== NULL && $account->hasRole($rid)) { + if ($account !== FALSE && $account->hasRole($rid)) { // For efficiency manually save the original account before applying // any changes. $account->setOriginal(clone $account); -- GitLab From 64e7230b24d5679bb68610880c518aa970e00a2d Mon Sep 17 00:00:00 2001 From: mondrake <mondrake.org@gmail.com> Date: Tue, 17 Jun 2025 22:25:55 +0200 Subject: [PATCH 14/16] narrow phpcs ignores --- .../Plugin/CategorizingPluginManagerInterface.php | 10 ++-------- .../lib/Drupal/Core/Executable/ExecutableInterface.php | 5 +---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index 17dcd81418c3..3db93725fc95 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -15,16 +15,13 @@ interface CategorizingPluginManagerInterface extends PluginManagerInterface { */ public function getCategories(); - // phpcs:disable Drupal.Commenting - /** * Gets sorted plugin definitions. * * @param array[]|null $definitions * (optional) The plugin definitions to sort. If omitted, all plugin * definitions are used. - * @todo Uncomment new method parameter before drupal:12.0.0. - * @see https://www.drupal.org/project/drupal/issues/3354672 + * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param string $label_key * (optional) The key to be used as a label for sorting. * @@ -42,8 +39,7 @@ public function getSortedDefinitions(?array $definitions = NULL /*, string $labe * @param array[]|null $definitions * (optional) The plugin definitions to group. If omitted, all plugin * definitions are used. - * @todo Uncomment new method parameter before drupal:12.0.0. - * @see https://www.drupal.org/project/drupal/issues/3354672 + * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param string $label_key * (optional) The key to be used as a label for sorting. * @@ -53,6 +49,4 @@ public function getSortedDefinitions(?array $definitions = NULL /*, string $labe */ public function getGroupedDefinitions(?array $definitions = NULL /*, string $label_key = 'label' */); - // phpcs:enable - } diff --git a/core/lib/Drupal/Core/Executable/ExecutableInterface.php b/core/lib/Drupal/Core/Executable/ExecutableInterface.php index 235169cdc38e..2883ae62a450 100644 --- a/core/lib/Drupal/Core/Executable/ExecutableInterface.php +++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php @@ -12,10 +12,7 @@ interface ExecutableInterface { /** * Executes the plugin. * - * phpcs:disable Drupal.Commenting - * @todo Uncomment new method parameter before drupal:12.0.0. - * @see https://www.drupal.org/project/drupal/issues/3354672 - * + * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param object|null $object * (Optional) An object to execute the plugin on/with. */ -- GitLab From 43465241674684a6225b810cc7a2a5c3e8f7f8e0 Mon Sep 17 00:00:00 2001 From: mondrake <mondrake.org@gmail.com> Date: Tue, 17 Jun 2025 22:38:25 +0200 Subject: [PATCH 15/16] readd todos --- .../Component/Plugin/CategorizingPluginManagerInterface.php | 4 ++++ core/lib/Drupal/Core/Executable/ExecutableInterface.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index 3db93725fc95..ad06be94f47f 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -21,6 +21,8 @@ public function getCategories(); * @param array[]|null $definitions * (optional) The plugin definitions to sort. If omitted, all plugin * definitions are used. + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param string $label_key * (optional) The key to be used as a label for sorting. @@ -39,6 +41,8 @@ public function getSortedDefinitions(?array $definitions = NULL /*, string $labe * @param array[]|null $definitions * (optional) The plugin definitions to group. If omitted, all plugin * definitions are used. + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param string $label_key * (optional) The key to be used as a label for sorting. diff --git a/core/lib/Drupal/Core/Executable/ExecutableInterface.php b/core/lib/Drupal/Core/Executable/ExecutableInterface.php index 2883ae62a450..be36bd4cf5c1 100644 --- a/core/lib/Drupal/Core/Executable/ExecutableInterface.php +++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php @@ -12,6 +12,8 @@ interface ExecutableInterface { /** * Executes the plugin. * + * @todo Uncomment new method parameter before drupal:12.0.0. + * @see https://www.drupal.org/project/drupal/issues/3354672 * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch * @param object|null $object * (Optional) An object to execute the plugin on/with. -- GitLab From ecbaea6e2300a71671ccc39b8832cb5eaa20d471 Mon Sep 17 00:00:00 2001 From: mondrake <mondrake.org@gmail.com> Date: Tue, 17 Jun 2025 22:44:05 +0200 Subject: [PATCH 16/16] phpcs ignore --- .../Component/Plugin/CategorizingPluginManagerInterface.php | 2 ++ core/lib/Drupal/Core/Executable/ExecutableInterface.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php index ad06be94f47f..7c013c4c87d6 100644 --- a/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php +++ b/core/lib/Drupal/Component/Plugin/CategorizingPluginManagerInterface.php @@ -21,6 +21,7 @@ public function getCategories(); * @param array[]|null $definitions * (optional) The plugin definitions to sort. If omitted, all plugin * definitions are used. + * phpcs:ignore Drupal.Commenting.DocComment.TagGroupSpacing * @todo Uncomment new method parameter before drupal:12.0.0. * @see https://www.drupal.org/project/drupal/issues/3354672 * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch @@ -41,6 +42,7 @@ public function getSortedDefinitions(?array $definitions = NULL /*, string $labe * @param array[]|null $definitions * (optional) The plugin definitions to group. If omitted, all plugin * definitions are used. + * phpcs:ignore Drupal.Commenting.DocComment.TagGroupSpacing * @todo Uncomment new method parameter before drupal:12.0.0. * @see https://www.drupal.org/project/drupal/issues/3354672 * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch diff --git a/core/lib/Drupal/Core/Executable/ExecutableInterface.php b/core/lib/Drupal/Core/Executable/ExecutableInterface.php index be36bd4cf5c1..fce5967894e6 100644 --- a/core/lib/Drupal/Core/Executable/ExecutableInterface.php +++ b/core/lib/Drupal/Core/Executable/ExecutableInterface.php @@ -14,7 +14,7 @@ interface ExecutableInterface { * * @todo Uncomment new method parameter before drupal:12.0.0. * @see https://www.drupal.org/project/drupal/issues/3354672 - * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch + * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch,Drupal.Commenting.DocComment.ParamGroup * @param object|null $object * (Optional) An object to execute the plugin on/with. */ -- GitLab