Improve inline documentation for the `__construct()` and `add()` methods in `WP_Error` class.

Props jdgrimes.
Fixes #28203.

Built from https://develop.svn.wordpress.org/trunk@28660


git-svn-id: http://core.svn.wordpress.org/trunk@28478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2014-06-04 06:06:14 +00:00
parent a7c2180672
commit 10e48ccbf2
1 changed files with 9 additions and 8 deletions

View File

@ -38,14 +38,15 @@ class WP_Error {
private $error_data = array(); private $error_data = array();
/** /**
* Constructor - Sets up error message. * Initialize the error.
* *
* If code parameter is empty then nothing will be done. It is possible to * If `$code` is empty, the other parameters will be ignored.
* add multiple messages to the same code, but with other methods in the * When `$code` is not empty, `$message` will be used even if
* class. * it is empty. The `$data` parameter will be used only if it
* is not empty.
* *
* All parameters are optional, but if the code parameter is set, then the * Though the class is constructed with a single error code and
* data parameter is optional. * message, multiple codes can be added using the `add()` method.
* *
* @since 2.1.0 * @since 2.1.0
* *
@ -54,7 +55,7 @@ class WP_Error {
* @param mixed $data Optional. Error data. * @param mixed $data Optional. Error data.
* @return WP_Error * @return WP_Error
*/ */
public function __construct($code = '', $message = '', $data = '') { public function __construct( $code = '', $message = '', $data = '' ) {
if ( empty($code) ) if ( empty($code) )
return; return;
@ -203,7 +204,7 @@ class WP_Error {
} }
/** /**
* Append more error messages to list of error messages. * Add an error or append additional message to an existing error.
* *
* @since 2.1.0 * @since 2.1.0
* @access public * @access public