magento-coding-standard icon indicating copy to clipboard operation
magento-coding-standard copied to clipboard

Do not allow slash the beginning of the class pass in use

Open ihor-sviziev opened this issue 5 years ago • 7 comments

use section does not actually need \ at the beginning of the classpath (leading backslash). Let’s enforce it by static tests to prevent appearing such cases in future

Originally posted by @ihor-sviziev in https://github.com/magento/magento2/pull/26129#issuecomment-567404199

ihor-sviziev avatar Dec 26 '19 06:12 ihor-sviziev

Hello @ihor-sviziev , What should be the severity and type of this rule?

konarshankar07 avatar Feb 04 '20 06:02 konarshankar07

After further investigation, I found that this rule is a part of PSR-12. Please check PSR12.Files.ImportStatement. Let me know your thoughts Thanks

konarshankar07 avatar Feb 04 '20 07:02 konarshankar07

@lenaorobei could you defined which severity should be set for this rule? As for me - should be 6, similar to https://github.com/magento/magento-coding-standard/blob/199057a8ca960e0bb191ec8fd7a409fbd91c8a51/Magento2/ruleset.xml#L457-L460

@konarshankar07 I think it's good idea to re-use rules from PSR12

ihor-sviziev avatar Feb 04 '20 08:02 ihor-sviziev

Agree with @ihor-sviziev, severity 6 is that we use for code style.

And yes, it would be nice to reuse PSR12.

Adding @coderimus since he is working on PSR12 update.

lenaorobei avatar Feb 04 '20 15:02 lenaorobei

@konarshankar07 do you have any updates? Do you have some working version?

ihor-sviziev avatar Sep 25 '20 21:09 ihor-sviziev

Hello @ihor-sviziev ... I'm waiting for the PSR12 update cause there is already a rule for this in PSR-12. I'm not sure if we have updated the PSR12 or not Thanks

konarshankar07 avatar Sep 26 '20 06:09 konarshankar07

Not sure if this is helpful but PSR-12 support just made it in v2.18.0 of friendsofphp/php-cs-fixer (also not sure if this comment makes sense in this repo since the magento2 repo makes use of it but the coding-standard not, which is odd ...)

hostep avatar Jan 18 '21 10:01 hostep