The formatter is introducing extra spaces when formatting classes that use namespace prefixes in attribute and trait declarations. This issue specifically arises with namespaced attributes and when multiple traits with namespace prefixes are used in a class. The formatting is correct when namespace prefixes are not used.
Steps to Reproduce
Format a PHP class using namespaced attributes and multiple traits.
Compare the output with a similar class using non-namespaced attributes and traits.
Current Behavior
With namespaced attributes, the formatter adds extra spaces, as demonstrated below:
class ExampleClass {
use Traits\ExampleTrait1 , Traits\ExampleTrait2 , Traits\ExampleTrait3;
#[ORM\Id, ORM\GeneratedValue , ORM\Column ]
private ?int $id = null;
}
However, when using non-namespaced attributes and traits, the formatter behaves as expected:
class ExampleClass {
use ExampleTrait1, ExampleTrait2, ExampleTrait3;
#[Id, GeneratedValue, Column]
private ?int $id = null;
}
Expected Behavior
The formatter should not introduce extra spaces when namespace prefixes are used. The expected, correctly formatted code should look like this:
class ExampleClass {
use Traits\ExampleTrait1, Traits\ExampleTrait2, Traits\ExampleTrait3;
#[ORM\Id, ORM\GeneratedValue, ORM\Column]
private ?int $id = null;
}
The formatter is introducing extra spaces when formatting classes that use namespace prefixes in attribute and trait declarations. This issue specifically arises with namespaced attributes and when multiple traits with namespace prefixes are used in a class. The formatting is correct when namespace prefixes are not used.
Steps to Reproduce
Current Behavior
With namespaced attributes, the formatter adds extra spaces, as demonstrated below:
However, when using non-namespaced attributes and traits, the formatter behaves as expected:
Expected Behavior
The formatter should not introduce extra spaces when namespace prefixes are used. The expected, correctly formatted code should look like this: