diff --git a/src/Cron/Protocol/Frame.php b/src/Cron/Protocol/Frame.php index 9d054de..b6117d9 100644 --- a/src/Cron/Protocol/Frame.php +++ b/src/Cron/Protocol/Frame.php @@ -13,12 +13,8 @@ class Frame { /** * Check the integrity of the package. - * - * @param string $buffer - * - * @return int */ - public static function input($buffer, TcpConnection $connection) + public static function input(string $buffer, TcpConnection $connection): int { if (\strlen($buffer) < 4) { @@ -31,24 +27,16 @@ public static function input($buffer, TcpConnection $connection) /** * Decode. - * - * @param string $buffer - * - * @return string */ - public static function decode($buffer) + public static function decode(string $buffer): string { return substr($buffer, 4); } /** * Encode. - * - * @param string $buffer - * - * @return string */ - public static function encode($buffer) + public static function encode(string $buffer): string { return pack('N', \strlen($buffer)) . $buffer; } diff --git a/src/Server/Protocol/FrameWithLength.php b/src/Server/Protocol/FrameWithLength.php index 44bd4cf..907af0d 100644 --- a/src/Server/Protocol/FrameWithLength.php +++ b/src/Server/Protocol/FrameWithLength.php @@ -13,12 +13,8 @@ class FrameWithLength { /** * Check the integrity of the package. - * - * @param string $buffer - * - * @return int */ - public static function input($buffer, TcpConnection $connection) + public static function input(string $buffer, TcpConnection $connection): int { if (\strlen($buffer) < 4) { @@ -31,24 +27,16 @@ public static function input($buffer, TcpConnection $connection) /** * Decode. - * - * @param string $buffer - * - * @return string */ - public static function decode($buffer) + public static function decode(string $buffer): string { return $buffer; } /** * Encode. - * - * @param string $buffer - * - * @return string */ - public static function encode($buffer) + public static function encode(string $buffer): string { $total_length = \strlen($buffer); diff --git a/src/Server/Protocol/TextCRLF.php b/src/Server/Protocol/TextCRLF.php index 0025cc4..0ebc21f 100644 --- a/src/Server/Protocol/TextCRLF.php +++ b/src/Server/Protocol/TextCRLF.php @@ -13,12 +13,8 @@ class TextCRLF { /** * Check the integrity of the package. - * - * @param string $buffer - * - * @return int */ - public static function input($buffer, ConnectionInterface $connection) + public static function input(string $buffer, ConnectionInterface $connection): int { // Judge whether the package length exceeds the limit. if (isset($connection->maxPackageSize) && \strlen($buffer) >= $connection->maxPackageSize) @@ -40,12 +36,8 @@ public static function input($buffer, ConnectionInterface $connection) /** * Encode. - * - * @param string $buffer - * - * @return string */ - public static function encode($buffer) + public static function encode(string $buffer): string { // Add "\r\n" return $buffer . "\r\n"; @@ -53,12 +45,8 @@ public static function encode($buffer) /** * Decode. - * - * @param string $buffer - * - * @return string */ - public static function decode($buffer) + public static function decode(string $buffer): string { // Remove "\r\n" return rtrim($buffer, "\r\n");