Skip to content

Commit

Permalink
PHP 8.3 | RequestsTest::testHasCapabilitiesFailsForUnsupportedCapabil…
Browse files Browse the repository at this point in the history
…ities(): 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 the `HasCapabilitiesTest` to pass `null` as the "object" for setting the value of a static property to make the method call cross-version compatible.

Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue
  • Loading branch information
jrfnl committed Jan 8, 2024
1 parent e0ca405 commit 029c103
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/RequestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ public function testHasCapabilitiesSucceedsForDetectingSsl() {
public function testHasCapabilitiesFailsForUnsupportedCapabilities() {
$transports = new ReflectionProperty(Requests::class, 'transports');
$transports->setAccessible(true);
$transports->setValue([TestTransportMock::class]);
$transports->setValue(null, [TestTransportMock::class]);

$result = Requests::has_capabilities(['time-travel' => true]);

$transports->setValue([]);
$transports->setValue(null, []);
$transports->setAccessible(false);

$this->assertFalse($result);
Expand Down

0 comments on commit 029c103

Please sign in to comment.