Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Improve an exception message#33092
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This PR was merged into the 4.3 branch.Discussion----------[DependencyInjection] Improve an exception message| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | n/a| License | MIT| Doc PR | n/aWhen defining a service with an id that is also a class name, you might have an error message like `Class “” used for service “\App\Some\Service” cannot be found.` if your is starts with a backslash.The new error message is now hopefully less cryptic: `Service definition "\App\Some\Service" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.`Commits-------3647cca [DependencyInjection] improved exception message
ro0NL commentedAug 10, 2019
i was curious about doing it in class Kernelextends BaseKernelimplements CompilerPassInterface{publicfunctionprocess(ContainerBuilder$c) {dd($c->getDefinition('\\Foo\\Bar')); } this now breaks :) so perhaps target 4.4? Alternatively cant we fix it in 3.4 at a later stage (i.e. during optimization instead of before)? Maybe this is too much an edge case, but then 3.4 was fine also 😅 (though 4.3 is fairly new). Just wanted to share this :) |
…ption message" (nicolas-grekas)This PR was merged into the 4.3 branch.Discussion----------Revert "bug#33092 [DependencyInjection] Improve an exception message"| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -As reminded by@ro0NL in#33092 (comment), it looks like we forgot that `CheckDefinitionValidityPass` already checks and suggests for leading slashes.Why didn't you get the exception from `CheckDefinitionValidityPass`@fabpot?Commits-------ed590ca Revert "bug#33092 [DependencyInjection] Improve an exception message (fabpot)"
…ption message" (nicolas-grekas)This PR was merged into the 4.3 branch.Discussion----------Revert "bug #33092 [DependencyInjection] Improve an exception message"| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -As reminded by@ro0NL insymfony/symfony#33092 (comment), it looks like we forgot that `CheckDefinitionValidityPass` already checks and suggests for leading slashes.Why didn't you get the exception from `CheckDefinitionValidityPass`@fabpot?Commits-------ed590ca16b Revert "bug #33092 [DependencyInjection] Improve an exception message (fabpot)"
* 4.3: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash Revert "bug#33092 [DependencyInjection] Improve an exception message (fabpot)"
* 4.4: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null cs fix cs fix Fix missing exporter in PHPUnit constraint poylfill added `Process::getLastOutputTime()` method [Router] Fix TraceableUrlMatcher behaviour with trailing slash [HttpKernel] Remove outdated docblock comment Fix handling for session parameters Revert "bug#33092 [DependencyInjection] Improve an exception message (fabpot)"
* 4.3: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash Revert "bugsymfony#33092 [DependencyInjection] Improve an exception message (fabpot)"
* 4.4: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null cs fix cs fix Fix missing exporter in PHPUnit constraint poylfill added `Process::getLastOutputTime()` method [Router] Fix TraceableUrlMatcher behaviour with trailing slash [HttpKernel] Remove outdated docblock comment Fix handling for session parameters Revert "bugsymfony#33092 [DependencyInjection] Improve an exception message (fabpot)"
When defining a service with an id that is also a class name, you might have an error message like
Class “” used for service “\App\Some\Service” cannot be found.if your is starts with a backslash.The new error message is now hopefully less cryptic:
Service definition "\App\Some\Service" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.