File tree 2 files changed +16
-3
lines changed
src/Symfony/Component/HttpFoundation
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)
83
83
public function sendHeaders ()
84
84
{
85
85
if ($ this ->headersSent ) {
86
- return ;
86
+ return $ this ;
87
87
}
88
88
89
89
$ this ->headersSent = true ;
90
90
91
- parent ::sendHeaders ();
91
+ return parent ::sendHeaders ();
92
92
}
93
93
94
94
/**
@@ -99,7 +99,7 @@ public function sendHeaders()
99
99
public function sendContent ()
100
100
{
101
101
if ($ this ->streamed ) {
102
- return ;
102
+ return $ this ;
103
103
}
104
104
105
105
$ this ->streamed = true ;
@@ -109,6 +109,8 @@ public function sendContent()
109
109
}
110
110
111
111
call_user_func ($ this ->callback );
112
+
113
+ return $ this ;
112
114
}
113
115
114
116
/**
Original file line number Diff line number Diff line change @@ -121,4 +121,15 @@ public function testCreate()
121
121
$ this ->assertInstanceOf ('Symfony\Component\HttpFoundation\StreamedResponse ' , $ response );
122
122
$ this ->assertEquals (204 , $ response ->getStatusCode ());
123
123
}
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
+ }
124
135
}
You can’t perform that action at this time.
0 commit comments