Skip to content

Commit 87d042e

Browse files
authored
Merge pull request #174 from antecedent/feature/fix-runtime-deprecations-php-8.5
PHP 8.5 | CallRerouting: prevent deprecation notice for Reflection*::setAccessible()
2 parents 8c1c9c8 + 5f0c012 commit 87d042e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CallRerouting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ function relay(?array $args = null)
326326
try {
327327
if (isset($top['class'])) {
328328
$reflection = new \ReflectionMethod(Stack\topCalledClass(), $top['function']);
329-
$reflection->setAccessible(true);
329+
(\PHP_VERSION_ID < 80100) && $reflection->setAccessible(true);
330330
$result = $reflection->invokeArgs(Stack\top('object'), $args);
331331
} else {
332332
$result = call_user_func_array($top['function'], $args);
@@ -518,7 +518,7 @@ function connectDefaultInternals()
518518
}
519519
try {
520520
$reflection = new \ReflectionMethod($class, $method);
521-
$reflection->setAccessible(true);
521+
(\PHP_VERSION_ID < 80100) && $reflection->setAccessible(true);
522522
$args[$offset] = function() use ($reflection, $instance) {
523523
return $reflection->invokeArgs($instance, func_get_args());
524524
};

0 commit comments

Comments
 (0)