Skip to content

Commit 7799881

Browse files
committed
minor symfony#24374 [HttpFoundation] Return instance in StreamedResponse (abellion)
This PR was squashed before being merged into the 3.4 branch (closes symfony#24374). Discussion ---------- [HttpFoundation] Return instance in StreamedResponse | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the 3.4, legacy code removals go to the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> Commits ------- 2080582 [HttpFoundation] Return instance in StreamedResponse
2 parents cd91b8f + 2080582 commit 7799881

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)