-
Notifications
You must be signed in to change notification settings - Fork 56
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
Exclude Squiz.Commenting.FunctionComment.ThrowsNotCapital sniff #52
Exclude Squiz.Commenting.FunctionComment.ThrowsNotCapital sniff #52
Conversation
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.
This is a 👎 for me. For me there are two distinct elements in @throws
lines: the type of the exception and the reason (and only the latter should be read as a sentence).
9bcfcbb
to
eaef248
Compare
@lcobucci can you give an example of a sentence you would put there? Because IMO |
@deeky666 You should throw more specific exception with more specific name so you don’t have to write the description at all |
@kukulich that is true but is not really the topic of this RFC. There will always be situation where you might not be able to throw a distinct exception for every type of error. Imagine file operations, where you cannot safely say what exactly went wrong when trying to write a file. You can check some preconditions beforehand but that does not prevent you from running into race conditions. This is just one example. In a perfect world I would 100% agree with you. Also we are not explicitly disallowing descriptions for |
Descriptions for thrown exceptions especially are useful in interfaces where you might not know the technical details of when to throw which exception during implementation. |
@deeky666 https://github.com/doctrine/doctrine2/blob/0b7d878cd340fed70e22404daa9656bb06cec74a/lib/Doctrine/ORM/Cache/Region.php#L35 surely we could rephrase it to have |
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.
👎 For me as well, same reason from Luis
@lcobucci I see but as a fun fact this contradicts to https://github.com/doctrine/doctrine2/blob/0b7d878cd340fed70e22404daa9656bb06cec74a/lib/Doctrine/ORM/Cache/Region.php#L24 where it is a similar situation :D |
@deeky666 we're quite far from perfection 😂 |
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.
This patch is a clear 👍 from my side for a few reasons:
|
I already voted against. |
The RFC looks like a matter of personal taste to me. Depending on whether we want to use the exception descriptions somewhere else than the source code, the way how we interpret the original annotation may be different. The |
dismissed due to 👍 votes (in order to allow merge)
Note: had to dismiss the 3 👎 reviews in order to allow merg: unsure why github started behaving like that |
It was 3 👎 + one rather -1-ish review from @morozov. I would prefer not merging such controversial RFCs. |
That's what the voting is for: if we introduce an even tougher process for this we'll just get into gridlock. You can always open a new PR to revert this one. |
I suggest allowing descriptions for
@throws
to be started with a non-capital letter as it is more natural to compose a complete sentence out of the line like:As a further improvement one might even enforce sentences like this (starting with
if
).What do you guys think?