Repository navigation
Consitent implementation of union type checking - #193
Merged
Merged
Conversation
GrahamCampbell
marked this pull request as draft
July 1, 2020 13:42
GrahamCampbell
commented
Jul 1, 2020
| * @var int $max_restarts | ||
| * } | ||
| * | ||
| * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
Contributor
Author
There was a problem hiding this comment.
This doc was incorrect anyway, so I think my change is fine, and can be regarded as a bug fix.
NB In general, I don't think we ever need throws docs for "Errors", only "Exceptions", so this is why I've not added any. One can think of Errors in PHP just like how Java's type system treats RuntimeExceptions.
GrahamCampbell
marked this pull request as ready for review
July 1, 2020 13:52
dbu
approved these changes
Jul 1, 2020
dbu
left a comment
Contributor
There was a problem hiding this comment.
great! yep, i agree and really hope people don't pass the wrong type of argument and then catch the LogicException...
Contributor
Author
|
🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR consistently implements union type checking. Note that in the cases where there wasn't already a type check in place, the code would have still crashed later, but it is much harder for a programmer to know what went wrong, because it wasn't thrown early enough, where they actually made the made method called, and instead was thrown from deeper in the internals.