Correct return value for get_role() and WP_Roles::get_role(). props tivnet. fixes #24607.

git-svn-id: http://core.svn.wordpress.org/trunk@24491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-06-21 13:01:55 +00:00
parent 58c364947f
commit 81e2420c0a
1 changed files with 4 additions and 4 deletions

View File

@ -158,7 +158,7 @@ class WP_Roles {
* @param string $role Role name. * @param string $role Role name.
* @param string $display_name Role display name. * @param string $display_name Role display name.
* @param array $capabilities List of role capabilities in the above format. * @param array $capabilities List of role capabilities in the above format.
* @return null|WP_Role WP_Role object if role is added, null if already exists. * @return WP_Role|null WP_Role object if role is added, null if already exists.
*/ */
function add_role( $role, $display_name, $capabilities = array() ) { function add_role( $role, $display_name, $capabilities = array() ) {
if ( isset( $this->roles[$role] ) ) if ( isset( $this->roles[$role] ) )
@ -239,7 +239,7 @@ class WP_Roles {
* @access public * @access public
* *
* @param string $role Role name. * @param string $role Role name.
* @return object|null Null, if role does not exist. WP_Role object, if found. * @return WP_Role|null WP_Role object if found, null if the role does not exist.
*/ */
function get_role( $role ) { function get_role( $role ) {
if ( isset( $this->role_objects[$role] ) ) if ( isset( $this->role_objects[$role] ) )
@ -1374,7 +1374,7 @@ function user_can( $user, $capability ) {
* @since 2.0.0 * @since 2.0.0
* *
* @param string $role Role name. * @param string $role Role name.
* @return object * @return WP_Role|null WP_Role object if found, null if the role does not exist.
*/ */
function get_role( $role ) { function get_role( $role ) {
global $wp_roles; global $wp_roles;
@ -1394,7 +1394,7 @@ function get_role( $role ) {
* @param string $role Role name. * @param string $role Role name.
* @param string $display_name Display name for role. * @param string $display_name Display name for role.
* @param array $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false ); * @param array $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false );
* @return null|WP_Role WP_Role object if role is added, null if already exists. * @return WP_Role|null WP_Role object if role is added, null if already exists.
*/ */
function add_role( $role, $display_name, $capabilities = array() ) { function add_role( $role, $display_name, $capabilities = array() ) {
global $wp_roles; global $wp_roles;