From fa418559a4c87930a7edf588dc3aebff7c7b7161 Mon Sep 17 00:00:00 2001
From: nod_ <nod_@598310.no-reply.drupal.org>
Date: Thu, 22 Aug 2024 16:31:12 +0200
Subject: [PATCH] Issue #3463440 by mstrelan, smustgrave, quietone, longwave:
 Fix param docs identified by phpstan

---
 composer/Plugin/Scaffold/Handler.php                        | 2 +-
 composer/Plugin/VendorHardening/VendorHardeningPlugin.php   | 2 +-
 .../DependencyInjection/Dumper/OptimizedPhpArrayDumper.php  | 2 +-
 core/lib/Drupal/Component/Gettext/PoHeader.php              | 2 +-
 core/lib/Drupal/Component/Gettext/PoItem.php                | 6 ++++--
 core/lib/Drupal/Core/Ajax/InsertCommand.php                 | 4 ++--
 core/lib/Drupal/Core/Block/Attribute/Block.php              | 4 ++--
 core/lib/Drupal/Core/Config/ConfigInstallerInterface.php    | 2 +-
 core/lib/Drupal/Core/Extension/ModuleInstaller.php          | 2 +-
 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php      | 2 +-
 core/modules/rest/tests/src/Functional/ResourceTestBase.php | 2 +-
 .../Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php  | 4 ++--
 12 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/composer/Plugin/Scaffold/Handler.php b/composer/Plugin/Scaffold/Handler.php
