Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Reason phrase must be a string #320

Merged
merged 2 commits into from
Jul 24, 2018

Conversation

snapshotpl
Copy link
Contributor

No description provided.

src/Response.php Outdated

if (! is_string($reasonPhrase)) {
throw new InvalidArgumentException(sprintf(
'Unsupported HTTP method; must be a string, received %s',
Copy link
Member

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))
Copy link
Member

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.

@@ -112,6 +112,13 @@ public function testCanSetCustomReasonPhrase()
$this->assertSame('Foo Bar!', $response->getReasonPhrase());
}

public function testCannotCreateReasonPhraseNotString()
Copy link
Member

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.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@weierophinney weierophinney merged commit 2cf1797 into zendframework:master Jul 24, 2018
weierophinney added a commit that referenced this pull request Jul 24, 2018
weierophinney added a commit that referenced this pull request Jul 24, 2018
weierophinney added a commit that referenced this pull request Jul 24, 2018
@weierophinney
Copy link
Member

Thanks, @snapshotpl!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants