-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] More accurate message on invalid config builder #40994
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
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. Well done with the tests!
} | ||
|
||
// Try to get the extension alias | ||
$alias = Container::underscore(substr($namespace, 15, -6)); | ||
|
||
if (false !== strpos($alias, '\\')) { | ||
throw new InvalidArgumentException(sprintf('Nested bundle config class "%s" could not be handled.', $namespace)); |
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.
Technically, we are not talking about "bundles" but "extensions".
Could we be more descriptive here?
Something more similar to this?
Could not find or generate class "%s". Make sure to use the "root" ConfigBuilder class. Ie use "Symfony\Config\FrameworkConfig" and not Symfony\Config\Framework\CacheConfig"
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.
I have tried to make message more descriptive, but without concrete classes.
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.
Oh. I missed this comment.
I do agree that not using Symfony\Config\Framework\CacheConfig
may be better, but it is also very hard to understand what "nested classes" really mean. Im not sure that my suggestion is the best.
src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
Outdated
Show resolved
Hide resolved
1c3b4d7
to
5ece904
Compare
src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php
Outdated
Show resolved
Hide resolved
Throw exception when try to autowire nested bundle config instead of ConfigBuilder. Also renamed test class AcmeConfigBuilder to AcmeConfig according config builders auto naming.
5ece904
to
0501ecc
Compare
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
Im happy with this PR. I just had one small question left.
src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/nested_bundle_config.php
Show resolved
Hide resolved
Thank you @a-menshchikov. |
Throw exception when trying to autowire nested bundle config instead of ConfigBuilder (related Doc PR symfony/symfony-docs#15300).
Also renamed test class AcmeConfigBuilder to AcmeConfig according config builders auto naming.
Inspired by a chat with @Nyholm