[wp-trac] [WordPress Trac] #63857: Incorrect @var tag for _WP_Dependency::$args
WordPress Trac
noreply at wordpress.org
Thu Aug 21 20:24:36 UTC 2025
#63857: Incorrect @var tag for _WP_Dependency::$args
---------------------------+-----------------------------
Reporter: marian1 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: trivial | Keywords:
Focuses: docs |
---------------------------+-----------------------------
1. `_WP_Dependency` instances are created exclusively via
`WP_Dependencies::add()`. The constructor of `_WP_Dependency` simply
assigns up to 5 passed arguments to properties. Except for the third
argument, all arguments are asigned as-is.
2. In `WP_Dependencies::add()`, the fifth parameter `$args` is optional,
defaults to `null`, and is documented as `mixed`. This value is assigned
to `_WP_Dependency::$args`.
3. Currently, core passes at least the value `null` (the default of
`WP_Dependencies::add()`), the value `1` (see e.g.
`wp_default_packages_vendor()`), `array` types (e.g., the default of
`wp_register_script()`), and `string` types (e.g., the default of
`wp_register_style()`) as fifth argument.
From 1., `_WP_Dependency::__construct()` must accept at least the types
that `WP_Dependencies::add()` accepts.
From 2., `_WP_Dependency::$args` is of type `mixed`.
From 3., `_WP_Dependency::$args` must allow `array|int|string|null`.
Depending on whether types other than `array|int|string|null` are
considered valid for the fifth argument of `WP_Dependencies::add()`, the
`@var` tag for `_WP_Dependency::$args` should be updated to
`array|int|string|null` or `mixed`. If `array|int|string|null` are the
only types considered valid, the documented type of
`WP_Dependencies::add()` should also be updated.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63857>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list