This commit is contained in:
2021-08-12 15:08:46 +08:00
parent c9d2edd7d5
commit 2ad860180e
4 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -19,13 +19,13 @@ class ResponseEmitter
/** /**
* @param \Swoole\Http\Response|\Swoole\Http2\Response|Server $response * @param \Swoole\Http\Response|\Swoole\Http2\Response $response
* @param ResponseInterface $emitter * @param ResponseInterface $emitter
* @throws NotFindClassException * @throws NotFindClassException
* @throws ReflectionException * @throws ReflectionException
* @throws Exception * @throws Exception
*/ */
public function sender(\Swoole\Http\Response|\Swoole\Http2\Response|Server $response, ResponseInterface $emitter) public function sender(\Swoole\Http\Response|\Swoole\Http2\Response $response, ResponseInterface $emitter): void
{ {
$content = $emitter->configure($response)->getContent(); $content = $emitter->configure($response)->getContent();
if ($content instanceof FileFormatter) { if ($content instanceof FileFormatter) {
+1 -1
View File
@@ -22,7 +22,7 @@ class TcpEmitter implements Emitter
* @throws \ReflectionException * @throws \ReflectionException
* @throws \Exception * @throws \Exception
*/ */
public function sender(Server $response, ResponseInterface $emitter) public function sender(mixed $response, ResponseInterface $emitter): void
{ {
$formatter = $emitter->getContent(); $formatter = $emitter->getContent();
if ($formatter instanceof FileFormatter) { if ($formatter instanceof FileFormatter) {
+1 -1
View File
@@ -21,7 +21,7 @@ class UdpEmitter implements Emitter
* @throws \ReflectionException * @throws \ReflectionException
* @throws \Exception * @throws \Exception
*/ */
public function sender(Server $response, ResponseInterface $emitter) public function sender(mixed $response, ResponseInterface $emitter): void
{ {
$clientInfo = $emitter->getClientInfo(); $clientInfo = $emitter->getClientInfo();
$response->sendto($clientInfo['host'], $clientInfo['port'], $response->sendto($clientInfo['host'], $clientInfo['port'],
+2 -3
View File
@@ -5,7 +5,6 @@ namespace Server\Constrict;
use Kiri\Exception\NotFindClassException; use Kiri\Exception\NotFindClassException;
use Server\ResponseInterface; use Server\ResponseInterface;
use Swoole\WebSocket\Server;
/** /**
* *
@@ -15,13 +14,13 @@ class WebSocketEmitter implements Emitter
/** /**
* @param Server $response * @param mixed $response
* @param ResponseInterface $emitter * @param ResponseInterface $emitter
* @throws NotFindClassException * @throws NotFindClassException
* @throws \ReflectionException * @throws \ReflectionException
* @throws \Exception * @throws \Exception
*/ */
public function sender(Server $response, ResponseInterface $emitter) public function sender(mixed $response, ResponseInterface $emitter): void
{ {
$response->push($emitter->getClientId(), $emitter->getContent()->getData()); $response->push($emitter->getClientId(), $emitter->getContent()->getData());
} }