Skip to content

Commit 072c2b0

Browse files
committed
chore: As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default. Symfony 7.3 requires PHP 8.2+.
https://www.php.net/manual/en/reflectionproperty.setaccessible.php
1 parent 5bf8b3e commit 072c2b0

File tree

5 files changed

+0
-6
lines changed

5 files changed

+0
-6
lines changed

src/Symfony/Bridge/PhpUnit/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) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ public function toString(): string
389389
{
390390
$exception = new \Exception($this->message);
391391
$reflection = new \ReflectionProperty($exception, 'trace');
392-
$reflection->setAccessible(true);
393392
$reflection->setValue($exception, $this->trace);
394393

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

src/Symfony/Bridge/PhpUnit/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
}

src/Symfony/Bridge/PhpUnit/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__.'/../..')];

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ public function testRoundMethodKeepsIntegersAsIntegers()
754754
// Use reflection to test the private round() method directly
755755
$reflection = new \ReflectionClass($transformer);
756756
$roundMethod = $reflection->getMethod('round');
757-
$roundMethod->setAccessible(true);
758757

759758
$int = \PHP_INT_MAX - 1;
760759
$result = $roundMethod->invoke($transformer, $int);

0 commit comments

Comments
 (0)