-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nicolas-grekas
approved these changes
Aug 9, 2019
Simperfit
approved these changes
Aug 9, 2019
fabpot
added a commit
that referenced
this pull request
Aug 9, 2019
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 <!-- see https://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/a 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.` Commits ------- 3647cca [DependencyInjection] improved exception message
i was curious about doing it in class Kernel extends BaseKernel implements CompilerPassInterface
{
public function process(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 :) |
nicolas-grekas
added a commit
to nicolas-grekas/symfony
that referenced
this pull request
Aug 10, 2019
nicolas-grekas
added a commit
to nicolas-grekas/symfony
that referenced
this pull request
Aug 10, 2019
nicolas-grekas
added a commit
that referenced
this pull request
Aug 20, 2019
…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)"
symfony-splitter
pushed a commit
to symfony/dependency-injection
that referenced
this pull request
Aug 20, 2019
…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 symfony/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)"
nicolas-grekas
added a commit
that referenced
this pull request
Aug 20, 2019
* 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)"
nicolas-grekas
added a commit
that referenced
this pull request
Aug 20, 2019
* 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)"
Merged
hultberg
pushed a commit
to hultberg/symfony
that referenced
this pull request
Sep 17, 2021
* 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 symfony#33092 [DependencyInjection] Improve an exception message (fabpot)"
hultberg
pushed a commit
to hultberg/symfony
that referenced
this pull request
Sep 17, 2021
* 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 symfony#33092 [DependencyInjection] Improve an exception message (fabpot)"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.