[Config] More accurate message on invalid config builder#40994
Conversation
Nyholm
left a comment
There was a problem hiding this comment.
Thank you. Well done with the tests!
| $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.
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.
I have tried to make message more descriptive, but without concrete classes.
There was a problem hiding this comment.
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.
1c3b4d7 to
5ece904
Compare
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
Nyholm
left a comment
There was a problem hiding this comment.
Thank you
Im happy with this PR. I just had one small question left.
|
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