-
Notifications
You must be signed in to change notification settings - Fork 118
Use php-based configs when xml is not available anymore #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some CS nitpick
Co-authored-by: David Greminger <[email protected]>
bytehead
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Chris53897!
|
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)