From 47c1d860400535abcd78116dc0433c9defc201fa Mon Sep 17 00:00:00 2001 From: Michiel Rook Date: Thu, 25 Apr 2024 22:25:54 +0200 Subject: [PATCH] Fix test on PHP 8.3 --- tests/Phing/Test/Io/FileSystemTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Phing/Test/Io/FileSystemTest.php b/tests/Phing/Test/Io/FileSystemTest.php index e3c29f2e1..5f9cf84bd 100644 --- a/tests/Phing/Test/Io/FileSystemTest.php +++ b/tests/Phing/Test/Io/FileSystemTest.php @@ -123,8 +123,13 @@ public function testListContentsWithNumericName(): void protected function resetFileSystem(): void { $refClass = new ReflectionClass(FileSystem::class); - $refProperty = $refClass->getProperty('fs'); - $refProperty->setAccessible(true); - $refProperty->setValue(null); + + if (version_compare(PHP_VERSION, '8.3.0', '>=')) { + $refClass->setStaticPropertyValue('fs', null); + } else { + $refProperty = $refClass->getProperty('fs'); + $refProperty->setAccessible(true); + $refProperty->setValue(null); + } } }