-
Notifications
You must be signed in to change notification settings - Fork 51
Add rules about exception types naming #31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ exceptions/differences/extensions (:white_check_mark: are the implemented sniffs | |
|
||
- Keep the nesting of control structures per method as small as possible | ||
- Prefer early exit over nesting conditions or using else | ||
- :white_check_mark: Abstract classes should not be prefixed with `Abstract` | ||
- :white_check_mark: Interfaces should not be suffixed with `Interface` | ||
- :white_check_mark: Concrete exception class names should not be suffixed with `Exception` | ||
- :white_check_mark: Abstract exception class names and exception interface names should be suffixed with `Exception` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As @kukulich said, this isn’t possible 😞 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not? You can assume inheritance - when ancestor has the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you're right but:
So if you're ok with this, it's possible to check "Abstract exception class names". However, I think it's really not possible to report "exception interface names should be suffixed with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove the check mark on that one then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Argh I was too slow, @Ocramius just merged :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @greg0ire fixup patch with discussion there please :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay |
||
- :white_check_mark: Align equals (`=`) signs in assignments | ||
- :white_check_mark: Add spaces around a concatenation operator `$foo = 'Hello ' . 'World!';` | ||
- :white_check_mark: Add spaces between assignment, control and return statements | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,12 @@ | |
</rule> | ||
<!-- Forbid dead code --> | ||
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/> | ||
<!-- Forbid suffix "Abstract" for abstract classes --> | ||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should lines 97 and 101 be moved to other PRs? Or should I add them to the standard? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I add all of them ‘cause of #31 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok let me document that too then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @greg0ire I guess we want just the suffix here, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aaah ok yes, I think that's it, because I saw a lot of |
||
<!-- Forbid suffix "Exception" for exception classes --> | ||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/> | ||
<!-- Forbid suffix "Interface" for interfaces --> | ||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/> | ||
<!-- Forbid useless annotations - Git and LICENCE file provide more accurate information --> | ||
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations"> | ||
<properties> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/doctrine/coding-standard/pull/31/files#r171371131