-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[DX] Enhance error when a use
is missing
#28905
Comments
The question is, how do we know which class to suggest ? That's the hard part of this suggestion. We all agree that it would be a better error message, but we need to be able to know which class to suggest. |
Some ideas:
|
The DebugClassLoader cannot search for services. The autoloader does not have access to the container (and giving it such access would be a nightmare to avoid memory leaks, and also to account for the fact that the autoloader is also used during the building of the container). So in your ideas, I only see the second one as doable (but then, it is a pain to maintain, and only works for core classes) |
hmm, in the case of autowiring errors, the AutowiringPass may inspect the service to implement 1. though. |
But even if there is no service associated with a class, we could propose a use, isn't it ? |
The issue is still the same: how do you know about the class ? |
we could simply search for all class in project that have the same class name and propose each FQCN |
But you can only reliably get the names of already loaded classes. So chances are that you just cannot propose the right class name as this class wasn't autoloaded before. |
@lyrixx you always cam back to the same issue: how do you know "all classes" ? |
Let's close this because it looks like a "dead end". The idea is very nice, but the implementation seems "impossible". Thanks. |
Description
I would like to enhance DX when theses errors occur:
or
or ...
We coul instead put in bold something like:
I really think this would be really useful. So many people fall into theses issues during training and stray blocked :/
The text was updated successfully, but these errors were encountered: