@@ -422,7 +422,7 @@ class AsyncTcpConnection extends TcpConnection
// Try to emit protocol::onConnect
if ($this->protocol && method_exists($this->protocol, 'onConnect')) {
try {
- $this->protocol->onConnect($this);
+ $this->protocol::onConnect($this);
} catch (Throwable $e) {
$this->error($e);
}
@@ -58,7 +58,7 @@ abstract class ConnectionInterface
* Application layer protocol.
* The format is like this Workerman\\Protocols\\Http.
*
- * @var ?string
+ * @var ?class-string
*/
public ?string $protocol = null;
@@ -1019,7 +1019,7 @@ class TcpConnection extends ConnectionInterface implements JsonSerializable
// Try to emit protocol::onClose
if ($this->protocol && method_exists($this->protocol, 'onClose')) {
- $this->protocol->onClose($this);
+ $this->protocol::onClose($this);