silverstripe-framework: RFC Declare @throws in phpdoc

This suggestion discusses the adding of standard @throws phpdoc to any method that is known to throw exceptions (or calls methods that throw these exceptions).

Pros:

  • better visibility to users of what exceptions code can throw.
  • Ability to track semver violations where exception types change

Cons:

  • If we adopt this, we’ll need to essentially add these everywhere we throw exceptions in a big PR.
  • We’ll need to maintain this going forward also

I suggest that we vote to either go all in on this, or agree to avoid adding this to core.

cc @silverstripe/core-team for discussion.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 7
  • Comments: 18 (17 by maintainers)

Most upvoted comments

If we adopt this, we’ll need to essentially add these everywhere we throw exceptions in a big PR.

I’m not sure the fact we’d need a PR is a “con”…