Skip to content

Commit 2080582

Browse files
abellionfabpot
authored andcommitted
[HttpFoundation] Return instance in StreamedResponse
1 parent ee545bf commit 2080582

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Symfony/Component/HttpFoundation/StreamedResponse.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,22 @@ public static function create($callback = null, $status = 200, $headers = array(
6666
* Sets the PHP callback associated with this Response.
6767
*
6868
* @param callable $callback A valid PHP callback
69+
*
70+
* @return $this
6971
*/
7072
public function setCallback(callable $callback)
7173
{
7274
$this->callback = $callback;
75+
76+
return $this;
7377
}
7478

7579
/**
7680
* {@inheritdoc}
7781
*
7882
* This method only sends the headers once.
83+
*
84+
* @return $this
7985
*/
8086
public function sendHeaders()
8187
{
@@ -85,13 +91,15 @@ public function sendHeaders()
8591

8692
$this->headersSent = true;
8793

88-
parent::sendHeaders();
94+
return parent::sendHeaders();
8995
}
9096

9197
/**
9298
* {@inheritdoc}
9399
*
94100
* This method only sends the content once.
101+
*
102+
* @return $this
95103
*/
96104
public function sendContent()
97105
{
@@ -106,18 +114,24 @@ public function sendContent()
106114
}
107115

108116
call_user_func($this->callback);
117+
118+
return $this;
109119
}
110120

111121
/**
112122
* {@inheritdoc}
113123
*
114124
* @throws \LogicException when the content is not null
125+
*
126+
* @return $this
115127
*/
116128
public function setContent($content)
117129
{
118130
if (null !== $content) {
119131
throw new \LogicException('The content cannot be set on a StreamedResponse instance.');
120132
}
133+
134+
return $this;
121135
}
122136

123137
/**

0 commit comments

Comments
 (0)