Skip to content

Commit 9306d11

Browse files
committed
Docs: Improve specificity of types in WP_Script_Modules and script-modules.php functions.
Developed in #10614 Follow-up to [61358]. See #64238. git-svn-id: https://develop.svn.wordpress.org/trunk@61362 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1a3860d commit 9306d11

File tree

2 files changed

+104
-104
lines changed

2 files changed

+104
-104
lines changed

src/wp-includes/class-wp-script-modules.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,31 @@ class WP_Script_Modules {
8888
* @since 6.5.0
8989
* @since 6.9.0 Added the $args parameter.
9090
*
91-
* @param string $id The identifier of the script module. Should be unique. It will be used in the
92-
* final import map.
93-
* @param string $src Optional. Full URL of the script module, or path of the script module relative
94-
* to the WordPress root directory. If it is provided and the script module has
95-
* not been registered yet, it will be registered.
96-
* @param array $deps {
97-
* Optional. List of dependencies.
98-
*
99-
* @type string|array ...$0 {
100-
* An array of script module identifiers of the dependencies of this script
101-
* module. The dependencies can be strings or arrays. If they are arrays,
102-
* they need an `id` key with the script module identifier, and can contain
103-
* an `import` key with either `static` or `dynamic`. By default,
104-
* dependencies that don't contain an `import` key are considered static.
105-
*
106-
* @type string $id The script module identifier.
107-
* @type string $import Optional. Import type. May be either `static` or
108-
* `dynamic`. Defaults to `static`.
109-
* }
110-
* }
111-
* @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
112-
* It is added to the URL as a query string for cache busting purposes. If $version
113-
* is set to false, the version number is the currently installed WordPress version.
114-
* If $version is set to null, no version is added.
115-
* @param array $args {
91+
* @param string $id The identifier of the script module. Should be unique. It will be used in the
92+
* final import map.
93+
* @param string $src Optional. Full URL of the script module, or path of the script module relative
94+
* to the WordPress root directory. If it is provided and the script module has
95+
* not been registered yet, it will be registered.
96+
* @param array<string|array> $deps {
97+
* Optional. List of dependencies.
98+
*
99+
* @type string|array ...$0 {
100+
* An array of script module identifiers of the dependencies of this script
101+
* module. The dependencies can be strings or arrays. If they are arrays,
102+
* they need an `id` key with the script module identifier, and can contain
103+
* an `import` key with either `static` or `dynamic`. By default,
104+
* dependencies that don't contain an `import` key are considered static.
105+
*
106+
* @type string $id The script module identifier.
107+
* @type string $import Optional. Import type. May be either `static` or
108+
* `dynamic`. Defaults to `static`.
109+
* }
110+
* }
111+
* @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
112+
* It is added to the URL as a query string for cache busting purposes. If $version
113+
* is set to false, the version number is the currently installed WordPress version.
114+
* If $version is set to null, no version is added.
115+
* @param array<string, string|bool> $args {
116116
* Optional. An array of additional args. Default empty array.
117117
*
118118
* @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 @@ public function set_in_footer( string $id, bool $in_footer ): bool {
260260
* @since 6.5.0
261261
* @since 6.9.0 Added the $args parameter.
262262
*
263-
* @param string $id The identifier of the script module. Should be unique. It will be used in the
264-
* final import map.
265-
* @param string $src Optional. Full URL of the script module, or path of the script module relative
266-
* to the WordPress root directory. If it is provided and the script module has
267-
* not been registered yet, it will be registered.
268-
* @param array $deps {
269-
* Optional. List of dependencies.
270-
*
271-
* @type string|array ...$0 {
272-
* An array of script module identifiers of the dependencies of this script
273-
* module. The dependencies can be strings or arrays. If they are arrays,
274-
* they need an `id` key with the script module identifier, and can contain
275-
* an `import` key with either `static` or `dynamic`. By default,
276-
* dependencies that don't contain an `import` key are considered static.
277-
*
278-
* @type string $id The script module identifier.
279-
* @type string $import Optional. Import type. May be either `static` or
280-
* `dynamic`. Defaults to `static`.
281-
* }
282-
* }
283-
* @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
284-
* It is added to the URL as a query string for cache busting purposes. If $version
285-
* is set to false, the version number is the currently installed WordPress version.
286-
* If $version is set to null, no version is added.
287-
* @param array $args {
263+
* @param string $id The identifier of the script module. Should be unique. It will be used in the
264+
* final import map.
265+
* @param string $src Optional. Full URL of the script module, or path of the script module relative
266+
* to the WordPress root directory. If it is provided and the script module has
267+
* not been registered yet, it will be registered.
268+
* @param array<string|array> $deps {
269+
* Optional. List of dependencies.
270+
*
271+
* @type string|array ...$0 {
272+
* An array of script module identifiers of the dependencies of this script
273+
* module. The dependencies can be strings or arrays. If they are arrays,
274+
* they need an `id` key with the script module identifier, and can contain
275+
* an `import` key with either `static` or `dynamic`. By default,
276+
* dependencies that don't contain an `import` key are considered static.
277+
*
278+
* @type string $id The script module identifier.
279+
* @type string $import Optional. Import type. May be either `static` or
280+
* `dynamic`. Defaults to `static`.
281+
* }
282+
* }
283+
* @param string|false|null $version Optional. String specifying the script module version number. Defaults to false.
284+
* It is added to the URL as a query string for cache busting purposes. If $version
285+
* is set to false, the version number is the currently installed WordPress version.
286+
* If $version is set to null, no version is added.
287+
* @param array<string, string|bool> $args {
288288
* Optional. An array of additional args. Default empty array.
289289
*
290290
* @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 @@ public function print_import_map() {
534534
*
535535
* @since 6.5.0
536536
*
537-
* @return array Array with an `imports` key mapping to an array of script module identifiers and their respective
538-
* URLs, including the version query.
537+
* @return array<string, array<string, string>> Array with an `imports` key mapping to an array of script module
538+
* identifiers and their respective URLs, including the version query.
539539
*/
540540
private function get_import_map(): array {
541541
$imports = array();
@@ -556,7 +556,7 @@ private function get_import_map(): array {
556556
*
557557
* @since 6.5.0
558558
*
559-
* @return array<string, array> Script modules marked for enqueue, keyed by script module identifier.
559+
* @return array<string, array<string, mixed>> Script modules marked for enqueue, keyed by script module identifier.
560560
*/
561561
private function get_marked_for_enqueue(): array {
562562
return wp_array_slice_assoc(
@@ -577,7 +577,7 @@ private function get_marked_for_enqueue(): array {
577577
* @param string[] $ids The identifiers of the script modules for which to gather dependencies.
578578
* @param string[] $import_types Optional. Import types of dependencies to retrieve: 'static', 'dynamic', or both.
579579
* Default is both.
580-
* @return array<string, array> List of dependencies, keyed by script module identifier.
580+
* @return array<string, array<string, mixed>> List of dependencies, keyed by script module identifier.
581581
*/
582582
private function get_dependencies( array $ids, array $import_types = array( 'static', 'dynamic' ) ): array {
583583
$all_dependencies = array();

0 commit comments

Comments
 (0)