Skip to content
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

Contradicting rules for file header comment #35

Closed
arueckauer opened this issue Sep 7, 2020 · 4 comments · Fixed by #36
Closed

Contradicting rules for file header comment #35

arueckauer opened this issue Sep 7, 2020 · 4 comments · Fixed by #36
Labels
Bug Something isn't working
Milestone

Comments

@arueckauer
Copy link
Member

Bug Report

Q A
Versions 2.0.x

Summary

Rules WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment and PSR12.Files.FileHeader.IncorrectOrder contradict themselves, if the file header comment does not include both a @copyright and @license tag.

In this report the development.config.php.dist of the Mezzio Skeleton will serve as example.

Current behavior

Running phpcbf on the example file, will fix the violation of WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment and open the violation of PSR12.Files.FileHeader.IncorrectOrder at the same time.

How to reproduce

Detailed instructions are provided in arueckauer/strict-type-declaration-cs-issue. In summary run the following commands on development.config.php.dist.

  1. phpcs: Fixable violation of WebimpressCodingStandard.Files.DeclareStrictTypes.BelowComment (the other violation is irrelevant for this issue).
  2. phpcbf: Fixed: 2; Remaining: 1.
  3. phpcs: Violation of PSR12.Files.FileHeader.IncorrectOrder

Expected behavior

Here I am not sure. Probably the file header comment should be always above the strict type declaration. But it is not clear to me...

@arueckauer
Copy link
Member Author

For the sake of completeness, important input from @weierophinney in Chat:

Hm... For Laminas stuff, we do need that; it's part of our style-guide, to ensure that those elements are present in every code file. For third-party consumers of our CS, it would not be.
So, I'd argue that:

  • If the rule about the docblock spacing is COMBINED with the copyright/license requirements, those should be separate rules.
  • In non-Laminas code, users would then disable the copyright/license enforcement rule. (Which, if the answer to the first point is "no, they're separate", you could do now if you can figure out the rule name; the -vv switch will tell you that.)

Not sure, if I understand it correctly. Does this mean, for Laminas code this works as expected (no code change required/desired) and for non Laminas code an exception should be defined (e.g. add documentation on how to use)?

@geerteltink geerteltink added this to the 2.1.0 milestone Sep 7, 2020
@geerteltink geerteltink added the Bug Something isn't working label Sep 7, 2020
@geerteltink
Copy link
Member

Fixed in #36

@arueckauer
Copy link
Member Author

Thank you! 🤩

@arueckauer
Copy link
Member Author

@geerteltink This issue is present again in 2.2.0. Do not understand how, but possibly related to the drop of file header rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants