File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,12 @@ public function setCallback($callback)
8383 public function sendHeaders ()
8484 {
8585 if ($ this ->headersSent ) {
86- return ;
86+ return $ this ;
8787 }
8888
8989 $ this ->headersSent = true ;
9090
91- parent ::sendHeaders ();
91+ return parent ::sendHeaders ();
9292 }
9393
9494 /**
@@ -99,7 +99,7 @@ public function sendHeaders()
9999 public function sendContent ()
100100 {
101101 if ($ this ->streamed ) {
102- return ;
102+ return $ this ;
103103 }
104104
105105 $ this ->streamed = true ;
@@ -109,6 +109,8 @@ public function sendContent()
109109 }
110110
111111 call_user_func ($ this ->callback );
112+
113+ return $ this ;
112114 }
113115
114116 /**
Original file line number Diff line number Diff line change @@ -121,4 +121,15 @@ public function testCreate()
121121 $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response );
122122 $ this ->assertEquals (204 , $ response ->getStatusCode ());
123123 }
124+
125+ public function testReturnThis ()
126+ {
127+ $ response = new StreamedResponse (function () {});
128+ $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response ->sendContent ());
129+ $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response ->sendContent ());
130+
131+ $ response = new StreamedResponse (function () {});
132+ $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response ->sendHeaders ());
133+ $ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response ->sendHeaders ());
134+ }
124135}
You can’t perform that action at this time.
0 commit comments