88use Exercise \HTMLPurifierBundle \HTMLPurifiersRegistryInterface ;
99use Symfony \Component \Config \FileLocator ;
1010use Symfony \Component \DependencyInjection \ContainerBuilder ;
11+ use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
1112use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
1213use Symfony \Component \DependencyInjection \Reference ;
1314use Symfony \Component \DependencyInjection \Extension \Extension ;
@@ -16,9 +17,9 @@ class ExerciseHTMLPurifierExtension extends Extension
1617{
1718 public function load (array $ configs , ContainerBuilder $ container ): void
1819 {
19- $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
20+ $ loader = new PhpFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
2021
21- $ loader ->load ('html_purifier.xml ' );
22+ $ loader ->load ('services.php ' );
2223
2324 $ configs = $ this ->processConfiguration (new Configuration (), $ configs );
2425
@@ -30,8 +31,6 @@ public function load(array $configs, ContainerBuilder $container): void
3031 }
3132
3233 $ serializerPaths = [];
33- // Drop when require Symfony > 3.4
34- $ registerAlias = method_exists ($ container , 'registerAliasForArgument ' );
3534
3635 foreach ($ configs ['html_profiles ' ] as $ name => $ definition ) {
3736 $ configId = "exercise_html_purifier.config. $ name " ;
@@ -71,7 +70,7 @@ public function load(array $configs, ContainerBuilder $container): void
7170 $ serializerPaths [] = $ definition ['config ' ]['Cache.SerializerPath ' ];
7271 }
7372
74- if ($ registerAlias && $ default ) {
73+ if ($ default ) {
7574 $ container ->registerAliasForArgument ($ id , \HTMLPurifier::class, "$ name.purifier " );
7675 }
7776 }
0 commit comments