Make WordPress Core


Ignore:
Timestamp:
12/06/2021 09:29:00 PM (3 years ago)
Author:
SergeyBiryukov
Message:

HTTP API: Revert changeset [52244].

Reverting Requests 2.0.0 changes and moving to WordPress 6.0 cycle. Why? The namespace and file case renaming revealed 2 issues in Core's upgrader process.

See https://core.trac.wordpress.org/ticket/54504#comment:22 for more information.

Follow-up to [52327].

See #54562, #54504.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/Requests/Utility/FilteredIterator.php

    r52244 r52328  
    33 * Iterator for arrays requiring filtered values
    44 *
    5  * @package Requests\Utilities
     5 * @package Requests
     6 * @subpackage Utilities
    67 */
    7 
    8 namespace WpOrg\Requests\Utility;
    9 
    10 use ArrayIterator;
    11 use ReturnTypeWillChange;
    12 use WpOrg\Requests\Exception\InvalidArgument;
    13 use WpOrg\Requests\Utility\InputValidator;
    148
    159/**
    1610 * Iterator for arrays requiring filtered values
    1711 *
    18  * @package Requests\Utilities
     12 * @package Requests
     13 * @subpackage Utilities
    1914 */
    20 final class FilteredIterator extends ArrayIterator {
     15class Requests_Utility_FilteredIterator extends ArrayIterator {
    2116    /**
    2217     * Callback to run as a filter
     
    2419     * @var callable
    2520     */
    26     private $callback;
     21    protected $callback;
    2722
    2823    /**
     
    3126     * @param array $data
    3227     * @param callable $callback Callback to be called on each value
    33      *
    34      * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not iterable.
    3528     */
    3629    public function __construct($data, $callback) {
    37         if (InputValidator::is_iterable($data) === false) {
    38             throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));
    39         }
    40 
    4130        parent::__construct($data);
    4231
    43         if (is_callable($callback)) {
    44             $this->callback = $callback;
    45         }
    46     }
    47 
    48     /**
    49      * @inheritdoc
    50      *
    51      * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound
    52      */
    53     #[ReturnTypeWillChange]
    54     public function __unserialize($data) {}
    55     // phpcs:enable
    56 
    57     public function __wakeup() {
    58         unset($this->callback);
     32        $this->callback = $callback;
    5933    }
    6034
     
    6438     * @return string
    6539     */
    66     #[ReturnTypeWillChange]
    6740    public function current() {
    6841        $value = parent::current();
     
    7851     * @inheritdoc
    7952     */
    80     #[ReturnTypeWillChange]
    81     public function unserialize($data) {}
     53    public function unserialize($serialized) {}
     54
     55    /**
     56     * @inheritdoc
     57     *
     58     * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound
     59     */
     60    public function __unserialize($serialized) {}
     61
     62    public function __wakeup() {
     63        unset($this->callback);
     64    }
    8265}
Note: See TracChangeset for help on using the changeset viewer.