Skip to content

Feat: Allow int type for version in _WP_Dependency chain #8971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/wp-includes/class-wp-dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ public function all_deps( $handles, $recursion = false, $group = false ) {
* @since 2.1.0
* @since 2.6.0 Moved from `WP_Scripts`.
*
* @param string $handle Name of the item. Should be unique.
* @param string|false $src Full URL of the item, or path of the item relative
* to the WordPress root directory. If source is set to false,
* the item is an alias of other items it depends on.
* @param string[] $deps Optional. An array of registered item handles this item depends on.
* Default empty array.
* @param string|bool|null $ver Optional. String specifying item 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 number is automatically added
* equal to current installed WordPress version.
* If set to null, no version is added.
* @param mixed $args Optional. Custom property of the item. NOT the class property $args.
* Examples: $media, $in_footer.
* @param string $handle Name of the item. Should be unique.
* @param string|false $src Full URL of the item, or path of the item relative
* to the WordPress root directory. If source is set to false,
* the item is an alias of other items it depends on.
* @param string[] $deps Optional. An array of registered item handles this item depends on.
* Default empty array.
* @param string|int|bool|null $ver Optional. String or Integer specifying item 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 number is automatically added
* equal to current installed WordPress version.
* If set to null, no version is added.
* @param mixed $args Optional. Custom property of the item. NOT the class property $args.
* Examples: $media, $in_footer.
* @return bool Whether the item has been registered. True on success, false on failure.
*/
public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-dependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class _WP_Dependency {
* Used for cache-busting.
*
* @since 2.6.0
* @var bool|string
* @var bool|string|int
*/
public $ver = false;

Expand Down
44 changes: 25 additions & 19 deletions src/wp-includes/functions.wp-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,18 @@ function wp_add_inline_script( $handle, $data, $position = 'after' ) {
* @since 4.3.0 A return value was added.
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
*
* @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.
* 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|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
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added.
* @param array|bool $args {
* @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.
* 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|int|bool|null $ver Optional. String or Integer 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 number is automatically added equal to current
* installed WordPress version.
* If set to null, no version is added.
* @param array|bool $args {
* 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.
*
Expand Down Expand Up @@ -340,17 +343,20 @@ function wp_deregister_script( $handle ) {
* @since 2.1.0
* @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
*
* @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.
* Default empty.
* @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
* 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.
* If set to null, no version is added.
* @param array|bool $args {
* @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.
* Default empty.
* @param string[] $deps Optional. An array of registered script handles this script depends on.
* Default empty array.
* @param string|int|bool|null $ver Optional. String or Integer 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 number is automatically added equal
* to current installed WordPress version.
* If set to null, no version is added.
* @param array|bool $args {
* 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.
*
* @type string $strategy Optional. If provided, may be either 'defer' or 'async'.
* @type bool $in_footer Optional. Whether to print the script in the footer. Default 'false'.
Expand Down
50 changes: 28 additions & 22 deletions src/wp-includes/functions.wp-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,21 @@ function wp_add_inline_style( $handle, $data ) {
* @since 2.6.0
* @since 4.3.0 A return value was added.
*
* @param string $handle Name of the stylesheet. Should be unique.
* @param string|false $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* If source is set to false, stylesheet is an alias of other stylesheets it depends on.
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying stylesheet 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
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
* '(orientation: portrait)' and '(max-width: 640px)'.
* @param string $handle Name of the stylesheet. Should be unique.
* @param string|false $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress
* root directory.
* If source is set to false, stylesheet is an alias of other stylesheets it
* depends on.
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on.
* Default empty array.
* @param string|int|bool|null $ver Optional. String or Integer specifying stylesheet 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 number is automatically added
* equal to current installed WordPress version.
* If set to null, no version is added.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media
* queries like '(orientation: portrait)' and '(max-width: 640px)'.
* @return bool Whether the style has been registered. True on success, false on failure.
*/
function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
Expand Down Expand Up @@ -158,17 +162,19 @@ function wp_deregister_style( $handle ) {
*
* @since 2.6.0
*
* @param string $handle Name of the stylesheet. Should be unique.
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* Default empty.
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying stylesheet 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
* number is automatically added equal to current installed WordPress version.
* If set to null, no version is added.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
* '(orientation: portrait)' and '(max-width: 640px)'.
* @param string $handle Name of the stylesheet. Should be unique.
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the
* WordPress root directory. Default empty.
* @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on.
* Default empty array.
* @param string|int|bool|null $ver Optional. String or Integer specifying stylesheet 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 number is automatically added equal
* to current installed WordPress version.
* If set to null, no version is added.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media
* queries like '(orientation: portrait)' and '(max-width: 640px)'.
*/
function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
Expand Down
Loading