-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
Describe the enhancement
As of PHP8, namespaces are considered as a single token (https://wiki.php.net/rfc/namespaced_names_as_token).
Therefore it is now impossible to do:
use Name\Space
\Class;
When the namespace is too long, and exceeds the LineLength limit, PHPCS raises an error on the lign being too long.
From PHP8, the LineLength should not apply to import statements.
Code sample
# file 1
namespace A\Very\Extremely\Long\And\Ridiculous\Namespace;
class ThisIsAVeryPreciseAndSinglePurposeClassWithAVeryLongName {}
# file 2
namespace My\Other\Namespace
use A\Very\Extremely\Long\And\Ridiculous\Namespace\ThisIsAVeryPreciseAndSinglePurposeClassWithAVeryLongName;
class SimpleClass{}
To reproduce
Steps to reproduce the behavior:
Create 2 files with the above content
Run `phpcs test.php` ...
Describe the solution you'd like
I've took a stap at this previously but didn't have time to continue on it and also wanted to wait out the phpcs 4.0 release. I'm willing to do the work to fix this but would like to discuss what the most preferred way so solve this would be.
My goal to to avoid users having to add phpcs:ignore tags for long use statements and to improve the developer experience.
Additional context (optional)
- I have read the Contribution Guidelines and this is not a support question.
- I intend to create a pull request to implement this feature.
Reactions are currently unavailable