Opened 5 months ago
Last modified 5 days ago
#48303 reopened task (blessed)
Docblock improvements for 5.4
Reported by: | desrosj | Owned by: | |
---|---|---|---|
Milestone: | 5.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | docs | Cc: |
Attachments (6)
Change History (108)
#2
@
5 months ago
wp_enqueue_script
, wp_enqueue_style
, wp_register_script
and wp_register_style
parameter $deps
could be narrowed from array
to string[]
.
#3
@
5 months ago
wp_unslash
parameter and return value could be narrowed from string|array
to string|string[]
.
This ticket was mentioned in Slack in #docs by atachibana. View the logs.
5 months ago
@
4 months ago
Docs: Moved the @link tag for Customize API in WP_Customize_Manager::add_setting() and WP_Customize_Setting
#33
in reply to:
↑ 26
;
follow-up:
↓ 34
@
4 months ago
Replying to Marcio Zebedeu:
Can you please confirm? I had my doubts about naming patch.
Thanks for the patches! However, [46647] and [46691] are changesets, not tasks. These are changes that are already committed and generally don't require additional patches, unless you notice a typo or any other inaccuracy :)
#34
in reply to:
↑ 33
@
4 months ago
Replying to SergeyBiryukov:
Replying to Marcio Zebedeu:
Can you please confirm? I had my doubts about naming patch.
Thanks for the patches! However, [46647] and [46691] are changesets, not tasks. These are changes that are already committed and generally don't require additional patches, unless you notice a typo or any other inaccuracy :)
Oh...thank. I'm still learning :)
#71
@
2 months ago
Hi, I started by looking at the function get_the_post_thumbnail
and its parameter $size
, which is currently of the type string|array
. I think this could be narrowed down to string|int[]
by examining its source and all the functions and hooks it calls. As such, I think these functions and hooks could have their parameter $size
narrowed in the same way. The ones I encountered:
Functions:
get_the_post_thumbnail
wp_get_attachment_image
wp_get_attachment_image_src
image_downsize
image_get_intermediate_size
image_constrain_size_for_editor
Hooks:
begin_fetch_post_thumbnail_html
end_fetch_post_thumbnail_html
wp_get_attachment_image_src
image_downsize
image_get_intermediate_size
editor_max_image_size
However, I'm pretty sure there are more.
#74
@
8 weeks ago
Hi, OK, thanks.
6 more functions that can have parameters narrowed:
is_page
can have parameter narrowed toint|string|int[]|string[]
is_single
can have parameter narrowed toint|string|int[]|string[]
is_singular
can have parameter narrowed tostring|string[]
WP_Query::is_page
can have parameter narrowed toint|string|int[]|string[]
WP_Query::is_single
can have parameter narrowed toint|string|int[]|string[]
WP_Query::is_singular
can have parameter narrowed tostring|string[]
Partially covered by #48354
#97
in reply to:
↑ 89
@
3 weeks ago
Replying to johnbillion:
In 47394:
@johnbillion I can't seem to figure out when the first parameter of the image_downsize
filter can be an array. The filter is used in two places, and both pass false
as the first parameter. Was the change to bool|array
intentional?
wp_image_resize_identical_dimensions
uses a similar approach, and the first parameter is still documented as bool
there.
#98
follow-up:
↓ 99
@
3 weeks ago
@SergeyBiryukov It can be an array if another filter is filtering the value and returning an array intended as the short-circuited return value.
Good point though - Core is not consistent in documenting the types for these short-circuit filter parameters. Worth a separate ticket?
#99
in reply to:
↑ 98
@
3 weeks ago
- Resolution set to fixed
- Status changed from new to closed
Replying to johnbillion:
It can be an array if another filter is filtering the value and returning an array intended as the short-circuited return value.
Indeed, thanks! That could be clarified in the description though.
Good point though - Core is not consistent in documenting the types for these short-circuit filter parameters. Worth a separate ticket?
Probably :) With 5.4 RC1 approaching, let's close this one as fixed.
#101
@
7 days ago
@SergeyBiryukov Just saw the changes here and I'm getting static analysis warnings for code like:
<?php wp_scripts()->add_data( $handle, 'foo_script_attributes', [ 'async' => true, ] );
This change to WP_Dependencies::add_data()
in r47170 appears to not be correct:
- * @param mixed $value The data value. + * @param string $value The data value.
It has a mismatch with wp_script_add_data()
which still indicates the type of $value
as being mixed
.
I didn't know about this tracking ticket for all the small docs issues, so I created a lot of small ones (sorry...)