Make WordPress Core

Changeset 54157


Ignore:
Timestamp:
09/14/2022 01:06:53 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Docs: Correct @return value for wp_get_http_headers().

Following the update to replace the HTTP API internals with Requests library in WordPress 4.6, the return value of wp_remote_retrieve_headers() has changed from a simple array to an object which implements ArrayAccess.

Since wp_get_http_headers() directly returns the result of wp_remote_retrieve_headers(), its return value should reflect that change.

Includes:

  • Updating the return value for the deprecated wp_get_http() function, which also directly returns the result of wp_remote_retrieve_headers().
  • Minor DocBlock formatting changes for some other HTTP API functions per the documentation standards.

Follow-up to [2416], [6390], [8092], [9013], [37428], [37989], [38730].

Props mhkuu.
See #54225, #55646.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r54155 r54157  
    36553655 * @param int         $red       Optional. The number of Redirects followed, Upon 5 being hit,
    36563656 *                               returns false. Default 1.
    3657  * @return bool|string False on failure and string of headers if HEAD request.
     3657 * @return \Requests_Utility_CaseInsensitiveDictionary|false Headers on success, false on failure.
    36583658 */
    36593659function wp_get_http( $url, $file_path = false, $red = 1 ) {
  • trunk/src/wp-includes/functions.php

    r54146 r54157  
    979979 * @param string $url        URL to retrieve HTTP headers from.
    980980 * @param bool   $deprecated Not Used.
    981  * @return string|false Headers on success, false on failure.
     981 * @return \Requests_Utility_CaseInsensitiveDictionary|false Headers on success, false on failure.
    982982 */
    983983function wp_get_http_headers( $url, $deprecated = false ) {
  • trunk/src/wp-includes/http.php

    r53770 r54157  
    206206 *
    207207 * @param array|WP_Error $response HTTP response.
    208  * @return array|\Requests_Utility_CaseInsensitiveDictionary The headers of the response. Empty array if incorrect parameter given.
     208 * @return \Requests_Utility_CaseInsensitiveDictionary|array The headers of the response, or empty array
     209 *                                                           if incorrect parameter given.
    209210 */
    210211function wp_remote_retrieve_headers( $response ) {
     
    246247 *
    247248 * @param array|WP_Error $response HTTP response.
    248  * @return int|string The response code as an integer. Empty string on incorrect parameter given.
     249 * @return int|string The response code as an integer. Empty string if incorrect parameter given.
    249250 */
    250251function wp_remote_retrieve_response_code( $response ) {
     
    264265 *
    265266 * @param array|WP_Error $response HTTP response.
    266  * @return string The response message. Empty string on incorrect parameter given.
     267 * @return string The response message. Empty string if incorrect parameter given.
    267268 */
    268269function wp_remote_retrieve_response_message( $response ) {
     
    296297 *
    297298 * @param array|WP_Error $response HTTP response.
    298  * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.
     299 * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response.
     300 *                          Empty array if there are none, or the response is a WP_Error.
    299301 */
    300302function wp_remote_retrieve_cookies( $response ) {
     
    313315 * @param array|WP_Error $response HTTP response.
    314316 * @param string         $name     The name of the cookie to retrieve.
    315  * @return WP_Http_Cookie|string The `WP_Http_Cookie` object. Empty string if the cookie isn't present in the response.
     317 * @return WP_Http_Cookie|string The `WP_Http_Cookie` object, or empty string
     318 *                               if the cookie is not present in the response.
    316319 */
    317320function wp_remote_retrieve_cookie( $response, $name ) {
     
    338341 * @param array|WP_Error $response HTTP response.
    339342 * @param string         $name     The name of the cookie to retrieve.
    340  * @return string The value of the cookie. Empty string if the cookie isn't present in the response.
     343 * @return string The value of the cookie, or empty string
     344 *                if the cookie is not present in the response.
    341345 */
    342346function wp_remote_retrieve_cookie_value( $response, $name ) {
Note: See TracChangeset for help on using the changeset viewer.