mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Return type fixes
This commit is contained in:
parent
5f385e44c0
commit
af0a980d1b
|
|
@ -51,7 +51,7 @@ class SqliteConnection extends ConnectionAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $dbdata = null)
|
||||
public function connect(array $dbdata = null) : void
|
||||
{
|
||||
$this->close();
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user