Skip to content

Commit

Permalink
[HttpFoundation] Tweak previous merged PR
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 17, 2024
1 parent e491616 commit 5481891
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
Expand Up @@ -25,8 +25,11 @@ final class ResponseFormatSame extends Constraint
private Request $request;
private ?string $format;

public function __construct(Request $request, ?string $format)
{
public function __construct(
Request $request,
?string $format,
private readonly bool $verbose = true,
) {
$this->request = $request;
$this->format = $format;
}
Expand Down Expand Up @@ -57,6 +60,6 @@ protected function failureDescription($response): string
*/
protected function additionalFailureDescription($response): string
{
return (string) $response;
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}
Expand Up @@ -44,12 +44,11 @@ protected function failureDescription($response): string
return 'the Response '.$this->toString();
}

protected function additionalFailureDescription($other): string
/**
* @param Response $response
*/
protected function additionalFailureDescription($response): string
{
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return explode("\r\n\r\n", (string) $other)[0];
}
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}
Expand Up @@ -44,12 +44,11 @@ protected function failureDescription($response): string
return 'the Response '.$this->toString();
}

protected function additionalFailureDescription($other): string
/**
* @param Response $response
*/
protected function additionalFailureDescription($response): string
{
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return explode("\r\n\r\n", (string) $other)[0];
}
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}
Expand Up @@ -44,12 +44,11 @@ protected function failureDescription($other): string
return 'the Response '.$this->toString();
}

protected function additionalFailureDescription($other): string
/**
* @param Response $response
*/
protected function additionalFailureDescription($response): string
{
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return explode("\r\n\r\n", (string) $other)[0];
}
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}
Expand Up @@ -44,12 +44,11 @@ protected function failureDescription($response): string
return 'the Response '.$this->toString();
}

protected function additionalFailureDescription($other): string
/**
* @param Response $response
*/
protected function additionalFailureDescription($response): string
{
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return explode("\r\n\r\n", (string) $other)[0];
}
return $this->verbose ? (string) $response : explode("\r\n\r\n", (string) $response)[0];
}
}

0 comments on commit 5481891

Please sign in to comment.