Make WordPress Core


Ignore:
Timestamp:
08/30/2023 10:49:27 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct uses of ReflectionProperty::setValue() for static properties.

The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3. A cross-version solution is to pass null as the first parameter.

This commit updates all the instances that use the deprecated signature in WordPress core.

Reference: PHP RFC: Deprecate functions with overloaded signatures: ReflectionProperty::setValue().

Follow-up to [53152], [54493], [54799].

Props jrf, costdev, Tests: Correct uses of ReflectionProperty::setValue() for static properties.

The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3. A cross-version solution is to pass null as the first parameter.

This commit updates all the instances that use the deprecated signature in WordPress core.

Reference: PHP RFC: Deprecate functions with overloaded signatures: ReflectionProperty::setValue().

Follow-up to [53152], [54493], [54799].

Props jrf, costdev, sc0ttkclark.
See #59231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r55822 r56492  
    8282
    8383        public static function tear_down_after_class() {
    84                 static::$property_blocks_cache->setValue( WP_Theme_JSON_Resolver::class, static::$property_blocks_cache_orig_value );
    85                 static::$property_core->setValue( WP_Theme_JSON_Resolver::class, static::$property_core_orig_value );
     84                static::$property_blocks_cache->setValue( null, static::$property_blocks_cache_orig_value );
     85                static::$property_core->setValue( null, static::$property_core_orig_value );
    8686                parent::tear_down_after_class();
    8787        }
     
    760760                $property = new ReflectionProperty( $theme_json_resolver, 'i18n_schema' );
    761761                $property->setAccessible( true );
    762                 $property->setValue( null );
     762                $property->setValue( null, null );
    763763
    764764                // A completely empty theme.json data set still has the 'version' key when parsed.
Note: See TracChangeset for help on using the changeset viewer.