index 8ee27990cec9..cf43d9d13871 100644
--- a/composer/Plugin/Scaffold/Handler.php
+++ b/composer/Plugin/Scaffold/Handler.php
@@ -196,7 +196,7 @@ protected function getVendorPath() {
   /**
    * Gets a consolidated list of file mappings from all allowed packages.
    *
-   * @param \Composer\Package\Package[] $allowed_packages
+   * @param \Composer\Package\PackageInterface[] $allowed_packages
    *   A multidimensional array of file mappings, as returned by
    *   self::getAllowedPackages().
    *
diff --git a/composer/Plugin/VendorHardening/VendorHardeningPlugin.php b/composer/Plugin/VendorHardening/VendorHardeningPlugin.php
index 133640cc4be8..c4eb88b939a2 100644
--- a/composer/Plugin/VendorHardening/VendorHardeningPlugin.php
+++ b/composer/Plugin/VendorHardening/VendorHardeningPlugin.php
@@ -331,7 +331,7 @@ public function cleanPackage(PackageInterface $package): void {
    *
    * @param \Composer\Package\PackageInterface $package
    *   The package to clean.
-   * @param string $paths_for_package
+   * @param string[] $paths_for_package
    *   List of directories in $package_name to remove
    */
   protected function cleanPathsForPackage(PackageInterface $package, $paths_for_package): void {
diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
index cb98bca41e82..7298ee3ab4e0 100644
--- a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
+++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
@@ -353,7 +353,7 @@ protected function dumpCallable($callable) {
   /**
    * Gets a private service definition in a suitable format.
    *
-   * @param string $id
+   * @param string|null $id
    *   The ID of the service to get a private definition for.
    * @param \Symfony\Component\DependencyInjection\Definition $definition
    *   The definition to process.
diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php
index 0449ba6f6b81..362d098cb767 100644
--- a/core/lib/Drupal/Component/Gettext/PoHeader.php
+++ b/core/lib/Drupal/Component/Gettext/PoHeader.php
@@ -39,7 +39,7 @@ class PoHeader {
   /**
    * Author(s) of the file.
    *
-   * @var string
+   * @var string[]
    */
   protected $authors;
 
diff --git a/core/lib/Drupal/Component/Gettext/PoItem.php b/core/lib/Drupal/Component/Gettext/PoItem.php
index 9aa26cc5bfc1..41014c9648d6 100644
--- a/core/lib/Drupal/Component/Gettext/PoItem.php
+++ b/core/lib/Drupal/Component/Gettext/PoItem.php
@@ -105,7 +105,8 @@ public function setContext($context) {
   /**
    * Gets the source string(s) if the translation has plurals.
    *
-   * @return string or array $translation
+   * @return string|array
+   *   The source string or array of strings if it has plurals.
    */
   public function getSource() {
     return $this->source;
@@ -124,7 +125,8 @@ public function setSource($source) {
   /**
    * Gets the translation string(s) if the translation has plurals.
    *
-   * @return string or array $translation
+   * @return string|array
+   *   The translation string or array of strings if it has plurals.
    */
   public function getTranslation() {
     return $this->translation;
diff --git a/core/lib/Drupal/Core/Ajax/InsertCommand.php b/core/lib/Drupal/Core/Ajax/InsertCommand.php
index 92f5155b7930..8a83e795ee76 100644
--- a/core/lib/Drupal/Core/Ajax/InsertCommand.php
+++ b/core/lib/Drupal/Core/Ajax/InsertCommand.php
@@ -24,7 +24,7 @@ class InsertCommand implements CommandInterface, CommandWithAttachedAssetsInterf
    * If the command is a response to a request from an #ajax form element then
    * this value can be NULL.
    *
-   * @var string
+   * @var string|null
    */
   protected $selector;
 
@@ -47,7 +47,7 @@ class InsertCommand implements CommandInterface, CommandWithAttachedAssetsInterf
   /**
    * Constructs an InsertCommand object.
    *
-   * @param string $selector
+   * @param string|null $selector
    *   A CSS selector.
    * @param string|array $content
    *   The content that will be inserted in the matched element(s), either a
diff --git a/core/lib/Drupal/Core/Block/Attribute/Block.php b/core/lib/Drupal/Core/Block/Attribute/Block.php
index d5b6cafb758b..c19487f291f4 100644
--- a/core/lib/Drupal/Core/Block/Attribute/Block.php
+++ b/core/lib/Drupal/Core/Block/Attribute/Block.php
@@ -25,8 +25,8 @@ class Block extends Plugin {
    *   the plugin. The array is keyed by context names.
    * @param class-string|null $deriver
    *   (optional) The deriver class.
-   * @param string[] $forms
-   *   (optional) An array of form class names keyed by a string.
+   * @param array<string, string|false> $forms
+   *   (optional) An array of form class names or FALSE, keyed by a string.
    */
   public function __construct(
     public readonly string $id,
diff --git a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
index d6ac429ce38b..5d90459d4f6c 100644
--- a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
+++ b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php
@@ -40,7 +40,7 @@ public function installDefaultConfig($type, $name);
    * - it's a configuration entity.
    * - its dependencies can be met.
    *
-   * @param \Drupal\Core\Config\StorageInterface $storage
+   * @param \Drupal\Core\Config\StorageInterface|null $storage
    *   (optional) The configuration storage to search for optional
    *   configuration. If not provided, all enabled extension's optional
    *   configuration directories including the install profile's will be
diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
index 0786bf8385f9..4ba14f3ada86 100644
--- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
@@ -616,7 +616,7 @@ function ($definition) {
   /**
    * Updates the kernel module list.
    *
-   * @param string[] $module_filenames
+   * @param \Drupal\Core\Extension\Extension[] $module_filenames
    *   The list of installed modules.
    */
   protected function updateKernel($module_filenames) {
diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
index 9501cbfcdd61..c481b8b15e0a 100644
--- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
+++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
@@ -198,7 +198,7 @@ protected function writeSettings(array $settings) {
    *
    * @param string $name
    *   The name of the parameter.
-   * @param string $value
+   * @param string|array|bool $value
    *   The value of the parameter.
    */
   protected function setContainerParameter($name, $value) {
diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
index 8ef7823ffcfb..7f07479cb996 100644
--- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
@@ -407,7 +407,7 @@ protected function assertResourceResponse($expected_status_code, $expected_body,
    *
    * @param int $expected_status_code
    *   The expected response status.
-   * @param string $expected_message
+   * @param string|false $expected_message
    *   The expected error message.
    * @param \Psr\Http\Message\ResponseInterface $response
    *   The error response to assert.
diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
index a323484a68fa..06c212486ce6 100644
--- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
@@ -197,8 +197,8 @@ public function testAssembleWithStartingSlashEnabledProcessing(): void {
   /**
    * Setups the request stack for a given subdir.
    *
-   * @param string $subdir
-   *   The wanted subdir.
+   * @param bool $subdir
+   *   TRUE to use a subdir.
    */
   protected function setupRequestStack($subdir) {
     $server = [];
-- 
GitLab