Verified Commit 7b931dcb authored by Dave Long's avatar Dave Long
Browse files

task: #3520730 Fix PHPStan arguments.count error related to interface argument...

task: #3520730 Fix PHPStan arguments.count error related to interface argument additions in the next major

By: mondrake
By: smustgrave
By: xjm
(cherry picked from commit 13d18b6b)
parent f2c0dd19
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
%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\\workspaces\\WorkspaceManager::setActiveWorkspace\(\)" method will require a new "bool \$persist" argument in the next major version of its interface%
%The "Drupal\\(?:Core\\(?:Action|Field|Condition)|(?:user|action_test|action_bulk_test|user_batch_action_test)\\Plugin\\Action)\\.*::execute\(\)" method will require a new "object\|null \$object" argument in the next major version of its interface "Drupal\\Core\\Executable\\ExecutableInterface"%
%The "(?:Drupal\\Core\\Layout\\LayoutPluginManagerInterface|Drupal\\Core\\Block\\BlockManager)::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"%
%.*::getDefaultOperations\(\) will require a new "\Drupal\Core\Cache\CacheableMetadata|null \$cacheability" argument in the next major version of its parent class%
%.*::getOperations\(\) will require a new "\Drupal\Core\Cache\CacheableMetadata|null \$cacheability" argument in the next major version of its interface%
%Class "Drupal\\migrate_drupal\\Plugin\\migrate\\source\\DrupalSqlBase" as extended by "Drupal\\(ban|block|block_content|comment|config_translation|contact|content_translation|field|file|filter|image|language|menu_link_content|migrate_drupal|node|path|responsive_image|search|shortcut|system|taxonomy|update|user)\\[^"]+" is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0%
+0 −18
Original line number Diff line number Diff line
@@ -1207,12 +1207,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',
@@ -1754,12 +1748,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',
@@ -5888,12 +5876,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',
+16 −2
Original line number Diff line number Diff line
@@ -21,11 +21,18 @@ public function getCategories();
   * @param array[]|null $definitions
   *   (optional) The plugin definitions to sort. If omitted, all plugin
   *   definitions are used.
   * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch
   * @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.
   *
   * @see https://www.drupal.org/project/drupal/issues/3354672
   *
   * @todo Uncomment the new $label_key method parameter before drupal:12.0.0.
   */
  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 +43,18 @@ public function getSortedDefinitions(?array $definitions = NULL);
   * @param array[]|null $definitions
   *   (optional) The plugin definitions to group. If omitted, all plugin
   *   definitions are used.
   * phpcs:ignore Drupal.Commenting.FunctionComment.ParamNameNoMatch
   * @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.
   *
   * @see https://www.drupal.org/project/drupal/issues/3354672
   *
   * @todo Uncomment the new $label_key method parameter before drupal:12.0.0.
   */
  public function getGroupedDefinitions(?array $definitions = NULL);
  public function getGroupedDefinitions(?array $definitions = NULL /*, string $label_key = 'label' */);

}
+1 −0
Original line number Diff line number Diff line
@@ -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);
    }
  }
+5 −7
Original line number Diff line number Diff line
@@ -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),
              };
            }
          }
        }
Loading