diff --git a/DataStorage/Database/Connection/SQLiteConnection.php b/DataStorage/Database/Connection/SQLiteConnection.php index dd4df8a5d..7362d2248 100644 --- a/DataStorage/Database/Connection/SQLiteConnection.php +++ b/DataStorage/Database/Connection/SQLiteConnection.php @@ -51,7 +51,7 @@ class SqliteConnection extends ConnectionAbstract /** * {@inheritdoc} */ - public function connect(array $dbdata = null) + public function connect(array $dbdata = null) : void { $this->close(); diff --git a/DataStorage/Session/ConsoleSession.php b/DataStorage/Session/ConsoleSession.php index a37e4225d..f26474b8b 100644 --- a/DataStorage/Session/ConsoleSession.php +++ b/DataStorage/Session/ConsoleSession.php @@ -28,7 +28,7 @@ class ConsoleSession implements SessionInterface /** * Session ID. * - * @var string|int + * @var string|int|null * @since 1.0.0 */ private $sid = null; @@ -36,13 +36,13 @@ class ConsoleSession implements SessionInterface /** * Constructor. * - * @param string|int|bool $sid Session id + * @param string|int|null $sid Session id * * @since 1.0.0 */ - public function __construct($sid = false) + public function __construct($sid = null) { - if ($sid !== false) { + if ($sid !== null) { $this->sid = $sid; } } @@ -89,14 +89,14 @@ class ConsoleSession implements SessionInterface /** * {@inheritdoc} */ - public function save() + public function save() : void { } /** * {@inheritdoc} */ - public function lock() + public function lock() : void { } } diff --git a/DataStorage/Session/SocketSession.php b/DataStorage/Session/SocketSession.php index b24b816a3..966e48677 100644 --- a/DataStorage/Session/SocketSession.php +++ b/DataStorage/Session/SocketSession.php @@ -36,13 +36,13 @@ class SocketSession implements SessionInterface /** * Constructor. * - * @param string|int|bool $sid Session id + * @param string|int|null $sid Session id * * @since 1.0.0 */ - public function __construct($sid = false) + public function __construct($sid = null) { - if ($sid !== false) { + if ($sid !== null) { $this->sid = $sid; } } @@ -96,7 +96,7 @@ class SocketSession implements SessionInterface /** * {@inheritdoc} */ - public function lock() + public function lock() : void { } } diff --git a/Socket/Client/Client.php b/Socket/Client/Client.php index bcce8afd6..5a9246307 100644 --- a/Socket/Client/Client.php +++ b/Socket/Client/Client.php @@ -59,7 +59,7 @@ class Client extends SocketAbstract /** * {@inheritdoc} */ - public function create(string $ip, int $port) + public function create(string $ip, int $port) : void { parent::create($ip, $port); } @@ -67,7 +67,7 @@ class Client extends SocketAbstract /** * {@inheritdoc} */ - public function run() + public function run() : void { socket_connect($this->sock, $this->ip, $this->port); $i = 0; @@ -113,7 +113,7 @@ class Client extends SocketAbstract /** * {@inheritdoc} */ - public function close() + public function close() : void { parent::close(); } diff --git a/Socket/Server/Server.php b/Socket/Server/Server.php index 64e5c5cb6..84eca9a2d 100644 --- a/Socket/Server/Server.php +++ b/Socket/Server/Server.php @@ -103,7 +103,7 @@ class Server extends SocketAbstract /** * {@inheritdoc} */ - public function create(string $ip, int $port) + public function create(string $ip, int $port) : void { $this->app->logger->info('Creating socket...'); parent::create($ip, $port); @@ -125,7 +125,7 @@ class Server extends SocketAbstract $this->limit = $limit; } - public function handshake($client, $headers) + public function handshake($client, $headers) : bool { // todo: different handshake for normal tcp connection return true; @@ -173,7 +173,7 @@ class Server extends SocketAbstract /** * {@inheritdoc} */ - public function run() + public function run() : void { $this->app->logger->info('Start listening...'); socket_listen($this->sock); @@ -220,7 +220,7 @@ class Server extends SocketAbstract $this->close(); } - public function connectClient($socket) + public function connectClient($socket) : void { $this->app->logger->debug('Connecting client...'); $this->clientManager->add($client = new ClientConnection(uniqid(), $socket)); @@ -228,7 +228,7 @@ class Server extends SocketAbstract $this->app->logger->debug('Connected client.'); } - public function disconnectClient($client) + public function disconnectClient($client) : void { $this->app->logger->debug('Disconnecting client...'); $client->setConnected(false); @@ -247,7 +247,7 @@ class Server extends SocketAbstract /** * {@inheritdoc} */ - public function close() + public function close() : void { parent::close(); } @@ -260,7 +260,7 @@ class Server extends SocketAbstract parent::__destruct(); } - private function unmask($payload) + private function unmask($payload) : string { $length = ord($payload[1]) & 127; if ($length == 126) { diff --git a/Socket/SocketAbstract.php b/Socket/SocketAbstract.php index d5d5e040f..94ec44c3d 100644 --- a/Socket/SocketAbstract.php +++ b/Socket/SocketAbstract.php @@ -60,7 +60,7 @@ abstract class SocketAbstract implements SocketInterface /** * {@inheritdoc} */ - public function create(string $ip, int $port) + public function create(string $ip, int $port) : void { $this->ip = $ip; $this->port = $port; @@ -82,7 +82,7 @@ abstract class SocketAbstract implements SocketInterface /** * {@inheritdoc} */ - public function close() + public function close() : void { if ($this->sock !== null) { socket_shutdown($this->sock, 2); diff --git a/Socket/SocketInterface.php b/Socket/SocketInterface.php index ef095cad0..e1e759d06 100644 --- a/Socket/SocketInterface.php +++ b/Socket/SocketInterface.php @@ -30,10 +30,12 @@ interface SocketInterface * * @param string $ip IP address * @param int $port Port + * + * @return void * * @since 1.0.0 */ - public function create(string $ip, int $port); + public function create(string $ip, int $port) : void; /** * Close socket.