Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15b26b2

Browse files
committed
Mark oidc.signature_algorithm tag as legally unused
1 parent d930172 commit 15b26b2

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,40 @@
2121
*/
2222
class UnusedTagsPass implements CompilerPassInterface
2323
{
24+
public function process(ContainerBuilder $container): void
25+
{
26+
$tags = array_unique(array_merge($container->findTags(), self::KNOWN_TAGS));
27+
28+
foreach ($container->findUnusedTags() as $tag) {
29+
// skip known tags
30+
if (\in_array($tag, self::KNOWN_TAGS, true)) {
31+
continue;
32+
}
33+
34+
// check for typos
35+
$candidates = [];
36+
foreach ($tags as $definedTag) {
37+
if ($definedTag === $tag) {
38+
continue;
39+
}
40+
41+
if (str_contains($definedTag, $tag) || levenshtein($tag, $definedTag) <= \strlen($tag) / 3) {
42+
$candidates[] = $definedTag;
43+
}
44+
}
45+
46+
$services = array_keys($container->findTaggedServiceIds($tag));
47+
$message = sprintf('Tag "%s" was defined on service(s) "%s", but was never used.', $tag, implode('", "', $services));
48+
if ($candidates) {
49+
$message .= sprintf(' Did you mean "%s"?', implode('", "', $candidates));
50+
}
51+
52+
$container->log($this, $message);
53+
}
54+
}
55+
2456
private const KNOWN_TAGS = [
57+
'annotations.cached_reader',
2558
'asset_mapper.compiler',
2659
'assets.package',
2760
'auto_alias',
@@ -31,6 +64,7 @@ class UnusedTagsPass implements CompilerPassInterface
3164
'chatter.transport_factory',
3265
'config_cache.resource_checker',
3366
'console.command',
67+
'container.do_not_inline',
3468
'container.env_var_loader',
3569
'container.env_var_processor',
3670
'container.excluded',
@@ -82,6 +116,7 @@ class UnusedTagsPass implements CompilerPassInterface
82116
'routing.route_loader',
83117
'scheduler.schedule_provider',
84118
'scheduler.task',
119+
'security.access_token_handler.oidc.signature_algorithm',
85120
'security.authenticator.login_linker',
86121
'security.expression_language_provider',
87122
'security.remember_me_handler',
@@ -103,36 +138,4 @@ class UnusedTagsPass implements CompilerPassInterface
103138
'validator.initializer',
104139
'workflow',
105140
];
106-
107-
public function process(ContainerBuilder $container): void
108-
{
109-
$tags = array_unique(array_merge($container->findTags(), self::KNOWN_TAGS));
110-
111-
foreach ($container->findUnusedTags() as $tag) {
112-
// skip known tags
113-
if (\in_array($tag, self::KNOWN_TAGS, true)) {
114-
continue;
115-
}
116-
117-
// check for typos
118-
$candidates = [];
119-
foreach ($tags as $definedTag) {
120-
if ($definedTag === $tag) {
121-
continue;
122-
}
123-
124-
if (str_contains($definedTag, $tag) || levenshtein($tag, $definedTag) <= \strlen($tag) / 3) {
125-
$candidates[] = $definedTag;
126-
}
127-
}
128-
129-
$services = array_keys($container->findTaggedServiceIds($tag));
130-
$message = sprintf('Tag "%s" was defined on service(s) "%s", but was never used.', $tag, implode('", "', $services));
131-
if ($candidates) {
132-
$message .= sprintf(' Did you mean "%s"?', implode('", "', $candidates));
133-
}
134-
135-
$container->log($this, $message);
136-
}
137-
}
138141
}

0 commit comments

Comments
 (0)