Skip to content

Commit 33c8d7e

Browse files
committed
Docs: Add missing descriptions and fix types for some @return tags.
Props huzaifaalmesbah, sabernhardt, westonruter. See #64224. Fixes #64262. git-svn-id: https://develop.svn.wordpress.org/trunk@61270 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6e91abe commit 33c8d7e

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

src/wp-admin/includes/plugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,7 +2276,7 @@ function user_can_access_admin_page() {
22762276
* @global array $new_allowed_options
22772277
*
22782278
* @param array $options
2279-
* @return array
2279+
* @return array Updated allowed options.
22802280
*/
22812281
function option_update_filter( $options ) {
22822282
global $new_allowed_options;
@@ -2297,7 +2297,7 @@ function option_update_filter( $options ) {
22972297
*
22982298
* @param array $new_options
22992299
* @param string|array $options
2300-
* @return array
2300+
* @return array Updated allowed options.
23012301
*/
23022302
function add_allowed_options( $new_options, $options = '' ) {
23032303
if ( '' === $options ) {
@@ -2332,7 +2332,7 @@ function add_allowed_options( $new_options, $options = '' ) {
23322332
*
23332333
* @param array $del_options
23342334
* @param string|array $options
2335-
* @return array
2335+
* @return array Updated allowed options.
23362336
*/
23372337
function remove_allowed_options( $del_options, $options = '' ) {
23382338
if ( '' === $options ) {

src/wp-admin/includes/upgrade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2831,7 +2831,7 @@ function get_alloptions_110() {
28312831
* @global wpdb $wpdb WordPress database abstraction object.
28322832
*
28332833
* @param string $setting Option name.
2834-
* @return mixed
2834+
* @return mixed Option value.
28352835
*/
28362836
function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
28372837
global $wpdb;
@@ -3374,7 +3374,7 @@ function make_db_current_silent( $tables = 'all' ) {
33743374
*
33753375
* @param string $theme_name The name of the theme.
33763376
* @param string $template The directory name of the theme.
3377-
* @return bool
3377+
* @return bool True on success, false on failure.
33783378
*/
33793379
function make_site_theme_from_oldschool( $theme_name, $template ) {
33803380
$home_path = get_home_path();

src/wp-admin/includes/user.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function get_user_to_edit( $user_id ) {
306306
* @global wpdb $wpdb WordPress database abstraction object.
307307
*
308308
* @param int $user_id User ID.
309-
* @return array
309+
* @return object[] The user's draft posts, with 'ID' and 'post_title' keys.
310310
*/
311311
function get_users_drafts( $user_id ) {
312312
global $wpdb;
@@ -603,7 +603,7 @@ function use_ssl_preference( $user ) {
603603
* @since MU (3.0.0)
604604
*
605605
* @param string $text
606-
* @return string
606+
* @return string User site invitation email message.
607607
*/
608608
function admin_created_user_email( $text ) {
609609
$roles = get_editable_roles();

src/wp-admin/includes/widgets.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function wp_list_widgets() {
6969
*
7070
* @param array $a First array.
7171
* @param array $b Second array.
72-
* @return int
72+
* @return int Comparison result.
7373
*/
7474
function _sort_name_callback( $a, $b ) {
7575
return strnatcasecmp( $a['name'], $b['name'] );
@@ -129,7 +129,7 @@ function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
129129
* @global array $wp_registered_widgets
130130
*
131131
* @param array $params
132-
* @return array
132+
* @return array Widget control arguments.
133133
*/
134134
function wp_list_widget_controls_dynamic_sidebar( $params ) {
135135
global $wp_registered_widgets;
@@ -157,7 +157,7 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
157157
* @global array $wp_registered_widgets
158158
*
159159
* @param string $id_base
160-
* @return int
160+
* @return int Next available widget ID number.
161161
*/
162162
function next_widget_id_number( $id_base ) {
163163
global $wp_registered_widgets;
@@ -185,7 +185,7 @@ function next_widget_id_number( $id_base ) {
185185
* @global array $sidebars_widgets
186186
*
187187
* @param array $sidebar_args
188-
* @return array
188+
* @return array Passed through value of `$sidebar_args` param.
189189
*/
190190
function wp_widget_control( $sidebar_args ) {
191191
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
@@ -322,7 +322,7 @@ function wp_widget_control( $sidebar_args ) {
322322

323323
/**
324324
* @param string $classes
325-
* @return string
325+
* @return string Modified body classes.
326326
*/
327327
function wp_widgets_access_body_class( $classes ) {
328328
return "$classes widgets_access ";

src/wp-includes/block-supports/elements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function wp_get_elements_class_name( $block ) {
2727
*
2828
* @param array $block Block object.
2929
* @param array $options Per element type options e.g. whether to skip serialization.
30-
* @return boolean Whether the block needs an elements class name.
30+
* @return bool Whether the block needs an elements class name.
3131
*/
3232
function wp_should_add_elements_class_name( $block, $options ) {
3333
if ( ! isset( $block['attrs']['style']['elements'] ) ) {

src/wp-includes/class-wp-theme-json-resolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ public static function get_merged_data( $origin = 'custom' ) {
681681
*
682682
* @since 5.9.0
683683
*
684-
* @return integer|null
684+
* @return int|null ID for a post of type `wp_global_styles`, or null if not available.
685685
*/
686686
public static function get_user_global_styles_post_id() {
687687
if ( null !== static::$user_custom_post_type_id ) {
@@ -704,7 +704,7 @@ public static function get_user_global_styles_post_id() {
704704
* @since 5.9.0 Added a check in the parent theme.
705705
* @deprecated 6.2.0 Use wp_theme_has_theme_json() instead.
706706
*
707-
* @return bool
707+
* @return bool Whether the active theme has a theme.json file.
708708
*/
709709
public static function theme_has_support() {
710710
_deprecated_function( __METHOD__, '6.2.0', 'wp_theme_has_theme_json()' );
@@ -780,7 +780,7 @@ private static function recursively_iterate_json( $dir ) {
780780
*
781781
* @param array $variation Theme.json shaped style variation object.
782782
* @param string $scope Scope to check e.g. theme, block etc.
783-
* @return boolean
783+
* @return bool Whether the supplied style variation matches the provided scope.
784784
*/
785785
private static function style_variation_has_scope( $variation, $scope ) {
786786
if ( 'block' === $scope ) {
@@ -805,7 +805,7 @@ private static function style_variation_has_scope( $variation, $scope ) {
805805
* Added basic caching for read theme.json partial files.
806806
*
807807
* @param string $scope The scope or type of style variation to retrieve e.g. theme, block etc.
808-
* @return array
808+
* @return array The style variations defined by the theme.
809809
*/
810810
public static function get_style_variations( $scope = 'theme' ) {
811811
$variation_files = array();

src/wp-includes/comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,7 +2769,7 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
27692769
* @since 2.5.0
27702770
*
27712771
* @param bool $defer
2772-
* @return bool
2772+
* @return bool Whether comment counting is deferred.
27732773
*/
27742774
function wp_defer_comment_counting( $defer = null ) {
27752775
static $_defer = false;
@@ -3371,7 +3371,7 @@ function weblog_ping( $server = '', $path = '' ) {
33713371
* @see wp_http_validate_url()
33723372
*
33733373
* @param string $source_uri
3374-
* @return string
3374+
* @return string Validated source URI.
33753375
*/
33763376
function pingback_ping_source_uri( $source_uri ) {
33773377
return (string) wp_http_validate_url( $source_uri );

src/wp-includes/formatting.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
803803
* @access private
804804
*
805805
* @param array $matches preg_replace_callback matches array
806-
* @return string
806+
* @return string Text with newlines replaced with placeholders.
807807
*/
808808
function _autop_newline_preservation_helper( $matches ) {
809809
return str_replace( "\n", '<WPPreserveNewline />', $matches[0] );
@@ -4680,7 +4680,7 @@ function esc_js( $text ) {
46804680
* @since 2.8.0
46814681
*
46824682
* @param string $text
4683-
* @return string
4683+
* @return string Escaped text.
46844684
*/
46854685
function esc_html( $text ) {
46864686
$safe_text = wp_check_invalid_utf8( $text );
@@ -4705,7 +4705,7 @@ function esc_html( $text ) {
47054705
* @since 2.8.0
47064706
*
47074707
* @param string $text
4708-
* @return string
4708+
* @return string Escaped text.
47094709
*/
47104710
function esc_attr( $text ) {
47114711
$safe_text = wp_check_invalid_utf8( $text );
@@ -4730,7 +4730,7 @@ function esc_attr( $text ) {
47304730
* @since 3.1.0
47314731
*
47324732
* @param string $text
4733-
* @return string
4733+
* @return string Escaped text.
47344734
*/
47354735
function esc_textarea( $text ) {
47364736
$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
@@ -4809,7 +4809,7 @@ static function ( $matches ) {
48094809
* @since 6.5.5 Allow hyphens in tag names (i.e. custom elements).
48104810
*
48114811
* @param string $tag_name
4812-
* @return string
4812+
* @return string Sanitized tag name.
48134813
*/
48144814
function tag_escape( $tag_name ) {
48154815
$safe_tag = strtolower( preg_replace( '/[^a-zA-Z0-9-_:]/', '', $tag_name ) );
@@ -5683,7 +5683,7 @@ function _sanitize_text_fields( $str, $keep_newlines = false ) {
56835683
*
56845684
* @param string $path A path.
56855685
* @param string $suffix If the filename ends in suffix this will also be cut off.
5686-
* @return string
5686+
* @return string The base name of the given path.
56875687
*/
56885688
function wp_basename( $path, $suffix = '' ) {
56895689
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );

src/wp-includes/functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6568,7 +6568,7 @@ function wp_timezone_override_offset() {
65686568
*
65696569
* @param array $a
65706570
* @param array $b
6571-
* @return int
6571+
* @return int Comparison result.
65726572
*/
65736573
function _wp_timezone_choice_usort_callback( $a, $b ) {
65746574
// Don't use translated versions of Etc.
@@ -6625,7 +6625,7 @@ function _wp_timezone_choice_usort_callback( $a, $b ) {
66256625
*
66266626
* @param string $selected_zone Selected timezone.
66276627
* @param string $locale Optional. Locale to load the timezones in. Default current site locale.
6628-
* @return string
6628+
* @return string HTML select element for timezones.
66296629
*/
66306630
function wp_timezone_choice( $selected_zone, $locale = null ) {
66316631
static $mo_loaded = false, $locale_loaded = null;
@@ -6827,7 +6827,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
68276827
* @see https://core.trac.wordpress.org/ticket/8497
68286828
*
68296829
* @param string $str Header comment to clean up.
6830-
* @return string
6830+
* @return string Cleaned header comment.
68316831
*/
68326832
function _cleanup_header_comment( $str ) {
68336833
return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $str ) );

0 commit comments

Comments
 (0)