Skip to content

Commit cde71ee

Browse files
Docs: In various @return tags, list the expected type first, instead of WP_Error.
See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@46696 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 63a5340 commit cde71ee

28 files changed

Lines changed: 81 additions & 78 deletions

src/wp-admin/includes/class-plugin-upgrader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public function deactivate_plugin_before_upgrade( $return, $plugin ) {
450450
* @param string $local_destination
451451
* @param string $remote_destination
452452
* @param array $plugin
453-
* @return WP_Error|bool
453+
* @return bool|WP_Error
454454
*/
455455
public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) {
456456
global $wp_filesystem;

src/wp-admin/includes/class-wp-upgrader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class WP_Upgrader {
7676
*
7777
* @since 2.8.0
7878
*
79-
* @var WP_Error|array $result {
79+
* @var array|WP_Error $result {
8080
* @type string $source The full path to the source the files were installed from.
8181
* @type string $source_files List of all the files in the source directory.
8282
* @type string $destination The full path to the installation destination folder.

src/wp-admin/includes/file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
20862086
* @param string[] $types Types of connections.
20872087
* @param array $credentials Credentials to connect with.
20882088
* @param string $type Chosen filesystem method.
2089-
* @param WP_Error|bool $error Error object or status.
2089+
* @param bool|WP_Error $error Error object or status.
20902090
* @param string $context Full path to the directory that is tested for being writable.
20912091
*/
20922092
$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );

src/wp-admin/includes/plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ function is_network_only_plugin( $plugin ) {
613613
* @param bool $network_wide Optional. Whether to enable the plugin for all sites in the network
614614
* or just the current site. Multisite only. Default false.
615615
* @param bool $silent Optional. Whether to prevent calling activation hooks. Default false.
616-
* @return WP_Error|null WP_Error on invalid file or null on success.
616+
* @return null|WP_Error WP_Error on invalid file or null on success.
617617
*/
618618
function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
619619
$plugin = plugin_basename( trim( $plugin ) );
@@ -1071,7 +1071,7 @@ function validate_active_plugins() {
10711071
* @since 2.5.0
10721072
*
10731073
* @param string $plugin Path to the plugin file relative to the plugins directory.
1074-
* @return WP_Error|int 0 on success, WP_Error on failure.
1074+
* @return int|WP_Error 0 on success, WP_Error on failure.
10751075
*/
10761076
function validate_plugin( $plugin ) {
10771077
if ( validate_file( $plugin ) ) {

src/wp-admin/includes/update-core.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@
880880
*
881881
* @param string $from New release unzipped path.
882882
* @param string $to Path to old WordPress installation.
883-
* @return WP_Error|null WP_Error on failure, null on success.
883+
* @return null|WP_Error WP_Error on failure, null on success.
884884
*/
885885
function update_core( $from, $to ) {
886886
global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
@@ -1314,7 +1314,7 @@ function update_core( $from, $to ) {
13141314
* @param string $from Source directory.
13151315
* @param string $to Destination directory.
13161316
* @param string[] $skip_list Array of files/folders to skip copying.
1317-
* @return WP_Error|true WP_Error on failure, true on success.
1317+
* @return true|WP_Error WP_Error on failure, true on success.
13181318
*/
13191319
function _copy_dir( $from, $to, $skip_list = array() ) {
13201320
global $wp_filesystem;

src/wp-includes/class-wp-customize-nav-menus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function ajax_load_available_items() {
135135
* 'post_type' and 'taxonomy'. Default is 'post_type'.
136136
* @param string $object Optional. Accepts any registered taxonomy or post type name. Default is 'page'.
137137
* @param int $page Optional. The page number used to generate the query offset. Default is '0'.
138-
* @return WP_Error|array Returns either a WP_Error object or an array of menu items.
138+
* @return array|WP_Error An array of menu items on success, a WP_Error object on failure.
139139
*/
140140
public function load_available_items_query( $type = 'post_type', $object = 'page', $page = 0 ) {
141141
$items = array();

src/wp-includes/class-wp-customize-widgets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function parse_widget_id( $widget_id ) {
621621
* @since 3.9.0
622622
*
623623
* @param string $setting_id Widget setting ID.
624-
* @return WP_Error|array Array containing a widget's id_base and number components,
624+
* @return array|WP_Error Array containing a widget's id_base and number components,
625625
* or a WP_Error object.
626626
*/
627627
public function parse_widget_setting_id( $setting_id ) {
@@ -1392,7 +1392,7 @@ public function sanitize_sidebar_widgets_js_instance( $widget_ids ) {
13921392
* @global array $wp_registered_widget_controls
13931393
*
13941394
* @param string $widget_id Widget ID.
1395-
* @return WP_Error|array Array containing the updated widget information.
1395+
* @return array|WP_Error Array containing the updated widget information.
13961396
* A WP_Error object, otherwise.
13971397
*/
13981398
public function call_widget_update( $widget_id ) {

src/wp-includes/class-wp-image-editor-gd.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ public function multi_resize( $sizes ) {
252252
* @type int $height The maximum height in pixels.
253253
* @type bool $crop Whether to crop the image to exact dimensions.
254254
* }
255-
* @return WP_Error|array WP_Error on error, or the image data array for inclusion in the `sizes` array in the image meta.
255+
* @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
256+
* WP_Error object on error.
256257
*/
257258
public function make_subsize( $size_data ) {
258259
if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
@@ -417,7 +418,7 @@ public function save( $filename = null, $mime_type = null ) {
417418
* @param resource $image
418419
* @param string|null $filename
419420
* @param string|null $mime_type
420-
* @return WP_Error|array
421+
* @return array|WP_Error
421422
*/
422423
protected function _save( $image, $filename = null, $mime_type = null ) {
423424
list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );

src/wp-includes/class-wp-image-editor-imagick.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ public function multi_resize( $sizes ) {
460460
* @type int $height The maximum height in pixels.
461461
* @type bool $crop Whether to crop the image to exact dimensions.
462462
* }
463-
* @return WP_Error|array WP_Error on error, or the image data array for inclusion in the `sizes` array in the image meta.
463+
* @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
464+
* WP_Error object on error.
464465
*/
465466
public function make_subsize( $size_data ) {
466467
if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {

src/wp-includes/class-wp-oembed-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function register_routes() {
110110
* @since 4.4.0
111111
*
112112
* @param WP_REST_Request $request Full data about the request.
113-
* @return WP_Error|array oEmbed response data or WP_Error on failure.
113+
* @return array|WP_Error oEmbed response data or WP_Error on failure.
114114
*/
115115
public function get_item( $request ) {
116116
$post_id = url_to_postid( $request['url'] );

0 commit comments

Comments
 (0)