Make WordPress Core


Ignore:
Timestamp:
08/21/2022 04:55:18 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Remove dynamic properties in theme tests.

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

In this particular group of test files, the test classes contain a set_up() method which sets a few dynamic (not explicitly declared) properties.

For those properties which were set using a function call or variable access, the property has been explicitly declared on the class now.

For those properties which were set using a constant scalar expression and for which the value is not changed by any of the tests, the property setting has been removed in favor of declaring a class constant.

Includes removing one unused dynamic property declaration: $this->queries in Test_Block_Supports_Layout, which appears to be a copy/paste from Tests_Theme_wpThemeJsonResolver.

Follow-up to [40/tests], [260/tests], [598/tests], [50960], [52675], [53085], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856].

Props jrf.
See #56033.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-supports/layout.php

    r53680 r53916  
    1818 */
    1919class Test_Block_Supports_Layout extends WP_UnitTestCase {
     20
     21    /**
     22     * Theme root directory.
     23     *
     24     * @var string
     25     */
     26    private $theme_root;
     27
     28    /**
     29     * Original theme directory.
     30     *
     31     * @var string
     32     */
     33    private $orig_theme_dir;
     34
    2035    function set_up() {
    2136        parent::set_up();
     
    3146        add_filter( 'template_root', array( $this, 'filter_set_theme_root' ) );
    3247
    33         $this->queries = array();
    3448        // Clear caches.
    3549        wp_clean_themes_cache();
Note: See TracChangeset for help on using the changeset viewer.