Commit 47cbd4b9fe for wordpress.org
commit 47cbd4b9fe9388af7f4d81ec13575efc1aca02d9
Author: Weston Ruter <weston@xwp.co>
Date: Tue Dec 9 06:54:39 2025 +0000
Docs: Improve specificity of types in `WP_Script_Modules` and `script-modules.php` functions.
Developed in https://github.com/WordPress/wordpress-develop/pull/10614
Follow-up to [61358].
See #64238.
Built from https://develop.svn.wordpress.org/trunk@61362
git-svn-id: http://core.svn.wordpress.org/trunk@60674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-script-modules.php b/wp-includes/class-wp-script-modules.php
index d576967515..ff39739995 100644
--- a/wp-includes/class-wp-script-modules.php
+++ b/wp-includes/class-wp-script-modules.php
@@ -88,31 +88,31 @@ class WP_Script_Modules {
* @since 6.5.0
* @since 6.9.0 Added the $args parameter.
*
- * @param string $id The identifier of the script module. Should be unique. It will be used in the
- * final import map.
- * @param string $src Optional. Full URL of the script module, or path of the script module relative
- * to the WordPress root directory. If it is provided and the script module has
- * not been registered yet, it will be registered.
- * @param array $deps {
- * Optional. List of dependencies.
- *
- * @type string|array ...$0 {
- * An array of script module identifiers of the dependencies of this script
- * module. The dependencies can be strings or arrays. If they are arrays,
- * they need an `id` key with the script module identifier, and can contain
- * an `import` key with either `static` or `dynamic`. By default,
- * dependencies that don't contain an `import` key are considered static.
- *
- * @type string $id The script module identifier.
- * @type string $import Optional. Import type. May be either `static` or
- * `dynamic`. Defaults to `static`.
- * }
- * }
- * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
- * It is added to the URL as a query string for cache busting purposes. If $version
- * is set to false, the version number is the currently installed WordPress version.
- * If $version is set to null, no version is added.
- * @param array $args {
+ * @param string $id The identifier of the script module. Should be unique. It will be used in the
+ * final import map.
+ * @param string $src Optional. Full URL of the script module, or path of the script module relative
+ * to the WordPress root directory. If it is provided and the script module has
+ * not been registered yet, it will be registered.
+ * @param array<string|array> $deps {
+ * Optional. List of dependencies.
+ *
+ * @type string|array ...$0 {
+ * An array of script module identifiers of the dependencies of this script
+ * module. The dependencies can be strings or arrays. If they are arrays,
+ * they need an `id` key with the script module identifier, and can contain
+ * an `import` key with either `static` or `dynamic`. By default,
+ * dependencies that don't contain an `import` key are considered static.
+ *
+ * @type string $id The script module identifier.
+ * @type string $import Optional. Import type. May be either `static` or
+ * `dynamic`. Defaults to `static`.
+ * }
+ * }
+ * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
+ * It is added to the URL as a query string for cache busting purposes. If $version
+ * is set to false, the version number is the currently installed WordPress version.
+ * If $version is set to null, no version is added.
+ * @param array<string, string|bool> $args {
* Optional. An array of additional args. Default empty array.
*
* @type bool $in_footer Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -260,31 +260,31 @@ class WP_Script_Modules {
* @since 6.5.0
* @since 6.9.0 Added the $args parameter.
*
- * @param string $id The identifier of the script module. Should be unique. It will be used in the
- * final import map.
- * @param string $src Optional. Full URL of the script module, or path of the script module relative
- * to the WordPress root directory. If it is provided and the script module has
- * not been registered yet, it will be registered.
- * @param array $deps {
- * Optional. List of dependencies.
- *
- * @type string|array ...$0 {
- * An array of script module identifiers of the dependencies of this script
- * module. The dependencies can be strings or arrays. If they are arrays,
- * they need an `id` key with the script module identifier, and can contain
- * an `import` key with either `static` or `dynamic`. By default,
- * dependencies that don't contain an `import` key are considered static.
- *
- * @type string $id The script module identifier.
- * @type string $import Optional. Import type. May be either `static` or
- * `dynamic`. Defaults to `static`.
- * }
- * }
- * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
- * It is added to the URL as a query string for cache busting purposes. If $version
- * is set to false, the version number is the currently installed WordPress version.
- * If $version is set to null, no version is added.
- * @param array $args {
+ * @param string $id The identifier of the script module. Should be unique. It will be used in the
+ * final import map.
+ * @param string $src Optional. Full URL of the script module, or path of the script module relative
+ * to the WordPress root directory. If it is provided and the script module has
+ * not been registered yet, it will be registered.
+ * @param array<string|array> $deps {
+ * Optional. List of dependencies.
+ *
+ * @type string|array ...$0 {
+ * An array of script module identifiers of the dependencies of this script
+ * module. The dependencies can be strings or arrays. If they are arrays,
+ * they need an `id` key with the script module identifier, and can contain
+ * an `import` key with either `static` or `dynamic`. By default,
+ * dependencies that don't contain an `import` key are considered static.
+ *
+ * @type string $id The script module identifier.
+ * @type string $import Optional. Import type. May be either `static` or
+ * `dynamic`. Defaults to `static`.
+ * }
+ * }
+ * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
+ * It is added to the URL as a query string for cache busting purposes. If $version
+ * is set to false, the version number is the currently installed WordPress version.
+ * If $version is set to null, no version is added.
+ * @param array<string, string|bool> $args {
* Optional. An array of additional args. Default empty array.
*
* @type bool $in_footer Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -534,8 +534,8 @@ class WP_Script_Modules {
*
* @since 6.5.0
*
- * @return array Array with an `imports` key mapping to an array of script module identifiers and their respective
- * URLs, including the version query.
+ * @return array<string, array<string, string>> Array with an `imports` key mapping to an array of script module
+ * identifiers and their respective URLs, including the version query.
*/
private function get_import_map(): array {
$imports = array();
@@ -556,7 +556,7 @@ class WP_Script_Modules {
*
* @since 6.5.0
*
- * @return array<string, array> Script modules marked for enqueue, keyed by script module identifier.
+ * @return array<string, array<string, mixed>> Script modules marked for enqueue, keyed by script module identifier.
*/
private function get_marked_for_enqueue(): array {
return wp_array_slice_assoc(
@@ -577,7 +577,7 @@ class WP_Script_Modules {
* @param string[] $ids The identifiers of the script modules for which to gather dependencies.
* @param string[] $import_types Optional. Import types of dependencies to retrieve: 'static', 'dynamic', or both.
* Default is both.
- * @return array<string, array> List of dependencies, keyed by script module identifier.
+ * @return array<string, array<string, mixed>> List of dependencies, keyed by script module identifier.
*/
private function get_dependencies( array $ids, array $import_types = array( 'static', 'dynamic' ) ): array {
$all_dependencies = array();
diff --git a/wp-includes/script-modules.php b/wp-includes/script-modules.php
index fc2197889f..c1e90c1c85 100644
--- a/wp-includes/script-modules.php
+++ b/wp-includes/script-modules.php
@@ -37,31 +37,31 @@ function wp_script_modules(): WP_Script_Modules {
* @since 6.5.0
* @since 6.9.0 Added the $args parameter.
*
- * @param string $id The identifier of the script module. Should be unique. It will be used in the
- * final import map.
- * @param string $src Optional. Full URL of the script module, or path of the script module relative
- * to the WordPress root directory. If it is provided and the script module has
- * not been registered yet, it will be registered.
- * @param array $deps {
- * Optional. List of dependencies.
- *
- * @type string|array ...$0 {
- * An array of script module identifiers of the dependencies of this script
- * module. The dependencies can be strings or arrays. If they are arrays,
- * they need an `id` key with the script module identifier, and can contain
- * an `import` key with either `static` or `dynamic`. By default,
- * dependencies that don't contain an `import` key are considered static.
- *
- * @type string $id The script module identifier.
- * @type string $import Optional. Import type. May be either `static` or
- * `dynamic`. Defaults to `static`.
- * }
- * }
- * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
- * It is added to the URL as a query string for cache busting purposes. If $version
- * is set to false, the version number is the currently installed WordPress version.
- * If $version is set to null, no version is added.
- * @param array $args {
+ * @param string $id The identifier of the script module. Should be unique. It will be used in the
+ * final import map.
+ * @param string $src Optional. Full URL of the script module, or path of the script module relative
+ * to the WordPress root directory. If it is provided and the script module has
+ * not been registered yet, it will be registered.
+ * @param array<string|array> $deps {
+ * Optional. List of dependencies.
+ *
+ * @type string|array ...$0 {
+ * An array of script module identifiers of the dependencies of this script
+ * module. The dependencies can be strings or arrays. If they are arrays,
+ * they need an `id` key with the script module identifier, and can contain
+ * an `import` key with either `static` or `dynamic`. By default,
+ * dependencies that don't contain an `import` key are considered static.
+ *
+ * @type string $id The script module identifier.
+ * @type string $import Optional. Import type. May be either `static` or
+ * `dynamic`. Defaults to `static`.
+ * }
+ * }
+ * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
+ * It is added to the URL as a query string for cache busting purposes. If $version
+ * is set to false, the version number is the currently installed WordPress version.
+ * If $version is set to null, no version is added.
+ * @param array<string, string|bool> $args {
* Optional. An array of additional args. Default empty array.
*
* @type bool $in_footer Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -81,31 +81,31 @@ function wp_register_script_module( string $id, string $src, array $deps = array
* @since 6.5.0
* @since 6.9.0 Added the $args parameter.
*
- * @param string $id The identifier of the script module. Should be unique. It will be used in the
- * final import map.
- * @param string $src Optional. Full URL of the script module, or path of the script module relative
- * to the WordPress root directory. If it is provided and the script module has
- * not been registered yet, it will be registered.
- * @param array $deps {
- * Optional. List of dependencies.
- *
- * @type string|array ...$0 {
- * An array of script module identifiers of the dependencies of this script
- * module. The dependencies can be strings or arrays. If they are arrays,
- * they need an `id` key with the script module identifier, and can contain
- * an `import` key with either `static` or `dynamic`. By default,
- * dependencies that don't contain an `import` key are considered static.
- *
- * @type string $id The script module identifier.
- * @type string $import Optional. Import type. May be either `static` or
- * `dynamic`. Defaults to `static`.
- * }
- * }
- * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
- * It is added to the URL as a query string for cache busting purposes. If $version
- * is set to false, the version number is the currently installed WordPress version.
- * If $version is set to null, no version is added.
- * @param array $args {
+ * @param string $id The identifier of the script module. Should be unique. It will be used in the
+ * final import map.
+ * @param string $src Optional. Full URL of the script module, or path of the script module relative
+ * to the WordPress root directory. If it is provided and the script module has
+ * not been registered yet, it will be registered.
+ * @param array<string|array> $deps {
+ * Optional. List of dependencies.
+ *
+ * @type string|array ...$0 {
+ * An array of script module identifiers of the dependencies of this script
+ * module. The dependencies can be strings or arrays. If they are arrays,
+ * they need an `id` key with the script module identifier, and can contain
+ * an `import` key with either `static` or `dynamic`. By default,
+ * dependencies that don't contain an `import` key are considered static.
+ *
+ * @type string $id The script module identifier.
+ * @type string $import Optional. Import type. May be either `static` or
+ * `dynamic`. Defaults to `static`.
+ * }
+ * }
+ * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
+ * It is added to the URL as a query string for cache busting purposes. If $version
+ * is set to false, the version number is the currently installed WordPress version.
+ * If $version is set to null, no version is added.
+ * @param array<string, string|bool> $args {
* Optional. An array of additional args. Default empty array.
*
* @type bool $in_footer Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1dad9eaa39..82d03bc09d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61361';
+$wp_version = '7.0-alpha-61362';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.