-
-
Notifications
You must be signed in to change notification settings - Fork 191
Description
Use statements can be grouped and span multiple lines, example:
<?php
/**
* @file
* Example.
*/
use Test\MultiLine as MultiLineAlias,
Test\MultiLineSecond;
$a = new MultiLineAlias();
$b = new MultiLineSecond();
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:
<?php
/**
* @file
* Example.
*/
$a = new MultiLineAlias();
$b = new \MultiLineSecond();
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