Skip to content

Commit 56f01c4

Browse files
minor #51117 Remove \ReflectionProperty::setAccessible(true) calls (fancyweb)
This PR was merged into the 6.4 branch. Discussion ---------- Remove \ReflectionProperty::setAccessible(true) calls | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 9e78833 Remove \ReflectionProperty::setAccessible(true) calls
2 parents 649c8a1 + 9e78833 commit 56f01c4

File tree

9 files changed

+0
-11
lines changed

9 files changed

+0
-11
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ public function testFilterDuplicateTransPaths()
168168
$command = $this->createMock(TranslationUpdateCommand::class);
169169

170170
$method = new \ReflectionMethod(TranslationUpdateCommand::class, 'filterDuplicateTransPaths');
171-
$method->setAccessible(true);
172171

173172
$filteredTransPaths = $method->invoke($command, $transPaths);
174173

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function testNormalizersAndEncodersUseDefaultContextConfigOption(string $
4444

4545
$reflectionObject = new \ReflectionObject($normalizer);
4646
$property = $reflectionObject->getProperty('defaultContext');
47-
$property->setAccessible(true);
4847

4948
$defaultContext = $property->getValue($normalizer);
5049

src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,6 @@ private function hasNormalizationClosures(NodeInterface $node): bool
589589
} catch (\ReflectionException) {
590590
return false;
591591
}
592-
$r->setAccessible(true);
593592

594593
return [] !== $r->getValue($node);
595594
}

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ private function getListenersWithPriority(): array
348348
$result = [];
349349

350350
$allListeners = new \ReflectionProperty(EventDispatcher::class, 'listeners');
351-
$allListeners->setAccessible(true);
352351

353352
foreach ($allListeners->getValue($this->dispatcher) as $eventName => $listenersByPriority) {
354353
foreach ($listenersByPriority as $priority => $listeners) {

src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public function testSendAllDead()
6262
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
6363
$t = new RoundRobinTransport([$t1, $t2]);
6464
$p = new \ReflectionProperty($t, 'cursor');
65-
$p->setAccessible(true);
6665
$p->setValue($t, 0);
6766

6867
try {

src/Symfony/Component/Mailer/Tests/Transport/Smtp/SmtpTransportTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ private function invokeAssertResponseCode(string $response, array $codes): void
162162
{
163163
$transport = new SmtpTransport($this->getMockForAbstractClass(AbstractStream::class));
164164
$m = new \ReflectionMethod($transport, 'assertResponseCode');
165-
$m->setAccessible(true);
166165
$m->invoke($transport, $response, $codes);
167166
}
168167

src/Symfony/Component/Mime/Tests/MessageConverterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ private function assertConversion(Email $expected)
7878
}
7979

8080
$r = new \ReflectionProperty($expected, 'cachedBody');
81-
$r->setAccessible(true);
8281
$r->setValue($expected, null);
8382
$r->setValue($converted, null);
8483

src/Symfony/Component/Notifier/Bridge/Chatwork/Tests/ChatworkMessageBodyBuilderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function testSetTo()
2121
$builder = new ChatworkMessageBodyBuilder();
2222
$builder->to(['abc', 'def']);
2323
$property = new \ReflectionProperty($builder, 'to');
24-
$property->setAccessible(true);
2524
$this->assertSame(['abc', 'def'], $property->getValue($builder));
2625
$builder->to('ghi');
2726
$this->assertSame(['ghi'], $property->getValue($builder));
@@ -32,7 +31,6 @@ public function testSetSelfUnread()
3231
$builder = new ChatworkMessageBodyBuilder();
3332
$builder->selfUnread(true);
3433
$property = new \ReflectionProperty($builder, 'selfUnread');
35-
$property->setAccessible(true);
3634
$this->assertTrue($property->getValue($builder));
3735
}
3836

@@ -41,7 +39,6 @@ public function testSetBody()
4139
$builder = new ChatworkMessageBodyBuilder();
4240
$builder->body('test body');
4341
$property = new \ReflectionProperty($builder, 'body');
44-
$property->setAccessible(true);
4542
$this->assertEquals('test body', $property->getValue($builder));
4643
}
4744

src/Symfony/Component/Scheduler/Tests/Trigger/PeriodicalTriggerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public function testConstructor(PeriodicalTrigger $trigger, bool $optimizable =
3030
if ($optimizable) {
3131
// test that we are using the fast algorithm for short period of time
3232
$p = new \ReflectionProperty($trigger, 'intervalInSeconds');
33-
$p->setAccessible(true);
3433
$this->assertNotSame(0, $p->getValue($trigger));
3534
}
3635
}

0 commit comments

Comments
 (0)