Skip to content

Commit e198462

Browse files
minor #50158 Fix registering traceable voters, argument resolvers and normalizers (nicolas-grekas)
This PR was merged into the 6.3 branch. Discussion ---------- Fix registering traceable voters, argument resolvers and normalizers | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - By using service decoration to trace voters, resolvers and normalizers, we break the possibility to register them under several tags. We also make it harder to decorate them for end users. But adding observability to those doesn't require adding side effect to service definitions. Instead, we can and should use regular decoration. Commits ------- 12fc94d98f Fix registering traceable voters, argument resolvers and normalizers
2 parents ef30078 + c74dcff commit e198462

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DependencyInjection/Compiler/AddSecurityVotersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function process(ContainerBuilder $container)
5656
}
5757

5858
if ($debug) {
59-
$voterServices[] = new Reference($debugVoterServiceId = 'debug.security.voter.'.$voterServiceId);
59+
$voterServices[] = new Reference($debugVoterServiceId = '.debug.security.voter.'.$voterServiceId);
6060

6161
$container
6262
->register($debugVoterServiceId, TraceableVoter::class)

Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ public function testThatVotersAreTraceableInDebugMode()
9191
$compilerPass = new AddSecurityVotersPass();
9292
$compilerPass->process($container);
9393

94-
$def1 = $container->getDefinition('debug.security.voter.voter1');
94+
$def1 = $container->getDefinition('.debug.security.voter.voter1');
9595
$this->assertNull($def1->getDecoratedService(), 'voter1: should not be decorated');
9696
$this->assertEquals(new Reference('voter1'), $def1->getArgument(0), 'voter1: wrong argument');
9797

98-
$def2 = $container->getDefinition('debug.security.voter.voter2');
98+
$def2 = $container->getDefinition('.debug.security.voter.voter2');
9999
$this->assertNull($def2->getDecoratedService(), 'voter2: should not be decorated');
100100
$this->assertEquals(new Reference('voter2'), $def2->getArgument(0), 'voter2: wrong argument');
101101

0 commit comments

Comments
 (0)