Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Symfony/Bridge/PhpUnit/CoverageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public function startTest(Test $test): void
private function addCoversForClassToAnnotationCache(Test $test, array $covers): void
{
$r = new \ReflectionProperty(TestUtil::class, 'annotationCache');
$r->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$r->setAccessible(true);
}

$cache = $r->getValue();
$cache = array_replace_recursive($cache, [
Expand All @@ -103,7 +105,9 @@ private function addCoversForDocBlockInsideRegistry(Test $test, array $covers):
$docBlock = Registry::getInstance()->forClassName(\get_class($test));

$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
$symbolAnnotations->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$symbolAnnotations->setAccessible(true);
}

// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
$covers = array_filter($covers, function (string $class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ public function toString()
{
$exception = new \Exception($this->message);
$reflection = new \ReflectionProperty($exception, 'trace');
$reflection->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$reflection->setAccessible(true);
}
$reflection->setValue($exception, $this->trace);

return ($this->originatesFromAnObject() ? 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().":\n" : '')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ private function willBeIsolated(TestCase $test): bool
}

$r = new \ReflectionProperty($test, 'runTestInSeparateProcess');
$r->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$r->setAccessible(true);
}

return $r->getValue($test) ?? false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ public static function setUpBeforeClass(): void
$loader = require $v.'/autoload.php';
$reflection = new \ReflectionClass($loader);
$prop = $reflection->getProperty('prefixDirsPsr4');
$prop->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$prop->setAccessible(true);
}
$currentValue = $prop->getValue($loader);
self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue];
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];
Expand Down
Loading