-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
global_namespace_import ignores imports for symbols that exist in code but ain't detected #7879
Comments
@javaDeveloperKid please provide expected output, because from the report I just can't tell what's wrong. Used Should it be modified to
Fixer exits with non-zero code only if dry-run is used and fixable violation is found. The core concept of this tool is to report only what can be fixed, it does not report any kind of "warnings". |
I think this is duplicate of #7619 |
Sort of, since it's related to different fixer 🙂. |
Updated issue with expected output. |
So it is related with #7674, FQCN fixer is quite complex as it has to parse a lot of different places, |
Bug report
Description
global_namespace_import
ignores classes (and constants?) that exist in code but ain't detected by php-cs-fixer. My case relates to PHPStan array shapes (see example below) but the problem is probably general.I assume php-cs-fixer can understand array shapes because the rule
no_unused_imports
does not remove the use statement.Expected behaviour
Either analyse PHPStan array shapes or at least report (non zero exit code?) that a use statement for global class/constant exists but it was not found (by php cs fixer) inside the code.
Runtime version
3.51.0
Used command
fix
Configuration file
Code snippet that reproduces the problem
Expected
The text was updated successfully, but these errors were encountered: