Docs: In various `@return` tags, list the expected type first, instead of `WP_Error`.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@46696


git-svn-id: http://core.svn.wordpress.org/trunk@46496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-11-11 02:43:03 +00:00
parent 82dfb2d151
commit 3d623995a8
28 changed files with 81 additions and 78 deletions

View File

@ -450,7 +450,7 @@ class Plugin_Upgrader extends WP_Upgrader {
* @param string $local_destination * @param string $local_destination
* @param string $remote_destination * @param string $remote_destination
* @param array $plugin * @param array $plugin
* @return WP_Error|bool * @return bool|WP_Error
*/ */
public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) { public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) {
global $wp_filesystem; global $wp_filesystem;

View File

@ -76,7 +76,7 @@ class WP_Upgrader {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @var WP_Error|array $result { * @var array|WP_Error $result {
* @type string $source The full path to the source the files were installed from. * @type string $source The full path to the source the files were installed from.
* @type string $source_files List of all the files in the source directory. * @type string $source_files List of all the files in the source directory.
* @type string $destination The full path to the installation destination folder. * @type string $destination The full path to the installation destination folder.

View File

@ -2086,7 +2086,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
* @param string[] $types Types of connections. * @param string[] $types Types of connections.
* @param array $credentials Credentials to connect with. * @param array $credentials Credentials to connect with.
* @param string $type Chosen filesystem method. * @param string $type Chosen filesystem method.
* @param WP_Error|bool $error Error object or status. * @param bool|WP_Error $error Error object or status.
* @param string $context Full path to the directory that is tested for being writable. * @param string $context Full path to the directory that is tested for being writable.
*/ */
$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );

View File

@ -613,7 +613,7 @@ function is_network_only_plugin( $plugin ) {
* @param bool $network_wide Optional. Whether to enable the plugin for all sites in the network * @param bool $network_wide Optional. Whether to enable the plugin for all sites in the network
* or just the current site. Multisite only. Default false. * or just the current site. Multisite only. Default false.
* @param bool $silent Optional. Whether to prevent calling activation hooks. Default false. * @param bool $silent Optional. Whether to prevent calling activation hooks. Default false.
* @return WP_Error|null WP_Error on invalid file or null on success. * @return null|WP_Error WP_Error on invalid file or null on success.
*/ */
function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
$plugin = plugin_basename( trim( $plugin ) ); $plugin = plugin_basename( trim( $plugin ) );
@ -1071,7 +1071,7 @@ function validate_active_plugins() {
* @since 2.5.0 * @since 2.5.0
* *
* @param string $plugin Path to the plugin file relative to the plugins directory. * @param string $plugin Path to the plugin file relative to the plugins directory.
* @return WP_Error|int 0 on success, WP_Error on failure. * @return int|WP_Error 0 on success, WP_Error on failure.
*/ */
function validate_plugin( $plugin ) { function validate_plugin( $plugin ) {
if ( validate_file( $plugin ) ) { if ( validate_file( $plugin ) ) {

View File

@ -880,7 +880,7 @@ $_new_bundled_files = array(
* *
* @param string $from New release unzipped path. * @param string $from New release unzipped path.
* @param string $to Path to old WordPress installation. * @param string $to Path to old WordPress installation.
* @return WP_Error|null WP_Error on failure, null on success. * @return null|WP_Error WP_Error on failure, null on success.
*/ */
function update_core( $from, $to ) { function update_core( $from, $to ) {
global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
@ -1314,7 +1314,7 @@ function update_core( $from, $to ) {
* @param string $from Source directory. * @param string $from Source directory.
* @param string $to Destination directory. * @param string $to Destination directory.
* @param string[] $skip_list Array of files/folders to skip copying. * @param string[] $skip_list Array of files/folders to skip copying.
* @return WP_Error|true WP_Error on failure, true on success. * @return true|WP_Error WP_Error on failure, true on success.
*/ */
function _copy_dir( $from, $to, $skip_list = array() ) { function _copy_dir( $from, $to, $skip_list = array() ) {
global $wp_filesystem; global $wp_filesystem;

View File

@ -135,7 +135,7 @@ final class WP_Customize_Nav_Menus {
* 'post_type' and 'taxonomy'. Default is 'post_type'. * 'post_type' and 'taxonomy'. Default is 'post_type'.
* @param string $object Optional. Accepts any registered taxonomy or post type name. Default is 'page'. * @param string $object Optional. Accepts any registered taxonomy or post type name. Default is 'page'.
* @param int $page Optional. The page number used to generate the query offset. Default is '0'. * @param int $page Optional. The page number used to generate the query offset. Default is '0'.
* @return WP_Error|array Returns either a WP_Error object or an array of menu items. * @return array|WP_Error An array of menu items on success, a WP_Error object on failure.
*/ */
public function load_available_items_query( $type = 'post_type', $object = 'page', $page = 0 ) { public function load_available_items_query( $type = 'post_type', $object = 'page', $page = 0 ) {
$items = array(); $items = array();

View File

@ -621,7 +621,7 @@ final class WP_Customize_Widgets {
* @since 3.9.0 * @since 3.9.0
* *
* @param string $setting_id Widget setting ID. * @param string $setting_id Widget setting ID.
* @return WP_Error|array Array containing a widget's id_base and number components, * @return array|WP_Error Array containing a widget's id_base and number components,
* or a WP_Error object. * or a WP_Error object.
*/ */
public function parse_widget_setting_id( $setting_id ) { public function parse_widget_setting_id( $setting_id ) {
@ -1392,7 +1392,7 @@ final class WP_Customize_Widgets {
* @global array $wp_registered_widget_controls * @global array $wp_registered_widget_controls
* *
* @param string $widget_id Widget ID. * @param string $widget_id Widget ID.
* @return WP_Error|array Array containing the updated widget information. * @return array|WP_Error Array containing the updated widget information.
* A WP_Error object, otherwise. * A WP_Error object, otherwise.
*/ */
public function call_widget_update( $widget_id ) { public function call_widget_update( $widget_id ) {

View File

@ -252,7 +252,8 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
* @type int $height The maximum height in pixels. * @type int $height The maximum height in pixels.
* @type bool $crop Whether to crop the image to exact dimensions. * @type bool $crop Whether to crop the image to exact dimensions.
* } * }
* @return WP_Error|array WP_Error on error, or the image data array for inclusion in the `sizes` array in the image meta. * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
* WP_Error object on error.
*/ */
public function make_subsize( $size_data ) { public function make_subsize( $size_data ) {
if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) { if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
@ -417,7 +418,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
* @param resource $image * @param resource $image
* @param string|null $filename * @param string|null $filename
* @param string|null $mime_type * @param string|null $mime_type
* @return WP_Error|array * @return array|WP_Error
*/ */
protected function _save( $image, $filename = null, $mime_type = null ) { protected function _save( $image, $filename = null, $mime_type = null ) {
list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type ); list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );

View File

@ -460,7 +460,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* @type int $height The maximum height in pixels. * @type int $height The maximum height in pixels.
* @type bool $crop Whether to crop the image to exact dimensions. * @type bool $crop Whether to crop the image to exact dimensions.
* } * }
* @return WP_Error|array WP_Error on error, or the image data array for inclusion in the `sizes` array in the image meta. * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
* WP_Error object on error.
*/ */
public function make_subsize( $size_data ) { public function make_subsize( $size_data ) {
if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) { if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {

View File

@ -110,7 +110,7 @@ final class WP_oEmbed_Controller {
* @since 4.4.0 * @since 4.4.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|array oEmbed response data or WP_Error on failure. * @return array|WP_Error oEmbed response data or WP_Error on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$post_id = url_to_postid( $request['url'] ); $post_id = url_to_postid( $request['url'] );

View File

@ -179,7 +179,7 @@ final class WP_Theme implements ArrayAccess {
* *
* @param string $theme_dir Directory of the theme within the theme_root. * @param string $theme_dir Directory of the theme within the theme_root.
* @param string $theme_root Theme root. * @param string $theme_root Theme root.
* @param WP_Error|void $_child If this theme is a parent theme, the child may be passed for validation purposes. * @param WP_Theme|null $_child If this theme is a parent theme, the child may be passed for validation purposes.
*/ */
public function __construct( $theme_dir, $theme_root, $_child = null ) { public function __construct( $theme_dir, $theme_root, $_child = null ) {
global $wp_theme_directories; global $wp_theme_directories;

View File

@ -738,7 +738,7 @@ function feed_content_type( $type = '' ) {
* using SimplePie's multifeed feature. * using SimplePie's multifeed feature.
* See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas} * See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas}
* *
* @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success * @return SimplePie|WP_Error SimplePie object on success or WP_Error object on failure.
*/ */
function fetch_feed( $url ) { function fetch_feed( $url ) {
if ( ! class_exists( 'SimplePie', false ) ) { if ( ! class_exists( 'SimplePie', false ) ) {

View File

@ -41,7 +41,7 @@ function _wp_http_get_object() {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_safe_remote_request( $url, $args = array() ) { function wp_safe_remote_request( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true; $args['reject_unsafe_urls'] = true;
@ -62,7 +62,7 @@ function wp_safe_remote_request( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_safe_remote_get( $url, $args = array() ) { function wp_safe_remote_get( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true; $args['reject_unsafe_urls'] = true;
@ -83,7 +83,7 @@ function wp_safe_remote_get( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_safe_remote_post( $url, $args = array() ) { function wp_safe_remote_post( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true; $args['reject_unsafe_urls'] = true;
@ -104,7 +104,7 @@ function wp_safe_remote_post( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_safe_remote_head( $url, $args = array() ) { function wp_safe_remote_head( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true; $args['reject_unsafe_urls'] = true;
@ -127,7 +127,7 @@ function wp_safe_remote_head( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array { * @return array|WP_Error {
* The response array or a WP_Error on failure. * The response array or a WP_Error on failure.
* *
* @type string[] $headers Array of response headers keyed by their name. * @type string[] $headers Array of response headers keyed by their name.
@ -157,7 +157,7 @@ function wp_remote_request( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_remote_get( $url, $args = array() ) { function wp_remote_get( $url, $args = array() ) {
$http = _wp_http_get_object(); $http = _wp_http_get_object();
@ -174,7 +174,7 @@ function wp_remote_get( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_remote_post( $url, $args = array() ) { function wp_remote_post( $url, $args = array() ) {
$http = _wp_http_get_object(); $http = _wp_http_get_object();
@ -191,7 +191,7 @@ function wp_remote_post( $url, $args = array() ) {
* *
* @param string $url URL to retrieve. * @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array. * @param array $args Optional. Request arguments. Default empty array.
* @return WP_Error|array The response or WP_Error on failure. * @return array|WP_Error The response or WP_Error on failure.
*/ */
function wp_remote_head( $url, $args = array() ) { function wp_remote_head( $url, $args = array() ) {
$http = _wp_http_get_object(); $http = _wp_http_get_object();

View File

@ -1405,7 +1405,8 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
* @type string $_edit_link FOR INTERNAL USE ONLY! URL segment to use for edit link of * @type string $_edit_link FOR INTERNAL USE ONLY! URL segment to use for edit link of
* this post type. Default 'post.php?post=%d'. * this post type. Default 'post.php?post=%d'.
* } * }
* @return WP_Post_Type|WP_Error The registered post type object, or an error object. * @return WP_Post_Type|WP_Error The registered post type object on success,
* WP_Error object on failure.
*/ */
function register_post_type( $post_type, $args = array() ) { function register_post_type( $post_type, $args = array() ) {
global $wp_post_types; global $wp_post_types;

View File

@ -504,7 +504,7 @@ function rest_ensure_request( $request ) {
* *
* @since 4.4.0 * @since 4.4.0
* *
* @param WP_Error|WP_HTTP_Response|mixed $response Response to check. * @param WP_HTTP_Response|WP_Error|mixed $response Response to check.
* @return WP_REST_Response|mixed If response generated an error, WP_Error, if response * @return WP_REST_Response|mixed If response generated an error, WP_Error, if response
* is already an instance, WP_HTTP_Response, otherwise * is already an instance, WP_HTTP_Response, otherwise
* returns a new WP_REST_Response instance. * returns a new WP_REST_Response instance.
@ -872,8 +872,7 @@ function rest_output_link_header() {
* @global mixed $wp_rest_auth_cookie * @global mixed $wp_rest_auth_cookie
* *
* @param WP_Error|mixed $result Error from another authentication handler, * @param WP_Error|mixed $result Error from another authentication handler,
* null if we should handle it, or another value * null if we should handle it, or another value if not.
* if not.
* @return WP_Error|mixed|bool WP_Error if the cookie is invalid, the $result, otherwise true. * @return WP_Error|mixed|bool WP_Error if the cookie is invalid, the $result, otherwise true.
*/ */
function rest_cookie_check_errors( $result ) { function rest_cookie_check_errors( $result ) {
@ -1025,7 +1024,7 @@ function rest_authorization_required_code() {
* @param mixed $value * @param mixed $value
* @param WP_REST_Request $request * @param WP_REST_Request $request
* @param string $param * @param string $param
* @return WP_Error|boolean * @return true|WP_Error
*/ */
function rest_validate_request_arg( $value, $request, $param ) { function rest_validate_request_arg( $value, $request, $param ) {
$attributes = $request->get_attributes(); $attributes = $request->get_attributes();

View File

@ -129,7 +129,7 @@ class WP_REST_Server {
* *
* @since 4.4.0 * @since 4.4.0
* *
* @param WP_Error|null|bool WP_Error if authentication error, null if authentication * @param WP_Error|null|true WP_Error if authentication error, null if authentication
* method wasn't used, true if authentication succeeded. * method wasn't used, true if authentication succeeded.
*/ */
return apply_filters( 'rest_authentication_errors', null ); return apply_filters( 'rest_authentication_errors', null );

View File

@ -84,7 +84,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|true Boolean true if the attachment may be created, or a WP_Error if not. * @return true|WP_Error Boolean true if the attachment may be created, or a WP_Error if not.
*/ */
public function create_item_permissions_check( $request ) { public function create_item_permissions_check( $request ) {
$ret = parent::create_item_permissions_check( $request ); $ret = parent::create_item_permissions_check( $request );
@ -116,7 +116,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure.
*/ */
public function create_item( $request ) { public function create_item( $request ) {
@ -274,7 +274,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure.
*/ */
public function update_item( $request ) { public function update_item( $request ) {
if ( ! empty( $request['post'] ) && in_array( get_post_type( $request['post'] ), array( 'revision', 'attachment' ), true ) ) { if ( ! empty( $request['post'] ) && in_array( get_post_type( $request['post'] ), array( 'revision', 'attachment' ), true ) ) {
@ -352,7 +352,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Request object. * @param WP_REST_Request $request Request object.
* @return WP_Error|stdClass $prepared_attachment Post object. * @return stdClass|WP_Error Post object.
*/ */
protected function prepare_item_for_database( $request ) { protected function prepare_item_for_database( $request ) {
$prepared_attachment = parent::prepare_item_for_database( $request ); $prepared_attachment = parent::prepare_item_for_database( $request );

View File

@ -118,7 +118,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has read access, error object otherwise. * @return true|WP_Error True if the request has read access, error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
@ -175,7 +175,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
@ -349,7 +349,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has read access for the item, error object otherwise. * @return true|WP_Error True if the request has read access for the item, error object otherwise.
*/ */
public function get_item_permissions_check( $request ) { public function get_item_permissions_check( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -380,7 +380,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -400,7 +400,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has access to create items, error object otherwise. * @return true|WP_Error True if the request has access to create items, error object otherwise.
*/ */
public function create_item_permissions_check( $request ) { public function create_item_permissions_check( $request ) {
if ( ! is_user_logged_in() ) { if ( ! is_user_logged_in() ) {
@ -490,7 +490,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/ */
public function create_item( $request ) { public function create_item( $request ) {
if ( ! empty( $request['id'] ) ) { if ( ! empty( $request['id'] ) ) {
@ -667,7 +667,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has access to update the item, error object otherwise. * @return true|WP_Error True if the request has access to update the item, error object otherwise.
*/ */
public function update_item_permissions_check( $request ) { public function update_item_permissions_check( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -688,7 +688,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/ */
public function update_item( $request ) { public function update_item( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -787,7 +787,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has access to delete the item, error object otherwise. * @return true|WP_Error True if the request has access to delete the item, error object otherwise.
*/ */
public function delete_item_permissions_check( $request ) { public function delete_item_permissions_check( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -807,7 +807,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/ */
public function delete_item( $request ) { public function delete_item( $request ) {
$comment = $this->get_comment( $request['id'] ); $comment = $this->get_comment( $request['id'] );
@ -1691,7 +1691,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
* @param string $value Author email value submitted. * @param string $value Author email value submitted.
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter name. * @param string $param The parameter name.
* @return WP_Error|string The sanitized email address, if valid, * @return string|WP_Error The sanitized email address, if valid,
* otherwise an error. * otherwise an error.
*/ */
public function check_comment_author_email( $value, $request, $param ) { public function check_comment_author_email( $value, $request, $param ) {

View File

@ -54,7 +54,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool True if the request has read access, WP_Error object otherwise. * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -67,7 +67,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -80,7 +80,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise. * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
*/ */
public function get_item_permissions_check( $request ) { public function get_item_permissions_check( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -93,7 +93,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -106,7 +106,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool True if the request has access to create items, WP_Error object otherwise. * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise.
*/ */
public function create_item_permissions_check( $request ) { public function create_item_permissions_check( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -119,7 +119,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function create_item( $request ) { public function create_item( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -132,7 +132,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool True if the request has access to update the item, WP_Error object otherwise. * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise.
*/ */
public function update_item_permissions_check( $request ) { public function update_item_permissions_check( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -145,7 +145,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function update_item( $request ) { public function update_item( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -158,7 +158,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool True if the request has access to delete the item, WP_Error object otherwise. * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise.
*/ */
public function delete_item_permissions_check( $request ) { public function delete_item_permissions_check( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -171,7 +171,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full data about the request. * @param WP_REST_Request $request Full data about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function delete_item( $request ) { public function delete_item( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -184,7 +184,7 @@ abstract class WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Request object. * @param WP_REST_Request $request Request object.
* @return WP_Error|object The prepared item, or WP_Error object on failure. * @return object|WP_Error The prepared item, or WP_Error object on failure.
*/ */
protected function prepare_item_for_database( $request ) { protected function prepare_item_for_database( $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */
@ -198,7 +198,7 @@ abstract class WP_REST_Controller {
* *
* @param mixed $item WordPress representation of the item. * @param mixed $item WordPress representation of the item.
* @param WP_REST_Request $request Request object. * @param WP_REST_Request $request Request object.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function prepare_item_for_response( $item, $request ) { public function prepare_item_for_response( $item, $request ) {
/* translators: %s: Method name. */ /* translators: %s: Method name. */

View File

@ -78,7 +78,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has read access, WP_Error object otherwise. * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( 'edit' === $request['context'] ) { if ( 'edit' === $request['context'] ) {
@ -101,7 +101,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
$data = array(); $data = array();
@ -128,7 +128,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise. * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
*/ */
public function get_item_permissions_check( $request ) { public function get_item_permissions_check( $request ) {
$status = get_post_status_object( $request['status'] ); $status = get_post_status_object( $request['status'] );
@ -178,7 +178,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$obj = get_post_status_object( $request['status'] ); $obj = get_post_status_object( $request['status'] );

View File

@ -77,7 +77,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|true True if the request has read access, WP_Error object otherwise. * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( 'edit' === $request['context'] ) { if ( 'edit' === $request['context'] ) {
@ -99,7 +99,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
$data = array(); $data = array();
@ -122,7 +122,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
* @since 4.7.0 * @since 4.7.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$obj = get_post_type_object( $request['type'] ); $obj = get_post_type_object( $request['type'] );

View File

@ -1125,7 +1125,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
* @param mixed $value The username submitted in the request. * @param mixed $value The username submitted in the request.
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter name. * @param string $param The parameter name.
* @return WP_Error|string The sanitized username, if valid, otherwise an error. * @return string|WP_Error The sanitized username, if valid, otherwise an error.
*/ */
public function check_username( $value, $request, $param ) { public function check_username( $value, $request, $param ) {
$username = (string) $value; $username = (string) $value;
@ -1154,7 +1154,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
* @param mixed $value The password submitted in the request. * @param mixed $value The password submitted in the request.
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter name. * @param string $param The parameter name.
* @return WP_Error|string The sanitized password, if valid, otherwise an error. * @return string|WP_Error The sanitized password, if valid, otherwise an error.
*/ */
public function check_user_password( $value, $request, $param ) { public function check_user_password( $value, $request, $param ) {
$password = (string) $value; $password = (string) $value;

View File

@ -70,7 +70,7 @@ abstract class WP_REST_Meta_Fields {
* *
* @param int $object_id Object ID to fetch meta for. * @param int $object_id Object ID to fetch meta for.
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|object Object containing the meta values by name, otherwise WP_Error object. * @return object|WP_Error Object containing the meta values by name, otherwise WP_Error object.
*/ */
public function get_value( $object_id, $request ) { public function get_value( $object_id, $request ) {
$fields = $this->get_registered_fields(); $fields = $this->get_registered_fields();
@ -128,7 +128,7 @@ abstract class WP_REST_Meta_Fields {
* *
* @param array $meta Array of meta parsed from the request. * @param array $meta Array of meta parsed from the request.
* @param int $object_id Object ID to fetch meta for. * @param int $object_id Object ID to fetch meta for.
* @return WP_Error|null WP_Error if one occurs, null on success. * @return null|WP_Error Null on success, WP_Error object on failure.
*/ */
public function update_value( $meta, $object_id ) { public function update_value( $meta, $object_id ) {
$fields = $this->get_registered_fields(); $fields = $this->get_registered_fields();
@ -520,7 +520,7 @@ abstract class WP_REST_Meta_Fields {
* @param mixed $value The meta value submitted in the request. * @param mixed $value The meta value submitted in the request.
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @param string $param The parameter name. * @param string $param The parameter name.
* @return WP_Error|string The meta array, if valid, otherwise an error. * @return array|false The meta array, if valid, false otherwise.
*/ */
public function check_meta_is_array( $value, $request, $param ) { public function check_meta_is_array( $value, $request, $param ) {
if ( ! is_array( $value ) ) { if ( ! is_array( $value ) ) {

View File

@ -408,7 +408,7 @@ function is_taxonomy_hierarchical( $taxonomy ) {
* @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY!
* Default false. * Default false.
* } * }
* @return WP_Error|void WP_Error, if errors. * @return void|WP_Error Void on success, WP_Error object on failure.
*/ */
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
global $wp_taxonomies; global $wp_taxonomies;

View File

@ -79,7 +79,8 @@ function wp_get_themes( $args = array() ) {
if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) { if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) {
$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ]; $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
} else { } else {
$themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] ); $themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
$_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ]; $_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ];
} }
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-46695'; $wp_version = '5.4-alpha-46696';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -3499,7 +3499,7 @@ class wpdb {
* @global string $wp_version * @global string $wp_version
* @global string $required_mysql_version * @global string $required_mysql_version
* *
* @return WP_Error|void * @return void|WP_Error
*/ */
public function check_database_version() { public function check_database_version() {
global $wp_version, $required_mysql_version; global $wp_version, $required_mysql_version;

View File

@ -95,7 +95,7 @@ do_action( 'before_signup_form' );
* *
* @param string $blogname The new site name. * @param string $blogname The new site name.
* @param string $blog_title The new site title. * @param string $blog_title The new site title.
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. * @param string|WP_Error $errors A WP_Error object containing existing errors. Defaults to empty string.
*/ */
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
if ( ! is_wp_error( $errors ) ) { if ( ! is_wp_error( $errors ) ) {
@ -246,7 +246,7 @@ function validate_blog_form() {
* *
* @param string $user_name The entered username. * @param string $user_name The entered username.
* @param string $user_email The entered email address. * @param string $user_email The entered email address.
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. * @param string|WP_Error $errors A WP_Error object containing existing errors. Defaults to empty string.
*/ */
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
if ( ! is_wp_error( $errors ) ) { if ( ! is_wp_error( $errors ) ) {
@ -304,7 +304,7 @@ function validate_user_form() {
* *
* @param string $blogname The new site name * @param string $blogname The new site name
* @param string $blog_title The new site title. * @param string $blog_title The new site title.
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. * @param string|WP_Error $errors A WP_Error object containing existing errors. Defaults to empty string.
*/ */
function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
@ -553,7 +553,7 @@ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $
* *
* @param string $user_name The username. * @param string $user_name The username.
* @param string $user_email The user's email. * @param string $user_email The user's email.
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. * @param string|WP_Error $errors A WP_Error object containing existing errors. Defaults to empty string.
*/ */
function signup_user( $user_name = '', $user_email = '', $errors = '' ) { function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
global $active_signup; global $active_signup;
@ -691,7 +691,7 @@ function confirm_user_signup( $user_name, $user_email ) {
* @param string $user_email The user's email address. * @param string $user_email The user's email address.
* @param string $blogname The site name. * @param string $blogname The site name.
* @param string $blog_title The site title. * @param string $blog_title The site title.
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. * @param string|WP_Error $errors A WP_Error object containing existing errors. Defaults to empty string.
*/ */
function signup_blog( $user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '' ) { function signup_blog( $user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '' ) {
if ( ! is_wp_error( $errors ) ) { if ( ! is_wp_error( $errors ) ) {