-
Notifications
You must be signed in to change notification settings - Fork 150
Conversation
src/Response.php
Outdated
|
||
if (! is_string($reasonPhrase)) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Unsupported HTTP method; must be a string, received %s', |
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.
"Unsupported HTTP method"?
I'm thinking you mean "Unsupported response reason phrase" here.
src/Response.php
Outdated
if (! is_string($reasonPhrase)) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Unsupported HTTP method; must be a string, received %s', | ||
(is_object($reasonPhrase) ? get_class($reasonPhrase) : gettype($reasonPhrase)) |
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.
You can drop the surrounding parens; they're unneeded when providing an expression as a function argument.
test/ResponseTest.php
Outdated
@@ -112,6 +112,13 @@ public function testCanSetCustomReasonPhrase() | |||
$this->assertSame('Foo Bar!', $response->getReasonPhrase()); | |||
} | |||
|
|||
public function testCannotCreateReasonPhraseNotString() |
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.
Let's rephrase this to testWithStatusRaisesAnExceptionForNonStringReasonPhrases()
. Additionally, please test it with other non-string values as well (using a data provider), to validate they all produce an exception.
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.
👍
4e5d88a
to
2cf1797
Compare
Thanks, @snapshotpl! |
No description provided.