diff --git a/core/lib/Drupal/Component/Assertion/Inspector.php b/core/lib/Drupal/Component/Assertion/Inspector.php index 945272f9de78da70e88f5cfd08acca79063ded45..d7bc6f994389a58bd5cd0feaaa77661285991702 100644 --- a/core/lib/Drupal/Component/Assertion/Inspector.php +++ b/core/lib/Drupal/Component/Assertion/Inspector.php @@ -184,19 +184,16 @@ public static function assertAllStrictArrays($traversable) { * * @param mixed $traversable * Variable to be examined. - * @param ...$keys + * @param string ...$keys * Keys to be searched for. * * @return bool * TRUE if $traversable can be traversed and all members have all keys. */ - public static function assertAllHaveKey($traversable) { - $args = func_get_args(); - unset($args[0]); - + public static function assertAllHaveKey($traversable, string ...$keys) { if (is_iterable($traversable)) { foreach ($traversable as $member) { - foreach ($args as $key) { + foreach ($keys as $key) { if (!array_key_exists($key, $member)) { return FALSE; } @@ -370,21 +367,18 @@ public static function assertAllRegularExpressionMatch($pattern, $traversable) { * * @param mixed $traversable * Variable to be examined. - * @param ...$classes + * @param string ...$classes * Classes and interfaces to test objects against. * * @return bool * TRUE if $traversable can be traversed and all members are objects with * at least one of the listed classes or interfaces. */ - public static function assertAllObjects($traversable) { - $args = func_get_args(); - unset($args[0]); - + public static function assertAllObjects($traversable, string ...$classes) { if (is_iterable($traversable)) { foreach ($traversable as $member) { - if (count($args) > 0) { - foreach ($args as $instance) { + if (count($classes) > 0) { + foreach ($classes as $instance) { if ($member instanceof $instance) { // We're continuing to the next member on the outer loop. // @see http://php.net/continue diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 82e33b0cad927ea291eb1fe1393c00b413b68501..81b5cfcb68fb3f3aca4f6f5d6ac53e376304f804 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -517,7 +517,7 @@ public function isSyncing() { * * @param \Drupal\Core\Config\StorageInterface $storage * The storage containing the default configuration. - * @param $previous_config_names + * @param array $previous_config_names * An array of configuration names that have previously been checked. * * @return array diff --git a/core/lib/Drupal/Core/Extension/ProceduralCall.php b/core/lib/Drupal/Core/Extension/ProceduralCall.php index 5969a80df7d431e4e2be6cac39d74ffbede062cf..cd26cee1a6306b130d4d66d198759eb7a77abde3 100644 --- a/core/lib/Drupal/Core/Extension/ProceduralCall.php +++ b/core/lib/Drupal/Core/Extension/ProceduralCall.php @@ -35,7 +35,7 @@ public function __call($name, $args): mixed { /** * Loads the file a function lives in, if any. * - * @param $function + * @param string $function * The name of the function. */ public function loadFile($function): void { diff --git a/core/lib/Drupal/Core/Hook/HookCollectorPass.php b/core/lib/Drupal/Core/Hook/HookCollectorPass.php index a6a34c0efe69c29ba16aacfee7686df053469eac..3809e24af21d56b20f034b2a45848de6d47e6e93 100644 --- a/core/lib/Drupal/Core/Hook/HookCollectorPass.php +++ b/core/lib/Drupal/Core/Hook/HookCollectorPass.php @@ -156,14 +156,14 @@ public static function collectAllHookImplementations(array $module_filenames, ?C /** * Collects procedural and Attribute hook implementations. * - * @param $dir + * @param string $dir * The directory in which the module resides. - * @param $module + * @param string $module * The name of the module. - * @param $module_preg + * @param string $module_preg * A regular expression matching every module, longer module names are * matched first. - * @param $skip_procedural + * @param bool $skip_procedural * Skip the procedural check for the current module. */ protected function collectModuleHookImplementations($dir, $module, $module_preg, bool $skip_procedural): void { @@ -300,9 +300,9 @@ protected static function getHookAttributesInClass(string $class): array { * * @param \Drupal\Core\Hook\Attribute\Hook $hook * A hook attribute. - * @param $class + * @param string $class * The class in which said attribute resides in. - * @param $module + * @param string $module * The module in which the class resides in. */ protected function addFromAttribute(Hook $hook, $class, $module): void { diff --git a/core/lib/Drupal/Core/Utility/ProjectInfo.php b/core/lib/Drupal/Core/Utility/ProjectInfo.php index 08f52dd20e6d92bacc67d04561bf5ac106be633d..a5a2215e8045b29a58355c4b27358ef2d88c6c5c 100644 --- a/core/lib/Drupal/Core/Utility/ProjectInfo.php +++ b/core/lib/Drupal/Core/Utility/ProjectInfo.php @@ -165,7 +165,7 @@ public function getProjectName(Extension $file) { * @param array $info * Array of .info.yml file data as returned by * \Drupal\Core\Extension\InfoParser. - * @param $additional_elements + * @param array $additional_elements * (optional) Array of additional elements to be collected from the * .info.yml file. Defaults to []. * diff --git a/core/modules/navigation/navigation.api.php b/core/modules/navigation/navigation.api.php index f2824f297267f952a37fa7e4b8869fe2fceb47b8..b9c967a84b5e3cd5b85db03a924841168f63f14d 100644 --- a/core/modules/navigation/navigation.api.php +++ b/core/modules/navigation/navigation.api.php @@ -38,7 +38,7 @@ function hook_navigation_content_top(): array { /** * Alter replacement values for placeholder tokens. * - * @param $content_top + * @param array $content_top * An associative array of content returned by hook_navigation_content_top(). * * @see hook_navigation_content_top() diff --git a/core/modules/navigation/navigation.module b/core/modules/navigation/navigation.module index a2be21b65590c3adf507d69f8e66d10c6fbf8049..dbc11f191e641f276c8f4d2a309f786b90542ee9 100644 --- a/core/modules/navigation/navigation.module +++ b/core/modules/navigation/navigation.module @@ -26,7 +26,7 @@ function navigation_module_implements_alter(&$implementations, $hook): void { * * Default template: top-bar.html.twig * - * @param $variables + * @param array $variables * An associative array containing: * - element: An associative array containing the properties and children of * the top bar. diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 2f69df575db1bdc5f580ef7fc406ddc6c913d52e..99c26a17c5eefe8f7c2d94124b57716957a2d86d 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -84,13 +84,7 @@ <include-pattern>*/Database/*</include-pattern> <exclude-pattern>*/tests/*</exclude-pattern> </rule> - <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"> - <include-pattern>core/lib/Component/*</include-pattern> - <include-pattern>core/includes/*</include-pattern> - <include-pattern>core/*/*Database*/*</include-pattern> - <include-pattern>*/*/views/*</include-pattern> - <include-pattern>*/*/views_ui/*</include-pattern> - </rule> + <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"/> <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment"> <include-pattern>core/lib/Drupal/Core/*</include-pattern> <include-pattern>core/lib/Drupal/Component/*</include-pattern>