Skip to content

Commit 82c41bc

Browse files
committed
Script Loader: Add types for arrays in phpdoc.
This resolves 10 `missingType.iterableValue` issues in PHPStan. Follow-up to [61402], [61362], [61358]. See #64224, #64238. git-svn-id: https://develop.svn.wordpress.org/trunk@61426 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4657895 commit 82c41bc

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/wp-includes/script-loader.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,7 @@ function print_admin_styles() {
23472347
* @global WP_Styles $wp_styles
23482348
* @global bool $concatenate_scripts
23492349
*
2350-
* @return array|void
2350+
* @return string[]|void
23512351
*/
23522352
function print_late_styles() {
23532353
global $wp_styles, $concatenate_scripts;
@@ -2504,8 +2504,8 @@ function wp_common_block_scripts_and_styles() {
25042504
*
25052505
* @since 6.1.0
25062506
*
2507-
* @param array $nodes The nodes to filter.
2508-
* @return array A filtered array of style nodes.
2507+
* @param array<array<string, mixed>> $nodes The nodes to filter.
2508+
* @return array<array<string, mixed>> A filtered array of style nodes.
25092509
*/
25102510
function wp_filter_out_block_nodes( $nodes ) {
25112511
return array_filter(
@@ -2865,7 +2865,7 @@ function wp_enqueue_editor_format_library_assets() {
28652865
*
28662866
* @since 5.7.0
28672867
*
2868-
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
2868+
* @param array<string, string|bool> $attributes Key-value pairs representing `<script>` tag attributes.
28692869
* @return string String made of sanitized `<script>` tag attributes.
28702870
*/
28712871
function wp_sanitize_script_attributes( $attributes ) {
@@ -2896,7 +2896,7 @@ function wp_sanitize_script_attributes( $attributes ) {
28962896
*
28972897
* @since 5.7.0
28982898
*
2899-
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
2899+
* @param array<string, string|bool> $attributes Key-value pairs representing `<script>` tag attributes.
29002900
* @return string String containing `<script>` opening and closing tags.
29012901
*/
29022902
function wp_get_script_tag( $attributes ) {
@@ -2922,7 +2922,7 @@ function wp_get_script_tag( $attributes ) {
29222922
*
29232923
* @since 5.7.0
29242924
*
2925-
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
2925+
* @param array<string, string|bool> $attributes Key-value pairs representing `<script>` tag attributes.
29262926
*/
29272927
function wp_print_script_tag( $attributes ) {
29282928
echo wp_get_script_tag( $attributes );
@@ -2936,8 +2936,8 @@ function wp_print_script_tag( $attributes ) {
29362936
*
29372937
* @since 5.7.0
29382938
*
2939-
* @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc.
2940-
* @param array $attributes Optional. Key-value pairs representing `<script>` tag attributes.
2939+
* @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc.
2940+
* @param array<string, string|bool> $attributes Optional. Key-value pairs representing `<script>` tag attributes.
29412941
* @return string String containing inline JavaScript code wrapped around `<script>` tag.
29422942
*/
29432943
function wp_get_inline_script_tag( $data, $attributes = array() ) {
@@ -2948,10 +2948,10 @@ function wp_get_inline_script_tag( $data, $attributes = array() ) {
29482948
*
29492949
* @since 5.7.0
29502950
*
2951-
* @param array $attributes Key-value pairs representing `<script>` tag attributes.
2952-
* Only the attribute name is added to the `<script>` tag for
2953-
* entries with a boolean value, and that are true.
2954-
* @param string $data Inline data.
2951+
* @param array<string, string|bool> $attributes Key-value pairs representing `<script>` tag attributes.
2952+
* Only the attribute name is added to the `<script>` tag for
2953+
* entries with a boolean value, and that are true.
2954+
* @param string $data Inline data.
29552955
*/
29562956
$attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $data );
29572957

@@ -2966,8 +2966,8 @@ function wp_get_inline_script_tag( $data, $attributes = array() ) {
29662966
*
29672967
* @since 5.7.0
29682968
*
2969-
* @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc.
2970-
* @param array $attributes Optional. Key-value pairs representing `<script>` tag attributes.
2969+
* @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc.
2970+
* @param array<string, string|bool> $attributes Optional. Key-value pairs representing `<script>` tag attributes.
29712971
*/
29722972
function wp_print_inline_script_tag( $data, $attributes = array() ) {
29732973
echo wp_get_inline_script_tag( $data, $attributes );
@@ -3188,7 +3188,7 @@ static function () use ( $style ) {
31883188
*
31893189
* @since 6.1.0
31903190
*
3191-
* @param array $options {
3191+
* @param array<string, bool> $options {
31923192
* Optional. An array of options to pass to wp_style_engine_get_stylesheet_from_context().
31933193
* Default empty array.
31943194
*
@@ -3260,8 +3260,8 @@ function wp_enqueue_stored_styles( $options = array() ) {
32603260
*
32613261
* @since 5.9.0
32623262
*
3263-
* @param string $block_name The block-name, including namespace.
3264-
* @param array $args {
3263+
* @param string $block_name The block-name, including namespace.
3264+
* @param array<string, string|string[]|bool|null> $args {
32653265
* An array of arguments. See wp_register_style() for full information about each argument.
32663266
*
32673267
* @type string $handle The handle for the stylesheet.

0 commit comments

Comments
 (0)