Make WordPress Core


Ignore:
Timestamp:
08/30/2023 10:49:27 AM (19 months 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/rest-api/wpRestBlockPatternsController.php

    r56063 r56492  
    6666        self::$registry_instance_property->setAccessible( true );
    6767        $test_registry = new WP_Block_Pattern_Categories_Registry();
    68         self::$registry_instance_property->setValue( $test_registry );
     68        self::$registry_instance_property->setValue( null, $test_registry );
    6969
    7070        // Register some patterns in the test registry.
     
    107107
    108108        // Restore the original registry instance.
    109         self::$registry_instance_property->setValue( self::$orig_registry );
     109        self::$registry_instance_property->setValue( null, self::$orig_registry );
    110110        self::$registry_instance_property->setAccessible( false );
    111111        self::$registry_instance_property = null;
Note: See TracChangeset for help on using the changeset viewer.