Skip to content

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

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

Open
ihor-sviziev opened this issue Dec 26, 2019 · 7 comments
Open

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

ihor-sviziev opened this issue Dec 26, 2019 · 7 comments
Assignees
Labels
accepted New rule is accepted Progress: dev in progress Progress: good first issue Issues is easy to get started with

Comments

@ihor-sviziev
Copy link
Collaborator

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 magento/magento2#26129 (comment)

@konarshankar07
Copy link
Contributor

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

@konarshankar07
Copy link
Contributor

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

@ihor-sviziev
Copy link
Collaborator Author

@lenaorobei could you defined which severity should be set for this rule? As for me - should be 6, similar to

<rule ref="PSR2.Methods.FunctionClosingBrace">
<severity>6</severity>
<type>warning</type>
</rule>

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

@lenaorobei
Copy link
Contributor

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.

@ihor-sviziev
Copy link
Collaborator Author

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

@konarshankar07
Copy link
Contributor

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

@hostep
Copy link
Contributor

hostep commented Jan 18, 2021

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 ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted New rule is accepted Progress: dev in progress Progress: good first issue Issues is easy to get started with
Projects
None yet
Development

No branches or pull requests

4 participants