Skip to content
Snippets Groups Projects

Fix array params

Closed Michael Strelan requested to merge issue/drupal-3463440:3463440-fix-array-param into 11.x
10 unresolved threads

Closes #3463440

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
196 196 /**
197 197 * Gets a consolidated list of file mappings from all allowed packages.
198 198 *
199 * @param \Composer\Package\Package[] $allowed_packages
199 * @param \Composer\Package\PackageInterface[] $allowed_packages
  • 331 331 *
    332 332 * @param \Composer\Package\PackageInterface $package
    333 333 * The package to clean.
    334 * @param string $paths_for_package
    334 * @param string[] $paths_for_package
  • 353 353 /**
    354 354 * Gets a private service definition in a suitable format.
    355 355 *
    356 * @param string $id
    356 * @param string|null $id
  • 39 39 /**
    40 40 * Author(s) of the file.
    41 41 *
    42 * @var string
    42 * @var string[]
  • 24 24 * If the command is a response to a request from an #ajax form element then
    25 25 * this value can be NULL.
    26 26 *
    27 * @var string
    27 * @var string|null
  • 25 25 * the plugin. The array is keyed by context names.
    26 26 * @param class-string|null $deriver
    27 27 * (optional) The deriver class.
    28 * @param string[] $forms
    29 * (optional) An array of form class names keyed by a string.
    28 * @param array<string, string|false> $forms
    29 * (optional) An array of form class names or FALSE, keyed by a string.
    • Comment on lines -28 to +29

      The key must be a string, but the value can be FALSE, for example in PageTitleBlock

      forms: [
        'settings_tray' => FALSE,
      ]
    • I think there is a question about this line and coding standards. The @param is to be followed by a data type indicator. Those docs do not specify anything for the "<" or ">" style, nor is there an example of such usages. However, this style was first introduced in commit 54fad06e and there are other usages. Based on that we need an issue in Coding Standards project to update the documentation to include this type of example.

      When I read the comment though I think that $forms can be FALSE, so I think it needs a tweak. Maybe something like "(optional) An associative array where the key is the form class name and the values are ?. The value may be FALSE."

    • @quietone are you suggesting that if we open the issue in coding standards we can commit this as it is (with the tweaked description) while waiting for the coding standards process to run its course, given the precedent already exist? If we have to wait for that process I'd rather just change this to @param array and improve it later in a followup.

    • I'm trying to improve the description for $forms but I'm struggling to figure out what it's used for. It seems it is either an empty array, ['settings_tray' => FALSE], ['settings_tray' => SomeClass], or ['secondary' => SomeClass].

      It looks like there is a whole heap of docs in settings_tray.api.php which is probably now out of date, and I don't have the patience to try understand it. It doesn't seem like this should be part of the Block attribute, and was not previously mentioned in the Block annotation.

      The only instance of 'secondary' is in test_multiple_forms_block which probably gives more clues about why we have this.

    • Please register or sign in to reply
  • 611 611 /**
    612 612 * Updates the kernel module list.
    613 613 *
    614 * @param string[] $module_filenames
    614 * @param \Drupal\Core\Extension\Extension[] $module_filenames
  • added 1 commit

    Compare with previous version

  • 198 198 *
    199 199 * @param string $name
    200 200 * The name of the parameter.
    201 * @param string $value
    201 * @param string|array|bool $value
  • 40 40 * - it's a configuration entity.
    41 41 * - its dependencies can be met.
    42 42 *
    43 * @param \Drupal\Core\Config\StorageInterface $storage
    43 * @param \Drupal\Core\Config\StorageInterface|null $storage
  • 434 434 *
    435 435 * @param int $expected_status_code
    436 436 * The expected response status.
    437 * @param string $expected_message
    437 * @param string|false $expected_message
  • added 1 commit

    Compare with previous version

  • reopened

  • Please register or sign in to reply
    Loading