Skip to content

Commit 06154da

Browse files
committed
Fix some deprecations
1 parent d0ce473 commit 06154da

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

src/RemoteRequest/CurlRemoteGetRequest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ static function ($curl, $header) use (&$headers) {
136136
$status = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
137137

138138
$curlErrno = curl_errno($curlHandle);
139-
curl_close($curlHandle);
139+
if ( PHP_VERSION_ID < 80000 ) {
140+
curl_close($curlHandle);
141+
}
140142

141143
if ($body === false || $status < 200 || $status >= 300) {
142144
if (! $retriesLeft || in_array($curlErrno, self::RETRYABLE_ERROR_CODES, true) === false) {

tests/Optimizer/SpecTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ private function getTransformer($scenario, $transformerClass, $configuration)
340340
private function callPrivateMethod($object, $methodName, $args = [])
341341
{
342342
$method = (new ReflectionClass($object))->getMethod($methodName);
343-
$method->setAccessible(true);
343+
if ( PHP_VERSION_ID < 80100 ) {
344+
$method->setAccessible(true);
345+
}
344346

345347
return $method->invokeArgs($object, $args);
346348
}

tests/Optimizer/TransformationEngineTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ private function getTransformationEngine(?Configuration $configuration = null)
151151
private function getPrivateProperty($object, $propertyName)
152152
{
153153
$property = ( new ReflectionClass($object) )->getProperty($propertyName);
154-
$property->setAccessible(true);
154+
if ( PHP_VERSION_ID < 80100 ) {
155+
$property->setAccessible(true);
156+
}
155157
return $property->getValue($object);
156158
}
157159
}

tests/src/PrivateAccess.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ trait PrivateAccess
2626
private function callPrivateMethod($object, $methodName, $args = [])
2727
{
2828
$method = ( new ReflectionClass($object) )->getMethod($methodName);
29-
$method->setAccessible(true);
29+
if ( PHP_VERSION_ID < 80100 ) {
30+
$method->setAccessible(true);
31+
}
3032
return $method->invokeArgs($object, $args);
3133
}
3234

@@ -57,7 +59,9 @@ private function callPrivateStaticMethod($class, $methodName, $args = [])
5759
private function setPrivateProperty($object, $propertyName, $value)
5860
{
5961
$property = ( new ReflectionClass($object) )->getProperty($propertyName);
60-
$property->setAccessible(true);
62+
if ( PHP_VERSION_ID < 80100 ) {
63+
$property->setAccessible(true);
64+
}
6165

6266
// Note: In PHP 8, `ReflectionProperty::getValue()` now requires that an object be supplied if it's a
6367
// non-static property.
@@ -75,7 +79,9 @@ private function setPrivateProperty($object, $propertyName, $value)
7579
private function getPrivateProperty($object, $propertyName)
7680
{
7781
$property = ( new ReflectionClass($object) )->getProperty($propertyName);
78-
$property->setAccessible(true);
82+
if ( PHP_VERSION_ID < 80100 ) {
83+
$property->setAccessible(true);
84+
}
7985

8086
// Note: In PHP 8, `ReflectionProperty::getValue()` now requires that an object be supplied if it's a
8187
// non-static property.

0 commit comments

Comments
 (0)