File tree Expand file tree Collapse file tree 5 files changed +16
-19
lines changed Expand file tree Collapse file tree 5 files changed +16
-19
lines changed Original file line number Diff line number Diff line change 1111 ],
1212 "require" : {
1313 "php" : " >=8.0" ,
14+ "hyperf/engine" : " ^1.9|^2.7" ,
1415 "hyperf/utils" : " ~3.0.0" ,
1516 "laminas/laminas-mime" : " ^2.7" ,
1617 "psr/http-message" : " ^1.0"
Original file line number Diff line number Diff line change 1111 */
1212namespace Hyperf \HttpMessage \Server \Chunk ;
1313
14+ use Hyperf \Engine \Contract \Http \Writable ;
15+
1416trait HasChunk
1517{
1618 public function write (string $ content ): bool
1719 {
18- if (isset ($ this ->connection ) && $ this ->connection instanceof Chunkable ) {
20+ if (isset ($ this ->connection ) && $ this ->connection instanceof Writable ) {
1921 return $ this ->connection ->write ($ content );
2022 }
2123
Original file line number Diff line number Diff line change 1111 */
1212namespace Hyperf \HttpMessage \Server \Connection ;
1313
14+ use Hyperf \Engine \Http \WritableConnection ;
1415use Hyperf \HttpMessage \Server \Chunk \Chunkable ;
1516use Hyperf \HttpMessage \Server \ConnectionInterface ;
16- use Swoole \Http \Response ;
1717
18- class SwooleConnection implements ConnectionInterface, Chunkable
18+ /**
19+ * @deprecated since 3.1.0, please use `Hyperf\Engine\Http\WritableConnection` instead.
20+ */
21+ class SwooleConnection extends WritableConnection implements ConnectionInterface, Chunkable
1922{
20- public function __construct (protected Response $ response )
21- {
22- }
23-
24- public function write (string $ data ): bool
25- {
26- return $ this ->response ->write ($ data );
27- }
28-
29- public function getSocket (): mixed
30- {
31- return $ this ->response ;
32- }
3323}
Original file line number Diff line number Diff line change 1111 */
1212namespace Hyperf \HttpMessage \Server ;
1313
14+ /**
15+ * @deprecated since 3.1.0, please use `Hyperf\Engine\Contract\Http\Writable` instead.
16+ */
1417interface ConnectionInterface
1518{
1619 /**
Original file line number Diff line number Diff line change 1111 */
1212namespace Hyperf \HttpMessage \Server ;
1313
14+ use Hyperf \Engine \Contract \Http \Writable ;
1415use Hyperf \HttpMessage \Cookie \Cookie ;
1516use Hyperf \HttpMessage \Server \Chunk \Chunkable ;
1617use Hyperf \HttpMessage \Server \Chunk \HasChunk ;
@@ -24,7 +25,7 @@ class Response extends \Hyperf\HttpMessage\Base\Response implements Chunkable
2425
2526 protected array $ trailers = [];
2627
27- protected ?ConnectionInterface $ connection = null ;
28+ protected ?Writable $ connection = null ;
2829
2930 /**
3031 * Returns an instance with body content.
@@ -81,13 +82,13 @@ public function getTrailers(): array
8182 return $ this ->trailers ;
8283 }
8384
84- public function setConnection (ConnectionInterface $ connection )
85+ public function setConnection (ConnectionInterface | Writable $ connection )
8586 {
8687 $ this ->connection = $ connection ;
8788 return $ this ;
8889 }
8990
90- public function getConnection (): ? ConnectionInterface
91+ public function getConnection (): ConnectionInterface | Writable | null
9192 {
9293 return $ this ->connection ;
9394 }
You can’t perform that action at this time.
0 commit comments