Use php-based configs when xml is not available anymore#313
Use php-based configs when xml is not available anymore#313bytehead merged 6 commits into1up-lab:mainfrom
Conversation
|
I did update composer.json locally to test it with adding symfony 8 and i added Tests are green. |
bytehead
left a comment
There was a problem hiding this comment.
Looks good, just some CS nitpick
Co-authored-by: David Greminger <bytehead@users.noreply.github.com>
|
Quick question: what’s the point of keeping both XML and PHP configs? If both are supported, and there’s no BC issue with PHP config, and they’re functionally identical, why not just leave PHP config? |
|
The reason is that symfony 8 does not support xml-based configs anymore. |
However, this does not answer my question. Symfony 5.4-8.0 supports |
|
@skmedix You are right. I was not aware that PhpFileLoader is available in Symfony 5.4. (Misleaded by an other PR) I do not know how to rewrite this test, to use the PHP File instead of the .xml file. |
Try this: public function testAdapterAvailability(): void
{
$container = new ContainerBuilder();
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../src/Resources/config'));
$loader->load('adapters.php');
foreach ($container->getDefinitions() as $id => $definition) {
if ('service_container' === $id) {
continue;
}
$class = $definition->getClass();
if (null !== $class) {
self::assertTrue(class_exists($class), 'Could not load class: ' . $class);
}
}
} |
(since Symfony 8)