[wp-trac] [WordPress Trac] #63563: Allow `int` type for version in `_WP_Dependency` chain
WordPress Trac
noreply at wordpress.org
Thu Jun 12 21:48:10 UTC 2025
#63563: Allow `int` type for version in `_WP_Dependency` chain
--------------------------+-----------------------------
Reporter: jeremyfelt | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords: needs-patch
Focuses: docs |
--------------------------+-----------------------------
`_WP_Dependency()->ver`, `WP_Dependencies()->add()`, `wp_enqueue_style()`,
`wp_register_style()`, `wp_enqueue_script()`, and `wp_register_script()`
all have a dependency's version type set as `string|bool|null`.
A common pattern for providing a script or style's version **number** is
to use `filemtime()`, which returns an `int`. This can then be flagged by
phpstan during static analysis as incorrect.
Because this is a valid way to generate a version number, and there is no
part of the implementation that prevents the output of the number as a
string, we should update these to support `string|bool|int|null`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63563>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list