eee
This commit is contained in:
@@ -50,7 +50,7 @@ class Kiri
|
|||||||
* @param string|array $className
|
* @param string|array $className
|
||||||
* @param array $construct
|
* @param array $construct
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function createObject(string|array $className, array $construct = []): mixed
|
public static function createObject(string|array $className, array $construct = []): mixed
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ class Kiri
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Kiri\Pool\Pool
|
* @return \Kiri\Pool\Pool
|
||||||
* @throws ReflectionException|Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function getPool(): \Kiri\Pool\Pool
|
public static function getPool(): \Kiri\Pool\Pool
|
||||||
{
|
{
|
||||||
@@ -99,7 +99,7 @@ class Kiri
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function getStoragePath(): string
|
public static function getStoragePath(): string
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ class Kiri
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return StdoutLogger
|
* @return StdoutLogger
|
||||||
* @throws ReflectionException|Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function getLogger(): StdoutLogger
|
public static function getLogger(): StdoutLogger
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!class_exists('\ReturnTypeWillChange')) {
|
|
||||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
|
||||||
final class ReturnTypeWillChange
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+1
-2
@@ -9,7 +9,7 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0",
|
"php": ">=8.3",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-fileinfo": "*",
|
"ext-fileinfo": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"Kiri.php",
|
"Kiri.php",
|
||||||
"ReturnTypeWillChange.php",
|
|
||||||
"function.php"
|
"function.php"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ abstract class BaseApplication extends LocalService
|
|||||||
* @param EventProvider $provider
|
* @param EventProvider $provider
|
||||||
* @param ConfigProvider $config
|
* @param ConfigProvider $config
|
||||||
* @param ContainerInterface $container
|
* @param ContainerInterface $container
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws InitException
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function __construct(public EventProvider $provider, public ConfigProvider $config, public ContainerInterface $container)
|
public function __construct(public EventProvider $provider, public ConfigProvider $config, public ContainerInterface $container)
|
||||||
{
|
{
|
||||||
@@ -71,7 +69,7 @@ abstract class BaseApplication extends LocalService
|
|||||||
/**
|
/**
|
||||||
* @param ConfigProvider $config
|
* @param ConfigProvider $config
|
||||||
* @return void
|
* @return void
|
||||||
* @throws InitException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function parseStorage(ConfigProvider $config): void
|
public function parseStorage(ConfigProvider $config): void
|
||||||
{
|
{
|
||||||
@@ -91,9 +89,7 @@ abstract class BaseApplication extends LocalService
|
|||||||
/**
|
/**
|
||||||
* @param ConfigProvider $config
|
* @param ConfigProvider $config
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function parseEvents(ConfigProvider $config): void
|
public function parseEvents(ConfigProvider $config): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class Component implements Configure
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return StdoutLogger
|
* @return StdoutLogger
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getLogger(): StdoutLogger
|
public function getLogger(): StdoutLogger
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ class Component implements Configure
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __get(string $name)
|
public function __get(string $name)
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ class Component implements Configure
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param $value
|
* @param $value
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __set(string $name, $value): void
|
public function __set(string $name, $value): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class LocalService extends Component implements LocalServiceInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function get(string $name): mixed
|
public function get(string $name): mixed
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ class LocalService extends Component implements LocalServiceInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __get(string $name)
|
public function __get(string $name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class Application extends BaseApplication
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void
|
||||||
{
|
{
|
||||||
@@ -71,9 +71,7 @@ class Application extends BaseApplication
|
|||||||
/**
|
/**
|
||||||
* @param OnBeforeCommandExecute $beforeCommandExecute
|
* @param OnBeforeCommandExecute $beforeCommandExecute
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function beforeCommandExecute(OnBeforeCommandExecute $beforeCommandExecute): void
|
public function beforeCommandExecute(OnBeforeCommandExecute $beforeCommandExecute): void
|
||||||
{
|
{
|
||||||
@@ -90,8 +88,7 @@ class Application extends BaseApplication
|
|||||||
/**
|
/**
|
||||||
* @param string ...$services
|
* @param string ...$services
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function import(string ...$services): static
|
public function import(string ...$services): static
|
||||||
{
|
{
|
||||||
@@ -112,8 +109,7 @@ class Application extends BaseApplication
|
|||||||
/**
|
/**
|
||||||
* @param Kernel $kernel
|
* @param Kernel $kernel
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function commands(Kernel $kernel): static
|
public function commands(Kernel $kernel): static
|
||||||
{
|
{
|
||||||
@@ -127,8 +123,7 @@ class Application extends BaseApplication
|
|||||||
/**
|
/**
|
||||||
* @param string ...$command
|
* @param string ...$command
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function command(string ...$command): void
|
public function command(string ...$command): void
|
||||||
{
|
{
|
||||||
@@ -142,10 +137,7 @@ class Application extends BaseApplication
|
|||||||
/**
|
/**
|
||||||
* @param array $argv
|
* @param array $argv
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
* @throws ReflectionException
|
|
||||||
* @throws Exception|ExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function execute(array $argv): void
|
public function execute(array $argv): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Kiri;
|
|||||||
class Coordinator
|
class Coordinator
|
||||||
{
|
{
|
||||||
|
|
||||||
const WORKER_START = 'worker:start';
|
const string WORKER_START = 'worker:start';
|
||||||
|
|
||||||
private bool $waite = false;
|
private bool $waite = false;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Core;
|
namespace Kiri\Core;
|
||||||
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ArrayAccess
|
* Class ArrayAccess
|
||||||
* @package Kiri\Core
|
* @package Kiri\Core
|
||||||
@@ -22,7 +20,7 @@ class ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function toArray($data): array
|
public static function toArray($data): array
|
||||||
{
|
{
|
||||||
@@ -50,7 +48,7 @@ class ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function objToArray($data): array
|
public static function objToArray($data): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class HashMap implements \ArrayAccess, \IteratorAggregate
|
|||||||
* @param string $key
|
* @param string $key
|
||||||
* @param $value
|
* @param $value
|
||||||
*/
|
*/
|
||||||
public function put(string $key, $value)
|
public function put(string $key, $value): void
|
||||||
{
|
{
|
||||||
$this->lists[$key] = $value;
|
$this->lists[$key] = $value;
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ class HashMap implements \ArrayAccess, \IteratorAggregate
|
|||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*/
|
*/
|
||||||
public function del(string $key)
|
public function del(string $key): void
|
||||||
{
|
{
|
||||||
if (!$this->has($key)) {
|
if (!$this->has($key)) {
|
||||||
return;
|
return;
|
||||||
@@ -122,7 +122,7 @@ class HashMap implements \ArrayAccess, \IteratorAggregate
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
#[ReturnTypeWillChange]
|
#[ReturnTypeWillChange]
|
||||||
public function offsetSet(mixed $offset, mixed $value)
|
public function offsetSet(mixed $offset, mixed $value): void
|
||||||
{
|
{
|
||||||
$this->put($offset, $value);
|
$this->put($offset, $value);
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ class HashMap implements \ArrayAccess, \IteratorAggregate
|
|||||||
* @param mixed $offset
|
* @param mixed $offset
|
||||||
*/
|
*/
|
||||||
#[ReturnTypeWillChange]
|
#[ReturnTypeWillChange]
|
||||||
public function offsetUnset(mixed $offset)
|
public function offsetUnset(mixed $offset): void
|
||||||
{
|
{
|
||||||
unset($this->lists[$offset]);
|
unset($this->lists[$offset]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class Help
|
|||||||
/**
|
/**
|
||||||
* @param $xml
|
* @param $xml
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function toArray($xml): mixed
|
public static function toArray($xml): mixed
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ class Help
|
|||||||
/**
|
/**
|
||||||
* @param $parameter
|
* @param $parameter
|
||||||
* @return array|false|string
|
* @return array|false|string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function toString($parameter): bool|array|string
|
public static function toString($parameter): bool|array|string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class Json
|
|||||||
* @param $state
|
* @param $state
|
||||||
* @param $body
|
* @param $body
|
||||||
* @return false|int|string
|
* @return false|int|string
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function output($state, $body): bool|int|string
|
public static function output($state, $body): bool|int|string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ use Exception;
|
|||||||
class Str
|
class Str
|
||||||
{
|
{
|
||||||
|
|
||||||
const STRING = 'abcdefghijklmnopqrstuvwxyz';
|
const string STRING = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
const NUMBER = '01234567890';
|
const string NUMBER = '01234567890';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $length
|
* @param int $length
|
||||||
@@ -107,7 +107,7 @@ class Str
|
|||||||
*/
|
*/
|
||||||
public static function isSerialize($data, $callBack = NULL): bool
|
public static function isSerialize($data, $callBack = NULL): bool
|
||||||
{
|
{
|
||||||
$false = !empty($data) && swoole_unserialize($data) !== FALSE;
|
$false = !empty($data) && unserialize($data) !== FALSE;
|
||||||
if ($false && is_callable($callBack, TRUE)) {
|
if ($false && is_callable($callBack, TRUE)) {
|
||||||
return call_user_func($callBack, $data);
|
return call_user_func($callBack, $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Xml
|
|||||||
* @param $data
|
* @param $data
|
||||||
* @param bool $asArray
|
* @param bool $asArray
|
||||||
* @return array|object
|
* @return array|object
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function toArray($data, bool $asArray = true): object|array
|
public static function toArray($data, bool $asArray = true): object|array
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ class Xml
|
|||||||
/**
|
/**
|
||||||
* @param $str
|
* @param $str
|
||||||
* @return array|bool|object
|
* @return array|bool|object
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public static function isXml($str): object|bool|array
|
public static function isXml($str): object|bool|array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function shutdown(): void
|
public function shutdown(): void
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
/**
|
/**
|
||||||
* @param Throwable $exception
|
* @param Throwable $exception
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function exceptionHandler(Throwable $exception): void
|
public function exceptionHandler(Throwable $exception): void
|
||||||
{
|
{
|
||||||
@@ -121,8 +121,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ErrorException
|
* @throws
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function errorHandler()
|
public function errorHandler()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class StdoutLogger extends Component
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __call(string $name, array $arguments)
|
public function __call(string $name, array $arguments)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class Redis
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ class Redis
|
|||||||
* @param $key
|
* @param $key
|
||||||
* @param int $timeout
|
* @param int $timeout
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws RedisException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function waite($key, int $timeout = 5): bool
|
public function waite($key, int $timeout = 5): bool
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,7 @@ class Redis
|
|||||||
* @param $key
|
* @param $key
|
||||||
* @param int $timeout
|
* @param int $timeout
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function lock($key, int $timeout = 5): bool|int
|
public function lock($key, int $timeout = 5): bool|int
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ SCRIPT;
|
|||||||
/**
|
/**
|
||||||
* @param $key
|
* @param $key
|
||||||
* @return int
|
* @return int
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function unlock($key): int
|
public function unlock($key): int
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ SCRIPT;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Redis
|
* @return \Redis
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function getClient(): \Redis
|
private function getClient(): \Redis
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ SCRIPT;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Pool
|
* @return Pool
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
protected function pool(): Pool
|
protected function pool(): Pool
|
||||||
{
|
{
|
||||||
@@ -189,7 +189,7 @@ SCRIPT;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Redis
|
* @return \Redis
|
||||||
* @throws RedisConnectException|RedisException
|
* @throws
|
||||||
*/
|
*/
|
||||||
protected function connect(): \Redis
|
protected function connect(): \Redis
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user