8000 Remove calls to reflection setAccessible() · symfony/symfony@92978ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 92978ab

Browse files
Remove calls to reflection setAccessible()
1 parent 5186e06 commit 92978ab

File tree

118 files changed

+2
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2
-207
lines changed

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public function testFixManagersAutoMappingsWithTwoAutomappings()
7979

8080
$reflection = new \ReflectionClass(\get_class($this->extension));
8181
$method = $reflection->getMethod('fixManagersAutoMappings');
82-
$method->setAccessible(true);
8382

8483
$method->invoke($this->extension, $emConfigs, $bundles);
8584
}
@@ -168,7 +167,6 @@ public function testFixManagersAutoMappings(array $originalEm1, array $originalE
168167

169168
$reflection = new \ReflectionClass(\get_class($this->extension));
170169
$method = $reflection->getMethod('fixManagersAutoMappings');
171-
$method->setAccessible(true);
172170

173171
$newEmConfigs = $method->invoke($this->extension, $emConfigs, $bundles);
174172

@@ -186,7 +184,6 @@ public function testMappingTypeDetection()
186184

187185
$reflection = new \ReflectionClass(\get_class($this->extension));
188186
$method = $reflection->getMethod('detectMappingType');
189-
$method->setAccessible(true);
190187

191188
// The ordinary fixtures contain annotation
192189
$mappingType = $method->invoke($this->extension, __DIR__.'/../Fixtures', $container);
@@ -329,7 +326,6 @@ public function testBundleAutoMapping(string $bundle, string $expectedType, stri
329326

330327
$reflection = new \ReflectionClass(\get_class($this->extension));
331328
$method = $reflection->getMethod('getMappingDriverBundleConfigDefaults');
332-
$method->setAccessible(true);
333329

334330
$this->assertSame(
335331
[
@@ -347,8 +343,6 @@ protected function invokeLoadCacheDriver(array $objectManager, ContainerBuilder
347343
{
348344
$method = new \ReflectionMethod($this->extension, 'loadObjectManagerCacheDriver');
349345

350-
$method->setAccessible(true);
351-
352346
$method->invokeArgs($this->extension, [$objectManager, $container, $cacheName]);
353347
}
354348

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function testExtract($template, $messages)
4141
$catalogue = new MessageCatalogue('en');
4242

4343
$m = new \ReflectionMethod($extractor, 'extractTemplate');
44-
$m->setAccessible(true);
4544
$m->invoke($extractor, $template, $catalogue);
4645

4746
if (0 === \count($messages)) {

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ private function compileContainer(): ContainerBuilder
127127
$kernel->boot();
128128

129129
$method = new \ReflectionMethod($kernel, 'buildContainer');
130-
$method->setAccessible(true);
131130
$container = $method->invoke($kernel);
132131
$container->getCompiler()->compile($container);
133132

src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ private function getContainerBuilder(): ContainerBuilder
104104
(new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernelContainer->getParameter('debug.container.dump'));
105105

106106
$refl = new \ReflectionProperty($parameterBag, 'resolved');
107-
$refl->setAccessible(true);
108107
$refl->setValue($parameterBag, true);
109108

110109
$skippedIds = [];

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ private function getContainerEnvVars(ContainerBuilder $container): array
326326
$getDefaultParameter = $getDefaultParameter->bindTo($bag, \get_class($bag));
327327

328328
$getEnvReflection = new \ReflectionMethod($container, 'getEnv');
329-
$getEnvReflection->setAccessible(true);
330329

331330
$envs = [];
332331

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function testClearFailed()
8686
$pool->save($item);
8787
$r = new \ReflectionObject($pool);
8888
$p = $r->getProperty('directory');
89-
$p->setAccessible(true);
9089
$poolDir = $p->getValue($pool);
9190

9291
/** @var SplFileInfo $entry */

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ public function updateToken(string $series, string $tokenValue, \DateTime $lastU
4949
$token = $this->loadTokenBySeries($series);
5050
$refl = new \ReflectionClass($token);
5151
$tokenValueProp = $refl->getProperty('tokenValue');
52-
$tokenValueProp->setAccessible(true);
5352
$tokenValueProp->setValue($token, $tokenValue);
5453

5554
$lastUsedProp = $refl->getProperty('lastUsed');
56-
$lastUsedProp->setAccessible(true);
5755
$lastUsedProp->setValue($token, $lastUsed);
5856

5957
self::$db[$series] = $token;

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public function testStopwatchExtensionAvailability($debug, $stopwatchEnabled, $e
225225

226226
$tokenParsers = $container->get('test.twig.extension.debug.stopwatch')->getTokenParsers();
227227
$stopwatchIsAvailable = new \ReflectionProperty($tokenParsers[0], 'stopwatchIsAvailable');
228-
$stopwatchIsAvailable->setAccessible(true);
229228

230229
$this->assertSame($expected, $stopwatchIsAvailable->getValue($tokenParsers[0]));
231230
}

src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function testInjectToolbar($content, $expected)
3232
{
3333
$listener = new WebDebugToolbarListener($this->getTwigMock());
3434
$m = new \ReflectionMethod($listener, 'injectToolbar');
35-
$m->setAccessible(true);
3635

3736
$response = new Response($content);
3837

src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ public function testExpirationOnAllAdapters()
205205
$itemValidator = function (CacheItem $item) {
206206
$refl = new \ReflectionObject($item);
207207
$propExpiry = $refl->getProperty('expiry');
208-
$propExpiry->setAccessible(true);
209208
$expiry = $propExpiry->getValue($item);
210209
$this->assertGreaterThan(10, $expiry - time(), 'Item should be saved with the given ttl, not the default for the adapter.');
211210

0 commit comments

Comments
 (0)
0