From 2080582a75769db4b9e32b241ec0da90c05af6a6 Mon Sep 17 00:00:00 2001 From: Antoine Bellion Date: Fri, 29 Sep 2017 13:45:44 +0200 Subject: [PATCH] [HttpFoundation] Return instance in StreamedResponse --- .../HttpFoundation/StreamedResponse.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 928531309a..cd86be1363 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -66,16 +66,22 @@ class StreamedResponse extends Response * Sets the PHP callback associated with this Response. * * @param callable $callback A valid PHP callback + * + * @return $this */ public function setCallback(callable $callback) { $this->callback = $callback; + + return $this; } /** * {@inheritdoc} * * This method only sends the headers once. + * + * @return $this */ public function sendHeaders() { @@ -85,13 +91,15 @@ class StreamedResponse extends Response $this->headersSent = true; - parent::sendHeaders(); + return parent::sendHeaders(); } /** * {@inheritdoc} * * This method only sends the content once. + * + * @return $this */ public function sendContent() { @@ -106,18 +114,24 @@ class StreamedResponse extends Response } call_user_func($this->callback); + + return $this; } /** * {@inheritdoc} * * @throws \LogicException when the content is not null + * + * @return $this */ public function setContent($content) { if (null !== $content) { throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); } + + return $this; } /**