[wp-trac] [WordPress Trac] #54959: Incorrect type in docblock for `translations_api` and `translations_api_result` hooks
WordPress Trac
noreply at wordpress.org
Thu Jan 27 19:00:10 UTC 2022
#54959: Incorrect type in docblock for `translations_api` and
`translations_api_result` hooks
---------------------------------+-----------------------------
Reporter: volodymyrkolesnykov | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.9
Severity: normal | Keywords:
Focuses: docs |
---------------------------------+-----------------------------
`translation_api` and `translation_api_result` filters are incorrectly
marked as taking `object` as their first argument
(https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes
/translation-install.php#L32,
https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes
/translation-install.php#L105).
The correct type should be `array`
(https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes
/translation-install.php#L85), as `json_decode()` is asked to return an
associative array; moreover, the code checks that the result is an array
(https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes
/translation-install.php#L86), and consumers of `translations_api()` also
expect to see an array (https://github.com/WordPress/WordPress/blob/5.9
/wp-admin/includes/translation-install.php#L135).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54959>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list