Skip to content

Commit 8217065

Browse files
committed
PHP 8.3 | ReportWidthTest: fix deprecation notices for ReflectionProperty::setValue()
The `ReflectionProperty::setValue()` method supports three method signatures, two of which are deprecated as of PHP 8.3. This adjusts the call to `ReflectionProperty::setValue()` in various methods in the `UtilsTest` class to pass `null` as the "object" for setting the value of a static property to make the method calls cross-version compatible. Note: these deprecations were visible in the test summary, but the tests - as they currently are - are not set up correctly to fail builds on deprecation notices, which is probably why this went unnoticed. Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue
1 parent a177d5a commit 8217065

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/UtilsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function testHttpRequestBadAddress() {
454454
$prev_logger = WP_CLI::get_logger();
455455

456456
// Enable exit exception.
457-
$class_wp_cli_capture_exit->setValue( true );
457+
$class_wp_cli_capture_exit->setValue( null, true );
458458

459459
$logger = new Loggers\Execution();
460460
WP_CLI::set_logger( $logger );
@@ -472,7 +472,7 @@ public function testHttpRequestBadAddress() {
472472
$this->assertTrue( 0 === strpos( $logger->stderr, 'Error: Failed to get url' ) );
473473

474474
// Restore.
475-
$class_wp_cli_capture_exit->setValue( $prev_capture_exit );
475+
$class_wp_cli_capture_exit->setValue( null, $prev_capture_exit );
476476
WP_CLI::set_logger( $prev_logger );
477477
}
478478

@@ -675,7 +675,7 @@ public function testReportBatchOperationResults( $stdout, $stderr, $noun, $verb,
675675
$prev_logger = WP_CLI::get_logger();
676676

677677
// Enable exit exception.
678-
$class_wp_cli_capture_exit->setValue( true );
678+
$class_wp_cli_capture_exit->setValue( null, true );
679679

680680
$logger = new Loggers\Execution();
681681
WP_CLI::set_logger( $logger );
@@ -691,7 +691,7 @@ public function testReportBatchOperationResults( $stdout, $stderr, $noun, $verb,
691691
$this->assertSame( $stderr, $logger->stderr );
692692

693693
// Restore.
694-
$class_wp_cli_capture_exit->setValue( $prev_capture_exit );
694+
$class_wp_cli_capture_exit->setValue( null, $prev_capture_exit );
695695
WP_CLI::set_logger( $prev_logger );
696696
}
697697

0 commit comments

Comments
 (0)