diff --git a/src/ExtractProperties.php b/src/ExtractProperties.php index 47e1f274b..0bdae976d 100644 --- a/src/ExtractProperties.php +++ b/src/ExtractProperties.php @@ -19,7 +19,9 @@ public static function from($target) { return collect((new ReflectionClass($target))->getProperties()) ->mapWithKeys(function ($property) use ($target) { - $property->setAccessible(true); + if (PHP_VERSION_ID < 80500) { + $property->setAccessible(true); + } if (PHP_VERSION_ID >= 70400 && ! $property->isInitialized($target)) { return []; diff --git a/src/ExtractTags.php b/src/ExtractTags.php index f2c416e89..7fb01295a 100644 --- a/src/ExtractTags.php +++ b/src/ExtractTags.php @@ -130,7 +130,9 @@ protected static function modelsFor(array $targets) { return collect($targets)->map(function ($target) { return collect((new ReflectionClass($target))->getProperties())->map(function ($property) use ($target) { - $property->setAccessible(true); + if (PHP_VERSION_ID < 80500) { + $property->setAccessible(true); + } if (PHP_VERSION_ID < 70400 || ! is_object($target) || $property->isInitialized($target)) { return static::resolveValue($property->getValue($target)); diff --git a/tests/Watchers/EventWatcherTest.php b/tests/Watchers/EventWatcherTest.php index 78f5eecec..8794958f7 100644 --- a/tests/Watchers/EventWatcherTest.php +++ b/tests/Watchers/EventWatcherTest.php @@ -127,7 +127,10 @@ public function test_format_listeners($listener, $formatted) Event::listen(DummyEvent::class, $listener); $method = new \ReflectionMethod(EventWatcher::class, 'formatListeners'); - $method->setAccessible(true); + + if (PHP_VERSION_ID < 80500) { + $method->setAccessible(true); + } $this->assertSame($formatted, $method->invoke(new EventWatcher, DummyEvent::class)[0]['name']); }