mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 17:16:18 +02:00
More type hints on some handler classes
This commit is contained in:
@@ -15,13 +15,14 @@ class UdpSocket
|
||||
{
|
||||
const DATAGRAM_MAX_LENGTH = 65023;
|
||||
|
||||
/** @var string */
|
||||
protected $ip;
|
||||
/** @var int */
|
||||
protected $port;
|
||||
|
||||
/** @var resource|null */
|
||||
protected $socket;
|
||||
|
||||
public function __construct($ip, $port = 514)
|
||||
public function __construct(string $ip, int $port = 514)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
$this->port = $port;
|
||||
@@ -41,7 +42,7 @@ class UdpSocket
|
||||
}
|
||||
}
|
||||
|
||||
protected function send($chunk)
|
||||
protected function send(string $chunk): void
|
||||
{
|
||||
if (!is_resource($this->socket)) {
|
||||
throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore');
|
||||
@@ -49,7 +50,7 @@ class UdpSocket
|
||||
socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port);
|
||||
}
|
||||
|
||||
protected function assembleMessage($line, $header)
|
||||
protected function assembleMessage(string $line, string $header): string
|
||||
{
|
||||
$chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header);
|
||||
|
||||
|
Reference in New Issue
Block a user