Skip to content

Commit a508a8b

Browse files
committed
setAccessible() does not have any effect as of PHP 8.1
1 parent 65a4d3e commit a508a8b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/DocBlock/Tags/InvalidTag.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function withError(Throwable $exception): self
7777
private function flattenExceptionBacktrace(Throwable $exception): void
7878
{
7979
$traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace');
80-
$traceProperty->setAccessible(true);
80+
if (PHP_VERSION_ID < 80100) {
81+
$traceProperty->setAccessible(true);
82+
}
8183

8284
do {
8385
$trace = $exception->getTrace();
@@ -96,7 +98,9 @@ function (array $call): array {
9698
$exception = $exception->getPrevious();
9799
} while ($exception !== null);
98100

99-
$traceProperty->setAccessible(false);
101+
if (PHP_VERSION_ID < 80100) {
102+
$traceProperty->setAccessible(false);
103+
}
100104
}
101105

102106
/**

0 commit comments

Comments
 (0)