Skip to content

Commit b532df1

Browse files
committed
[Twig] Move configuration to PHP
1 parent a66a3a8 commit b532df1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Tests/DependencyInjection/Compiler/UnusedTagsPassUtils.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ public static function getDefinedTags(): array
3737
}
3838
}
3939

40+
// get all tags used in PHP configs
41+
$files = Finder::create()->files()->name('*.php')->path('Resources')->notPath('Tests')->in(\dirname(__DIR__, 5));
42+
foreach ($files as $file) {
43+
$contents = file_get_contents($file);
44+
if (preg_match_all("{->tag\('([^']+)'}", $contents, $matches)) {
45+
foreach ($matches[1] as $match) {
46+
$tags[$match] = true;
47+
}
48+
}
49+
}
50+
4051
// get all tags used in findTaggedServiceIds calls()
4152
$files = Finder::create()->files()->name('*.php')->path('DependencyInjection')->notPath('Tests')->in(\dirname(__DIR__, 5));
4253
foreach ($files as $file) {

0 commit comments

Comments
 (0)