mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Merge pull request #414 from W0rma/reflection-set-accessible
Do not call Reflection*::setAccessible() in PHP >= 8.1
This commit is contained in:
@@ -77,7 +77,9 @@ final class InvalidTag implements Tag
|
|||||||
private function flattenExceptionBacktrace(Throwable $exception): void
|
private function flattenExceptionBacktrace(Throwable $exception): void
|
||||||
{
|
{
|
||||||
$traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace');
|
$traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace');
|
||||||
$traceProperty->setAccessible(true);
|
if (PHP_VERSION_ID < 80100) {
|
||||||
|
$traceProperty->setAccessible(true);
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$trace = $exception->getTrace();
|
$trace = $exception->getTrace();
|
||||||
@@ -96,7 +98,9 @@ final class InvalidTag implements Tag
|
|||||||
$exception = $exception->getPrevious();
|
$exception = $exception->getPrevious();
|
||||||
} while ($exception !== null);
|
} while ($exception !== null);
|
||||||
|
|
||||||
$traceProperty->setAccessible(false);
|
if (PHP_VERSION_ID < 80100) {
|
||||||
|
$traceProperty->setAccessible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user