Skip to content

Commit 0270060

Browse files
committed
add back setAccessible() for PHP 7 compatibility
1 parent 39ff860 commit 0270060

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

src/Symfony/Bridge/PhpUnit/CoverageListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function startTest(Test $test): void
8686
private function addCoversForClassToAnnotationCache(Test $test, array $covers): void
8787
{
8888
$r = new \ReflectionProperty(TestUtil::class, 'annotationCache');
89+
$r->setAccessible(true);
8990

9091
$cache = $r->getValue();
9192
$cache = array_replace_recursive($cache, [
@@ -102,6 +103,7 @@ private function addCoversForDocBlockInsideRegistry(Test $test, array $covers):
102103
$docBlock = Registry::getInstance()->forClassName(\get_class($test));
103104

104105
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
106+
$symbolAnnotations->setAccessible(true);
105107

106108
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
107109
$covers = array_filter($covers, function (string $class) {

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ public function toString()
437437
{
438438
$exception = new \Exception($this->message);
439439
$reflection = new \ReflectionProperty($exception, 'trace');
440+
$reflection->setAccessible(true);
440441
$reflection->setValue($exception, $this->trace);
441442

442443
return ($this->originatesFromAnObject() ? 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().":\n" : '')

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ private function willBeIsolated(TestCase $test): bool
357357
}
358358

359359
$r = new \ReflectionProperty($test, 'runTestInSeparateProcess');
360+
$r->setAccessible(true);
360361

361362
return $r->getValue($test) ?? false;
362363
}

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ public static function setUpBeforeClass(): void
275275
$loader = require $v.'/autoload.php';
276276
$reflection = new \ReflectionClass($loader);
277277
$prop = $reflection->getProperty('prefixDirsPsr4');
278+
$prop->setAccessible(true);
278279
$currentValue = $prop->getValue($loader);
279280
self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue];
280281
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy