-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Multi line use statements are fixed wrong by ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName #1581
Comments
Yes, we don't support group uses. |
@klausi said
Does the fixer still generate broken PHP? |
Yes, because we don't have support for parsing group uses. |
The fixer could be prevented from breaking the php by simply detecting if there is a group use, and then not doing any fixing, just report the error. I did this in #1555 |
Yes, it could be solved this way. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Use statements can be grouped and span multiple lines, example:
Reported error: Constant Test\MultiLineSecond should not be referenced via a fully qualified name, but via a use statement. (SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName)
That is misleading, no constant is defined here.
Furthermore the file is fixed wrong and results in broken code:
The use statement is completely deleted.
I saw that there was some discussion that Slevomat does not support multiline use statements in #1547 and #1554, but then the fixer should at least ignore those and not generate broken PHP files.
Background: trying to replace Drupal Coder's custom use statement sniff with your upstream code to avoid maintaining it in pfrenssen/coder#199
The text was updated successfully, but these errors were encountered: