Docs: Improve specificity of PHP types in functions.wp-scripts.php and functions.wp-styles.php.
These files now adhere to PHPStan level 8. Developed in https://github.com/WordPress/wordpress-develop/pull/10652 Follow-up to [61362], [61358]. See #64238. Built from https://develop.svn.wordpress.org/trunk@61402 git-svn-id: http://core.svn.wordpress.org/trunk@60714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -141,7 +141,7 @@ function wp_add_inline_script( $handle, $data, $position = 'after' ) {
|
|||||||
),
|
),
|
||||||
'4.5.0'
|
'4.5.0'
|
||||||
);
|
);
|
||||||
$data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
|
$data = trim( (string) preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return wp_scripts()->add_inline_script( $handle, $data, $position );
|
return wp_scripts()->add_inline_script( $handle, $data, $position );
|
||||||
@@ -160,15 +160,15 @@ function wp_add_inline_script( $handle, $data, $position = 'after' ) {
|
|||||||
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
|
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
|
||||||
* @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
|
* @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
|
||||||
*
|
*
|
||||||
* @param string $handle Name of the script. Should be unique.
|
* @param string $handle Name of the script. Should be unique.
|
||||||
* @param string|false $src Full URL of the script, or path of the script relative to the WordPress root directory.
|
* @param string|false $src Full URL of the script, or path of the script relative to the WordPress root directory.
|
||||||
* If source is set to false, script is an alias of other scripts it depends on.
|
* If source is set to false, script is an alias of other scripts it depends on.
|
||||||
* @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array.
|
* @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array.
|
||||||
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
|
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
|
||||||
* as a query string for cache busting purposes. If version is set to false, a version
|
* as a query string for cache busting purposes. If version is set to false, a version
|
||||||
* number is automatically added equal to current installed WordPress version.
|
* number is automatically added equal to current installed WordPress version.
|
||||||
* If set to null, no version is added.
|
* If set to null, no version is added.
|
||||||
* @param array|bool $args {
|
* @param array<string, string|bool>|bool $args {
|
||||||
* Optional. An array of additional script loading strategies. Default empty array.
|
* Optional. An array of additional script loading strategies. Default empty array.
|
||||||
* Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
|
* Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
|
||||||
*
|
*
|
||||||
@@ -221,10 +221,10 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $args
|
|||||||
*
|
*
|
||||||
* @todo Documentation cleanup
|
* @todo Documentation cleanup
|
||||||
*
|
*
|
||||||
* @param string $handle Script handle the data will be attached to.
|
* @param string $handle Script handle the data will be attached to.
|
||||||
* @param string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
|
* @param string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
|
||||||
* Example: '/[a-zA-Z0-9_]+/'.
|
* Example: '/[a-zA-Z0-9_]+/'.
|
||||||
* @param array $l10n The data itself. The data can be either a single or multi-dimensional array.
|
* @param array<string, mixed> $l10n The data itself. The data can be either a single or multi-dimensional array.
|
||||||
* @return bool True if the script was successfully localized, false otherwise.
|
* @return bool True if the script was successfully localized, false otherwise.
|
||||||
*/
|
*/
|
||||||
function wp_localize_script( $handle, $object_name, $l10n ) {
|
function wp_localize_script( $handle, $object_name, $l10n ) {
|
||||||
@@ -346,15 +346,15 @@ function wp_deregister_script( $handle ) {
|
|||||||
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
|
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
|
||||||
* @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
|
* @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
|
||||||
*
|
*
|
||||||
* @param string $handle Name of the script. Should be unique.
|
* @param string $handle Name of the script. Should be unique.
|
||||||
* @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
|
* @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
|
||||||
* Default empty.
|
* Default empty.
|
||||||
* @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array.
|
* @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array.
|
||||||
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
|
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
|
||||||
* as a query string for cache busting purposes. If version is set to false, a version
|
* as a query string for cache busting purposes. If version is set to false, a version
|
||||||
* number is automatically added equal to current installed WordPress version.
|
* number is automatically added equal to current installed WordPress version.
|
||||||
* If set to null, no version is added.
|
* If set to null, no version is added.
|
||||||
* @param array|bool $args {
|
* @param array<string, string|bool>|bool $args {
|
||||||
* Optional. An array of additional script loading strategies. Default empty array.
|
* Optional. An array of additional script loading strategies. Default empty array.
|
||||||
* Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
|
* Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function wp_styles() {
|
|||||||
*
|
*
|
||||||
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
|
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
|
||||||
*
|
*
|
||||||
* @param string|bool|array $handles Styles to be printed. Default 'false'.
|
* @param string|false|string[] $handles Styles to be printed. Default 'false'.
|
||||||
* @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
|
* @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
|
||||||
*/
|
*/
|
||||||
function wp_print_styles( $handles = false ) {
|
function wp_print_styles( $handles = false ) {
|
||||||
@@ -98,7 +98,7 @@ function wp_add_inline_style( $handle, $data ) {
|
|||||||
),
|
),
|
||||||
'3.7.0'
|
'3.7.0'
|
||||||
);
|
);
|
||||||
$data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
|
$data = trim( (string) preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return wp_styles()->add_inline_style( $handle, $data );
|
return wp_styles()->add_inline_style( $handle, $data );
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '7.0-alpha-61401';
|
$wp_version = '7.0-alpha-61402';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|||||||
Reference in New Issue
Block a user