From 94d80220b9aa2b2df94e1e9aa0d604bdfaef7fff Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Fri, 14 Nov 2025 14:55:00 -0800 Subject: [PATCH] More PHP 8.5 changes --- src/AnnotatedCommand.php | 4 +++- tests/AnnotatedCommandFactoryTest.php | 4 +++- tests/FullStackTest.php | 4 +++- tests/FullyQualifiedClassCacheTest.php | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/AnnotatedCommand.php b/src/AnnotatedCommand.php index bdf0cb7..b9ccb7e 100644 --- a/src/AnnotatedCommand.php +++ b/src/AnnotatedCommand.php @@ -259,7 +259,9 @@ private function addInputOption($inputOption, $description = null) // Alas, Symfony provides no accessor. $class = new \ReflectionClass($inputOption); $property = $class->getProperty('suggestedValues'); - $property->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $property->setAccessible(true); + } $suggestedValues = $property->getValue($inputOption); } $this->addOption( diff --git a/tests/AnnotatedCommandFactoryTest.php b/tests/AnnotatedCommandFactoryTest.php index 6cd7ba9..574341c 100644 --- a/tests/AnnotatedCommandFactoryTest.php +++ b/tests/AnnotatedCommandFactoryTest.php @@ -1216,7 +1216,9 @@ function ($output, $message) { function callProtected($object, $method, $args = []) { $r = new \ReflectionMethod($object, $method); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $r->setAccessible(true); + } return $r->invokeArgs($object, $args); } diff --git a/tests/FullStackTest.php b/tests/FullStackTest.php index 3be8567..35ec34d 100644 --- a/tests/FullStackTest.php +++ b/tests/FullStackTest.php @@ -512,7 +512,9 @@ function simplifyWhitespace($data) function callProtected($object, $method, $args = []) { $r = new \ReflectionMethod($object, $method); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $r->setAccessible(true); + } return $r->invokeArgs($object, $args); } diff --git a/tests/FullyQualifiedClassCacheTest.php b/tests/FullyQualifiedClassCacheTest.php index c366649..070aa50 100644 --- a/tests/FullyQualifiedClassCacheTest.php +++ b/tests/FullyQualifiedClassCacheTest.php @@ -40,7 +40,9 @@ function testFqcn() function callProtected($object, $method, $args = []) { $r = new \ReflectionMethod($object, $method); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) { + $r->setAccessible(true); + } return $r->invokeArgs($object, $args); } }