mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 06:28:40 +00:00
Return type fixes
This commit is contained in:
parent
5f385e44c0
commit
af0a980d1b
|
|
@ -51,7 +51,7 @@ class SqliteConnection extends ConnectionAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function connect(array $dbdata = null)
|
public function connect(array $dbdata = null) : void
|
||||||
{
|
{
|
||||||
$this->close();
|
$this->close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class ConsoleSession implements SessionInterface
|
||||||
/**
|
/**
|
||||||
* Session ID.
|
* Session ID.
|
||||||
*
|
*
|
||||||
* @var string|int
|
* @var string|int|null
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private $sid = null;
|
private $sid = null;
|
||||||
|
|
@ -36,13 +36,13 @@ class ConsoleSession implements SessionInterface
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param string|int|bool $sid Session id
|
* @param string|int|null $sid Session id
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function __construct($sid = false)
|
public function __construct($sid = null)
|
||||||
{
|
{
|
||||||
if ($sid !== false) {
|
if ($sid !== null) {
|
||||||
$this->sid = $sid;
|
$this->sid = $sid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,14 +89,14 @@ class ConsoleSession implements SessionInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function save()
|
public function save() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function lock()
|
public function lock() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,13 @@ class SocketSession implements SessionInterface
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param string|int|bool $sid Session id
|
* @param string|int|null $sid Session id
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function __construct($sid = false)
|
public function __construct($sid = null)
|
||||||
{
|
{
|
||||||
if ($sid !== false) {
|
if ($sid !== null) {
|
||||||
$this->sid = $sid;
|
$this->sid = $sid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +96,7 @@ class SocketSession implements SessionInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function lock()
|
public function lock() : void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class Client extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create(string $ip, int $port)
|
public function create(string $ip, int $port) : void
|
||||||
{
|
{
|
||||||
parent::create($ip, $port);
|
parent::create($ip, $port);
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ class Client extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run() : void
|
||||||
{
|
{
|
||||||
socket_connect($this->sock, $this->ip, $this->port);
|
socket_connect($this->sock, $this->ip, $this->port);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
@ -113,7 +113,7 @@ class Client extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function close()
|
public function close() : void
|
||||||
{
|
{
|
||||||
parent::close();
|
parent::close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class Server extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create(string $ip, int $port)
|
public function create(string $ip, int $port) : void
|
||||||
{
|
{
|
||||||
$this->app->logger->info('Creating socket...');
|
$this->app->logger->info('Creating socket...');
|
||||||
parent::create($ip, $port);
|
parent::create($ip, $port);
|
||||||
|
|
@ -125,7 +125,7 @@ class Server extends SocketAbstract
|
||||||
$this->limit = $limit;
|
$this->limit = $limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handshake($client, $headers)
|
public function handshake($client, $headers) : bool
|
||||||
{
|
{
|
||||||
// todo: different handshake for normal tcp connection
|
// todo: different handshake for normal tcp connection
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -173,7 +173,7 @@ class Server extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run() : void
|
||||||
{
|
{
|
||||||
$this->app->logger->info('Start listening...');
|
$this->app->logger->info('Start listening...');
|
||||||
socket_listen($this->sock);
|
socket_listen($this->sock);
|
||||||
|
|
@ -220,7 +220,7 @@ class Server extends SocketAbstract
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function connectClient($socket)
|
public function connectClient($socket) : void
|
||||||
{
|
{
|
||||||
$this->app->logger->debug('Connecting client...');
|
$this->app->logger->debug('Connecting client...');
|
||||||
$this->clientManager->add($client = new ClientConnection(uniqid(), $socket));
|
$this->clientManager->add($client = new ClientConnection(uniqid(), $socket));
|
||||||
|
|
@ -228,7 +228,7 @@ class Server extends SocketAbstract
|
||||||
$this->app->logger->debug('Connected client.');
|
$this->app->logger->debug('Connected client.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disconnectClient($client)
|
public function disconnectClient($client) : void
|
||||||
{
|
{
|
||||||
$this->app->logger->debug('Disconnecting client...');
|
$this->app->logger->debug('Disconnecting client...');
|
||||||
$client->setConnected(false);
|
$client->setConnected(false);
|
||||||
|
|
@ -247,7 +247,7 @@ class Server extends SocketAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function close()
|
public function close() : void
|
||||||
{
|
{
|
||||||
parent::close();
|
parent::close();
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ class Server extends SocketAbstract
|
||||||
parent::__destruct();
|
parent::__destruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function unmask($payload)
|
private function unmask($payload) : string
|
||||||
{
|
{
|
||||||
$length = ord($payload[1]) & 127;
|
$length = ord($payload[1]) & 127;
|
||||||
if ($length == 126) {
|
if ($length == 126) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ abstract class SocketAbstract implements SocketInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create(string $ip, int $port)
|
public function create(string $ip, int $port) : void
|
||||||
{
|
{
|
||||||
$this->ip = $ip;
|
$this->ip = $ip;
|
||||||
$this->port = $port;
|
$this->port = $port;
|
||||||
|
|
@ -82,7 +82,7 @@ abstract class SocketAbstract implements SocketInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function close()
|
public function close() : void
|
||||||
{
|
{
|
||||||
if ($this->sock !== null) {
|
if ($this->sock !== null) {
|
||||||
socket_shutdown($this->sock, 2);
|
socket_shutdown($this->sock, 2);
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,12 @@ interface SocketInterface
|
||||||
*
|
*
|
||||||
* @param string $ip IP address
|
* @param string $ip IP address
|
||||||
* @param int $port Port
|
* @param int $port Port
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function create(string $ip, int $port);
|
public function create(string $ip, int $port) : void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close socket.
|
* Close socket.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user