Make WordPress Core

Changeset 53949


Ignore:
Timestamp:
08/28/2022 10:09:39 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Explicitly declare all properties in WP_Test_Stream.

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

The WP_Test_Stream class is a stream wrapper for use in the tests and must comply with the PHP requirements for such stream wrappers.

In this case, the class did not declare the required public $context property, which led to deprecation notices about the property being dynamically created from the Tests_Image_Editor_Imagick::test_streams() and Tests_Image_Meta::test_stream() tests.

Reference: PHP Manual: streamWrapper: Properties.

Follow-up to [49230], [50771], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948].

Props jrf, antonvlasenko.
See #56033.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/class-wp-test-stream.php

    r50771 r53949  
    3030    public $bucket;
    3131    public $data_ref;
     32
     33    /**
     34     * The current context.
     35     *
     36     * @link https://www.php.net/manual/en/class.streamwrapper.php
     37     *
     38     * @var resource|null
     39     */
     40    public $context;
    3241
    3342    /**
Note: See TracChangeset for help on using the changeset viewer.