Index: src/wp-includes/capabilities.php
===================================================================
--- src/wp-includes/capabilities.php	(revision 25718)
+++ src/wp-includes/capabilities.php	(working copy)
@@ -366,11 +366,6 @@
 	/**
 	 * Whether role has capability.
 	 *
-	 * The capabilities is passed through the 'role_has_cap' filter. The first
-	 * parameter for the hook is the list of capabilities the class has
-	 * assigned. The second parameter is the capability name to look for. The
-	 * third and final parameter for the hook is the role name.
-	 *
 	 * @since 2.0.0
 	 * @access public
 	 *
@@ -378,7 +373,16 @@
 	 * @return bool True, if user has capability. False, if doesn't have capability.
 	 */
 	function has_cap( $cap ) {
-		$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
+        /**
+         * Filter which capabilities a role has.
+         *
+         * @since 2.0.1
+         *
+         * @param array     $this->capabilities Array of role capabilities.
+         * @param string    $cap                Capability name.
+         * @param string    $this->name         Role name.
+         */
+        $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
 		if ( !empty( $capabilities[$cap] ) )
 			return $capabilities[$cap];
 		else
@@ -822,7 +826,18 @@
 		update_user_meta( $this->ID, $this->cap_key, $this->caps );
 		$this->get_role_caps();
 		$this->update_user_level_from_caps();
-		do_action( 'set_user_role', $this->ID, $role, $old_roles );
+
+        /**
+         * Perform an action after the user's role has changed.
+         *
+         * @since 2.9.1
+         * @since 3.6.1 Added $old_roles
+         *
+         * @param int       $this->ID   The user ID.
+         * @param string    $role       The new role.
+         * @param array     $old_roles  An array of user's previous roles.
+         */
+        do_action( 'set_user_role', $this->ID, $role, $old_roles );
 	}
 
 	/**
@@ -942,8 +957,22 @@
 			return true;
 		}
 
-		// Must have ALL requested caps
-		$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
+        /**
+         * Dynamically filter a user's capabilities.
+         *
+         * @since 2.0.1
+         * @since 3.7.0 Added $this
+         *
+         * @param array     $this->allcaps  An array of all the role's
+         *                                  capabilities.
+         * @param array     $caps           Actual capabilities for meta
+         *                                  capability.
+         * @param array     $args           Optional parameters passed to
+         *                                  has_cap(). Typically object ID.
+         * @param WP_User   $this           The user object.
+         */
+        // Must have ALL requested caps
+        $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
 		$capabilities['exist'] = true; // Everyone is allowed to exist
 		foreach ( (array) $caps as $cap ) {
 			if ( empty( $capabilities[ $cap ] ) )
@@ -1170,7 +1199,23 @@
 		$meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false;
 
 		if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}" ) ) {
-			$allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps );
+            /**
+             * Filter controls if the user is allowed to add post meta to a
+             * post.
+             *
+             * `$meta_key` is the meta key passed to map_meta_cap().
+             *
+             * @since 3.3.1
+             *
+             * @param bool      false     Whether the user can add the
+             *                            post meta or not. Defaults to false.
+             * @param string    $mete_key The meta key.
+             * @param int       $post->ID Post ID.
+             * @param int       $user_id  User ID.
+             * @param string    $cap      Capability name.
+             * @param array     $caps     User capabilities.
+             */
+            $allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps );
 			if ( ! $allowed )
 				$caps[] = $cap;
 		} elseif ( $meta_key && is_protected_meta( $meta_key, 'post' ) ) {
@@ -1271,7 +1316,19 @@
 		$caps[] = $cap;
 	}
 
-	return apply_filters('map_meta_cap', $caps, $cap, $user_id, $args);
+    /**
+     * Filter a user's capabilities depending on specific
+     * a context and/or privilege.
+     *
+     * @since 2.8.1
+     *
+     * @param array     $caps       Returns user's actual capabilities.
+     * @param string    $cap        Capability name
+     * @param int       $user_id    The user ID.
+     * @param array     $args       Adds the context to the cap.
+     *                              Typically the object ID.
+     */
+    return apply_filters('map_meta_cap', $caps, $cap, $user_id, $args);
 }
 
 /**
