Skip to content

Commit 2d07490

Browse files
NickSdotnicolas-grekas
authored andcommitted
[Form][PhpUnitBridge] Remove usage of noop ReflectionProperty::setAccessible()
1 parent ba6b753 commit 2d07490

File tree

4 files changed

+0
-5
lines changed

4 files changed

+0
-5
lines changed

CoverageListener.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ 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);
9089

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

105104
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
106-
$symbolAnnotations->setAccessible(true);
107105

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

DeprecationErrorHandler/Deprecation.php

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

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

Legacy/SymfonyTestsListenerTrait.php

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

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

362361
return $r->getValue($test) ?? false;
363362
}

Tests/DeprecationErrorHandler/DeprecationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ 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);
279278
$currentValue = $prop->getValue($loader);
280279
self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue];
281280
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];

0 commit comments

Comments
 (0)