symfony/symfony — pull request #9204 by WouterJ (2013-10-03 11:30:35+00:00)
Title: [DI] Improve error message when namespace is not found

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -

When an application has a lot of registered bundles and you misspelled the DI alias of a bundle, dumping all aliases results in a not that easy to read error message. This PR edits the error message to find related aliases and only dump those. It does it by dumping all aliases with the same vendor (this helps you when you had a typo in the bundle name) and dumping all aliases that matches the bundle name (this helps when you had a typo in the vendor name).

Examples:

Given aliases "cmf_menu", "cmf_block" and "knp_menu" are registered
When the configuration has config for "kpn_menu"
Then the fileloader should fail
And the dumped aliases are "cmf_menu" and "knp_menu"

Given aliases "cmf_menu", "cmf_block", "sonata_block" are registered
When the cofiguration has config for "cmf_blok"
Then the fileloader should fail
And the dumped aliases are "cmf_block" and "sonata_block"

Given aliases "cmf_menu", "cmf_block", "acme_demo" and "knp_menu" are registered
When the configuration has config for "cfm_blok"
Then the fileloader should fail
And the dumped aliases are "cmf_menu", "cmf_block", "acme_demo" and "knp_menu"