diff --git a/Database/Base/AbstractCollection.php b/Database/Base/AbstractCollection.php index 17b5b922..58660ca4 100644 --- a/Database/Base/AbstractCollection.php +++ b/Database/Base/AbstractCollection.php @@ -12,7 +12,7 @@ namespace Database\Base; use ArrayIterator; use Database\ActiveQuery; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Abstracts\Component; use Database\ActiveRecord; @@ -55,7 +55,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat /** * @return int */ - #[Pure] public function getLength(): int + public function getLength(): int { return count($this->_item); } diff --git a/Database/Collection.php b/Database/Collection.php index 2f814acc..23dc2849 100644 --- a/Database/Collection.php +++ b/Database/Collection.php @@ -11,7 +11,6 @@ namespace Database; use Database\Base\AbstractCollection; use Exception; -use JetBrains\PhpStorm\Pure; /** * Class Collection @@ -80,7 +79,7 @@ class Collection extends AbstractCollection * * @return array */ - #[Pure] public function slice($start = 0, $length = 20): array + public function slice($start = 0, $length = 20): array { if (empty($this->_item) || !is_array($this->_item)) { return []; @@ -128,7 +127,7 @@ class Collection extends AbstractCollection /** * @return ActiveRecord|array */ - #[Pure] public function current(): ActiveRecord|array + public function current(): ActiveRecord|array { return current($this->_item); } @@ -136,7 +135,7 @@ class Collection extends AbstractCollection /** * @return int */ - #[Pure] public function size(): int + public function size(): int { return (int)count($this->_item); } @@ -240,7 +239,7 @@ class Collection extends AbstractCollection /** * @return bool */ - #[Pure] public function isEmpty(): bool + public function isEmpty(): bool { return $this->size() < 1; } diff --git a/Database/Condition/ArrayCondition.php b/Database/Condition/ArrayCondition.php index 3d7245ad..035d9f1c 100644 --- a/Database/Condition/ArrayCondition.php +++ b/Database/Condition/ArrayCondition.php @@ -7,7 +7,7 @@ namespace Database\Condition; use Database\ActiveQuery; use Database\Base\ConditionClassMap; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Core\Str; use Snowflake\Snowflake; @@ -59,7 +59,7 @@ class ArrayCondition extends Condition * @param $value * @return bool */ - #[Pure] private function isMath($value): bool + private function isMath($value): bool { return isset($value[0]) && in_array($value[0], $this->math); } diff --git a/Database/Condition/Condition.php b/Database/Condition/Condition.php index e8521a74..d2a44033 100644 --- a/Database/Condition/Condition.php +++ b/Database/Condition/Condition.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Database\Condition; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\BaseObject; use Snowflake\Core\Str; @@ -127,7 +127,7 @@ abstract class Condition extends BaseObject * @param string $oprea * @return string */ - #[Pure] public function typeBuilder($column, $value = null, $oprea = '='): string + public function typeBuilder($column, $value = null, $oprea = '='): string { if (is_numeric($value)) { if ($value != (int)$value) { diff --git a/Database/Connection.php b/Database/Connection.php index 1bea5168..70ef5ee3 100644 --- a/Database/Connection.php +++ b/Database/Connection.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Database; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Abstracts\Component; use Database\Mysql\Schema; @@ -152,7 +152,7 @@ class Connection extends Component * @param $sql * @return bool */ - #[Pure] public function isWrite($sql): bool + public function isWrite($sql): bool { if (empty($sql)) return false; diff --git a/Database/Mysql/Columns.php b/Database/Mysql/Columns.php index 960fa5ea..d1387ef8 100644 --- a/Database/Mysql/Columns.php +++ b/Database/Mysql/Columns.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Database\Mysql; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Component; use Database\Connection; use Exception; @@ -163,7 +163,7 @@ class Columns extends Component * @param $format * @return bool */ - #[Pure] public function isInt($format): bool + public function isInt($format): bool { return in_array($format, ['int', 'bigint', 'tinyint', 'smallint', 'mediumint']); } @@ -172,7 +172,7 @@ class Columns extends Component * @param $format * @return bool */ - #[Pure] public function isFloat($format): bool + public function isFloat($format): bool { return in_array($format, ['float', 'double', 'decimal']); } @@ -181,7 +181,7 @@ class Columns extends Component * @param $format * @return bool */ - #[Pure] public function isJson($format): bool + public function isJson($format): bool { return in_array($format, ['json']); } @@ -190,7 +190,7 @@ class Columns extends Component * @param $format * @return bool */ - #[Pure] public function isString($format): bool + public function isString($format): bool { return in_array($format, ['varchar', 'char', 'text', 'longtext', 'tinytext', 'mediumtext']); } @@ -232,7 +232,7 @@ class Columns extends Component * * @throws Exception */ - #[Pure] public function getFirstPrimary(): array|string|null + public function getFirstPrimary(): array|string|null { if (isset($this->_auto_increment[$this->table])) { return $this->_auto_increment[$this->table]; diff --git a/Database/Orm/Change.php b/Database/Orm/Change.php index 7773e82b..f42d44ab 100644 --- a/Database/Orm/Change.php +++ b/Database/Orm/Change.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Database\Orm; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\BaseObject; use Database\ActiveQuery; use Exception; @@ -206,7 +206,7 @@ class Change extends BaseObject * @return string * 构建SQL语句 */ - #[Pure] private function inserts($table, $fields, $data): string + private function inserts($table, $fields, $data): string { $query = [ 'INSERT IGNORE INTO', '%s', '(%s)', 'VALUES %s' diff --git a/Database/Orm/Condition.php b/Database/Orm/Condition.php index 72cf0568..c3e949ff 100644 --- a/Database/Orm/Condition.php +++ b/Database/Orm/Condition.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace Database\Orm; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Core\JSON; use Snowflake\Core\Str; @@ -61,7 +61,7 @@ trait Condition * @param $join * @return string */ - #[Pure] private function builderJoin($join): string + private function builderJoin($join): string { if (!empty($join)) { return ' ' . implode(' ', $join); diff --git a/Database/Orm/Select.php b/Database/Orm/Select.php index e88a9ca9..8ff1f43d 100644 --- a/Database/Orm/Select.php +++ b/Database/Orm/Select.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Database\Orm; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\BaseObject; use Database\ActiveQuery; use Database\Sql; @@ -79,7 +79,7 @@ class Select extends BaseObject * @param bool $isCount * @return string */ - #[Pure] private function builderSelect($select = NULL, $isCount = false): string + private function builderSelect($select = NULL, $isCount = false): string { if ($isCount === true) { return 'SELECT COUNT(*)'; diff --git a/Gii/Gii.php b/Gii/Gii.php index 90a6b54d..ce882d04 100644 --- a/Gii/Gii.php +++ b/Gii/Gii.php @@ -13,7 +13,7 @@ use Database\Connection; use Database\Db; use Exception; use JetBrains\PhpStorm\ArrayShape; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Input; use Snowflake\Exception\ComponentException; use Snowflake\Exception\ConfigException; @@ -304,7 +304,7 @@ class Gii * @return string * 暂时不知道干嘛用的 */ - #[Pure] private function createSetFunc($field, $comment): string + private function createSetFunc($field, $comment): string { return ' ' . str_pad('\'' . $field . '\'', 20, ' ', STR_PAD_RIGHT) . '=> \'' . (empty($comment) ? ucfirst($field) : $comment) . '\','; diff --git a/Gii/GiiBase.php b/Gii/GiiBase.php index cd908efc..bbe53a35 100644 --- a/Gii/GiiBase.php +++ b/Gii/GiiBase.php @@ -7,7 +7,7 @@ namespace Gii; use Database\Connection; use JetBrains\PhpStorm\ArrayShape; -use JetBrains\PhpStorm\Pure; + use ReflectionClass; use Snowflake\Abstracts\Input; @@ -219,7 +219,7 @@ abstract class GiiBase * @param $val * @return string */ - #[Pure] protected function checkIsRequired($val): string + protected function checkIsRequired($val): string { return strtolower($val['Null']) == 'no' && $val['Default'] === NULL ? 'true' : 'false'; } diff --git a/HttpServer/Action.php b/HttpServer/Action.php index 14aaf259..c632063d 100644 --- a/HttpServer/Action.php +++ b/HttpServer/Action.php @@ -5,7 +5,7 @@ namespace HttpServer; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Input; use Snowflake\Exception\ComponentException; use Snowflake\Snowflake; @@ -111,7 +111,7 @@ trait Action /** * @return string */ - #[Pure] private function getWorkerPath(): string + private function getWorkerPath(): string { return "glob://" . ltrim(APP_PATH, '/') . '/storage/worker/*.sock'; } diff --git a/HttpServer/Client/Client.php b/HttpServer/Client/Client.php index c16b52d9..97fba1e3 100644 --- a/HttpServer/Client/Client.php +++ b/HttpServer/Client/Client.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace HttpServer\Client; use Exception; -use JetBrains\PhpStorm\Pure; + use Swoole\Coroutine\Http\Client as SClient; /** @@ -112,7 +112,7 @@ class Client extends ClientAbstracts /** * @return array */ - #[Pure] private function settings(): array + private function settings(): array { $sslCert = $this->getSslCertFile(); $sslKey = $this->getSslKeyFile(); diff --git a/HttpServer/Client/ClientAbstracts.php b/HttpServer/Client/ClientAbstracts.php index 44186be1..5ae3ab75 100644 --- a/HttpServer/Client/ClientAbstracts.php +++ b/HttpServer/Client/ClientAbstracts.php @@ -6,7 +6,7 @@ namespace HttpServer\Client; use Closure; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Component; use Snowflake\Core\Help; use Snowflake\Core\JSON; @@ -58,7 +58,7 @@ abstract class ClientAbstracts extends Component implements IClient /** * @return static */ - #[Pure] public static function NewRequest(): static + public static function NewRequest(): static { return new static(); } @@ -415,7 +415,7 @@ abstract class ClientAbstracts extends Component implements IClient /** * @return int */ - #[Pure] public function getPort(): int + public function getPort(): int { if ($this->isSSL()) { return 443; @@ -512,7 +512,7 @@ abstract class ClientAbstracts extends Component implements IClient * @param $url * @return bool */ - #[Pure] protected function isHttp($url): bool + protected function isHttp($url): bool { return str_starts_with($url, 'http://'); } @@ -521,7 +521,7 @@ abstract class ClientAbstracts extends Component implements IClient * @param $url * @return bool */ - #[Pure] protected function isHttps($url): bool + protected function isHttps($url): bool { return str_starts_with($url, 'https://'); } @@ -673,7 +673,7 @@ abstract class ClientAbstracts extends Component implements IClient * @return bool * check isPost Request */ - #[Pure] public function isPost(): bool + public function isPost(): bool { return strtolower($this->method) === self::POST; } @@ -684,7 +684,7 @@ abstract class ClientAbstracts extends Component implements IClient * * check isGet Request */ - #[Pure] public function isGet(): bool + public function isGet(): bool { return strtolower($this->method) === self::GET; } @@ -695,7 +695,7 @@ abstract class ClientAbstracts extends Component implements IClient * @return array|string * 将请求参数进行编码 */ - #[Pure] protected function paramEncode($arr): array|string + protected function paramEncode($arr): array|string { if (!is_array($arr)) { return $arr; @@ -761,7 +761,7 @@ abstract class ClientAbstracts extends Component implements IClient * @param $params * @return string */ - #[Pure] protected function joinGetParams($path, $params): string + protected function joinGetParams($path, $params): string { if (empty($params)) { return $path; diff --git a/HttpServer/Client/Curl.php b/HttpServer/Client/Curl.php index 0b083c11..46201be6 100644 --- a/HttpServer/Client/Curl.php +++ b/HttpServer/Client/Curl.php @@ -5,7 +5,7 @@ namespace HttpServer\Client; use Exception; -use JetBrains\PhpStorm\Pure; + /** * Class Curl @@ -209,7 +209,7 @@ class Curl extends ClientAbstracts /** * @return array */ - #[Pure] private function parseHeaderMat(): array + private function parseHeaderMat(): array { $headers = []; foreach ($this->getHeader() as $key => $val) { diff --git a/HttpServer/Client/HttpClient.php b/HttpServer/Client/HttpClient.php index 5a7a4f46..09400318 100644 --- a/HttpServer/Client/HttpClient.php +++ b/HttpServer/Client/HttpClient.php @@ -4,7 +4,7 @@ namespace HttpServer\Client; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Component; use Snowflake\Snowflake; use Swoole\Coroutine; @@ -29,7 +29,7 @@ class HttpClient extends Component /** * @return Http2 */ - #[Pure] public static function http2(): Http2 + public static function http2(): Http2 { return Snowflake::app()->http2; } diff --git a/HttpServer/Client/Result.php b/HttpServer/Client/Result.php index 9fa1412e..ce2b1ac2 100644 --- a/HttpServer/Client/Result.php +++ b/HttpServer/Client/Result.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace HttpServer\Client; use Exception; -use JetBrains\PhpStorm\Pure; + /** * Class Result @@ -143,7 +143,7 @@ class Result /** * @return bool */ - #[Pure] public function httpIsOk(): bool + public function httpIsOk(): bool { return in_array($this->httpStatus, [100, 101, 200, 201, 202, 203, 204, 205, 206]); } diff --git a/HttpServer/Exception/AuthException.php b/HttpServer/Exception/AuthException.php index 7c24955b..4a277f94 100644 --- a/HttpServer/Exception/AuthException.php +++ b/HttpServer/Exception/AuthException.php @@ -9,7 +9,7 @@ declare(strict_types=1); namespace HttpServer\Exception; -use JetBrains\PhpStorm\Pure; + use Throwable; /** @@ -26,7 +26,7 @@ class AuthException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct($message = "", $code = 0, Throwable $previous = NULL) + public function __construct($message = "", $code = 0, Throwable $previous = NULL) { parent::__construct($message, 7000, $previous); } diff --git a/HttpServer/Exception/ExitException.php b/HttpServer/Exception/ExitException.php index 6293e44a..b073a2e8 100644 --- a/HttpServer/Exception/ExitException.php +++ b/HttpServer/Exception/ExitException.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace HttpServer\Exception; -use JetBrains\PhpStorm\Pure; + use Throwable; /** @@ -20,7 +20,7 @@ class ExitException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null) + public function __construct($message = "", $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index cdb711aa..1c06f2a4 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -6,7 +6,7 @@ namespace HttpServer\Http; use Exception; use HttpServer\Application; use HttpServer\IInterface\AuthIdentity; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Core\JSON; use Snowflake\Exception\ComponentException; @@ -186,7 +186,7 @@ class Request extends Application /** * @return string */ - #[Pure] public function getCurrent(): string + public function getCurrent(): string { return current($this->explode); } @@ -360,7 +360,7 @@ class Request extends Application /** * @return mixed|null */ - #[Pure] public function getIp() + public function getIp() { $headers = $this->headers->getHeaders(); if (!empty($headers['x-forwarded-for'])) return $headers['x-forwarded-for']; @@ -372,7 +372,7 @@ class Request extends Application /** * @return string */ - #[Pure] public function getRuntime(): string + public function getRuntime(): string { return sprintf('%.5f', microtime(TRUE) - $this->startTime); } diff --git a/HttpServer/Route/Filter/FilterException.php b/HttpServer/Route/Filter/FilterException.php index e3fc5c4c..90c2cd87 100644 --- a/HttpServer/Route/Filter/FilterException.php +++ b/HttpServer/Route/Filter/FilterException.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace HttpServer\Route\Filter; -use JetBrains\PhpStorm\Pure; + use Throwable; class FilterException extends \Exception @@ -18,7 +18,7 @@ class FilterException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null) + public function __construct($message = "", $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index b2250839..afc91050 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -9,7 +9,7 @@ use Closure; use HttpServer\Http\Request; use Exception; use HttpServer\Application; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Core\JSON; use Snowflake\Exception\NotFindClassException; @@ -81,7 +81,7 @@ class Node extends Application /** * @return bool */ - #[Pure] public function hasInterceptor(): bool + public function hasInterceptor(): bool { return count($this->_interceptors) > 0; } @@ -90,7 +90,7 @@ class Node extends Application /** * @return bool */ - #[Pure] public function hasLimits(): bool + public function hasLimits(): bool { return count($this->_limits) > 0; } @@ -129,7 +129,7 @@ class Node extends Application /** * @return bool */ - #[Pure] public function hasAfter(): bool + public function hasAfter(): bool { return count($this->_after) > 0; } diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 6daab921..17815840 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -8,7 +8,7 @@ use Exception; use HttpServer\Http\Request; use HttpServer\IInterface\RouterInterface; use HttpServer\Application; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Config; use Snowflake\Exception\ComponentException; use Snowflake\Exception\ConfigException; @@ -109,7 +109,7 @@ class Router extends Application implements RouterInterface * @param $path * @return string */ - #[Pure] private function resolve($path): string + private function resolve($path): string { $paths = array_column($this->groupTacks, 'prefix'); if (empty($paths)) { diff --git a/System/Abstracts/BaseApplication.php b/System/Abstracts/BaseApplication.php index 9dd74a0f..725c77aa 100644 --- a/System/Abstracts/BaseApplication.php +++ b/System/Abstracts/BaseApplication.php @@ -16,7 +16,7 @@ use HttpServer\Http\Request; use HttpServer\Http\Response; use HttpServer\Route\Router; use HttpServer\Server; -use JetBrains\PhpStorm\Pure; + use Kafka\Producer; use Annotation\Annotation as SAnnotation; use Snowflake\Cache\Redis; @@ -139,7 +139,7 @@ abstract class BaseApplication extends Service * * @return bool */ - #[Pure] protected function looksLikeSetter(string $line): bool + protected function looksLikeSetter(string $line): bool { return str_contains($line, '='); } diff --git a/System/Abstracts/BaseObject.php b/System/Abstracts/BaseObject.php index 9d415293..b8623f99 100644 --- a/System/Abstracts/BaseObject.php +++ b/System/Abstracts/BaseObject.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace Snowflake\Abstracts; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Error\Logger; use Snowflake\Snowflake; @@ -45,7 +45,7 @@ class BaseObject implements Configure /** * @return string */ - #[Pure] public static function className(): string + public static function className(): string { return get_called_class(); } diff --git a/System/Abstracts/Component.php b/System/Abstracts/Component.php index 20f28019..6b651016 100644 --- a/System/Abstracts/Component.php +++ b/System/Abstracts/Component.php @@ -11,7 +11,7 @@ namespace Snowflake\Abstracts; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Snowflake; /** @@ -50,7 +50,7 @@ class Component extends BaseObject * @param null $callback * @return bool */ - #[Pure] public function hasEvent($name, $callback = null): bool + public function hasEvent($name, $callback = null): bool { if (!isset($this->_events[$name])) { return false; diff --git a/System/Abstracts/Config.php b/System/Abstracts/Config.php index e8571e1c..117c8257 100644 --- a/System/Abstracts/Config.php +++ b/System/Abstracts/Config.php @@ -9,7 +9,7 @@ declare(strict_types=1); namespace Snowflake\Abstracts; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Exception\ConfigException; use Snowflake\Abstracts\Component; use Snowflake\Snowflake; @@ -94,7 +94,7 @@ class Config extends Component * @param bool $must_not_null * @return bool */ - #[Pure] public static function has($key, $must_not_null = false): bool + public static function has($key, $must_not_null = false): bool { $config = Snowflake::app()->config; if (!isset($config->data[$key])) { diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 469d94f5..72b44915 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -5,7 +5,7 @@ namespace Snowflake\Abstracts; use Exception; -use JetBrains\PhpStorm\Pure; + use Swoole\Coroutine; use Swoole\Coroutine\Channel; @@ -57,7 +57,7 @@ abstract class Pool extends Component * @param false $isMaster * @return string */ - #[Pure] public function name($cds, $isMaster = false): string + public function name($cds, $isMaster = false): string { if ($isMaster === true) { return hash('sha256', $cds . 'master'); diff --git a/System/Cache/File.php b/System/Cache/File.php index ae6b7a46..241fd8f0 100644 --- a/System/Cache/File.php +++ b/System/Cache/File.php @@ -11,7 +11,7 @@ namespace Snowflake\Cache; use Exception; -use JetBrains\PhpStorm\Pure; + use Snowflake\Abstracts\Component; use Swoole\Coroutine\System; @@ -119,7 +119,7 @@ class File extends Component implements ICache * @param $key * @return bool */ - #[Pure] public function exists($key): bool + public function exists($key): bool { return file_exists($key); } diff --git a/System/Core/DateFormat.php b/System/Core/DateFormat.php index fced4fca..e7d71c39 100644 --- a/System/Core/DateFormat.php +++ b/System/Core/DateFormat.php @@ -9,7 +9,7 @@ declare(strict_types=1); namespace Snowflake\Core; -use JetBrains\PhpStorm\Pure; + /** * Class DateFormat @@ -96,7 +96,7 @@ class DateFormat * @param null $endTime * @return string */ - #[Pure] public static function mtime($startTime, $endTime = null) + public static function mtime($startTime, $endTime = null) { if ($endTime === null) { $endTime = microtime(true); diff --git a/System/Core/Help.php b/System/Core/Help.php index 40ffde3e..bb0a040f 100644 --- a/System/Core/Help.php +++ b/System/Core/Help.php @@ -6,7 +6,7 @@ namespace Snowflake\Core; use Exception; -use JetBrains\PhpStorm\Pure; + /** * Class Help @@ -19,7 +19,7 @@ class Help * @param array $data * @return string */ - #[Pure] public static function toXml(array $data) + public static function toXml(array $data) { $xml = ""; foreach ($data as $key => $val) { diff --git a/System/Core/Str.php b/System/Core/Str.php index 86a3df72..617033b5 100644 --- a/System/Core/Str.php +++ b/System/Core/Str.php @@ -5,7 +5,7 @@ namespace Snowflake\Core; use Exception; -use JetBrains\PhpStorm\Pure; + /** * Class Str @@ -24,7 +24,7 @@ class Str * @return string * 获取随机字符串 */ - #[Pure] public static function rand(int $length = 20): string + public static function rand(int $length = 20): string { $string = ''; if ($length < 1) $length = 20; @@ -42,7 +42,7 @@ class Str * @return int|string 获取随机数字 * 获取随机数字 */ - #[Pure] public static function random(int $length = 20): int|string + public static function random(int $length = 20): int|string { $number = ''; $default = str_split(self::NUMBER); @@ -119,7 +119,7 @@ class Str * @param string $append * @return string */ - #[Pure] public static function cut($string, int $length = 20, $append = '...'): string + public static function cut($string, int $length = 20, $append = '...'): string { if (empty($string)) { return ''; @@ -167,7 +167,7 @@ class Str * @param $type * @return string */ - #[Pure] public static function filename($file, $type): string + public static function filename($file, $type): string { switch ($type) { case 'image/png': @@ -218,7 +218,7 @@ class Str * @param string $string * @return string */ - #[Pure] public static function encode(string $string): string + public static function encode(string $string): string { return addslashes($string); } diff --git a/System/Exception/AuthException.php b/System/Exception/AuthException.php index 9302d9ee..14b60a36 100644 --- a/System/Exception/AuthException.php +++ b/System/Exception/AuthException.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace Snowflake\Exception; -use JetBrains\PhpStorm\Pure; + use Throwable; /** @@ -21,7 +21,7 @@ class AuthException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null) + public function __construct($message = "", $code = 0, Throwable $previous = null) { parent::__construct($message, 401, $previous); } diff --git a/System/Exception/ComponentException.php b/System/Exception/ComponentException.php index 5c08c0bf..d1a7a9ad 100644 --- a/System/Exception/ComponentException.php +++ b/System/Exception/ComponentException.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace Snowflake\Exception; -use JetBrains\PhpStorm\Pure; + use Throwable; /** @@ -27,7 +27,7 @@ class ComponentException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct(string $message = "", int $code = 0, Throwable $previous = NULL) + public function __construct(string $message = "", int $code = 0, Throwable $previous = NULL) { parent::__construct($message, 5000, $previous); } diff --git a/System/Exception/NotFindClassException.php b/System/Exception/NotFindClassException.php index 6c7c6ae6..8bb75b43 100644 --- a/System/Exception/NotFindClassException.php +++ b/System/Exception/NotFindClassException.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace Snowflake\Exception; -use JetBrains\PhpStorm\Pure; + use Throwable; /** @@ -26,7 +26,7 @@ class NotFindClassException extends \Exception * @param int $code * @param Throwable|null $previous */ - #[Pure] public function __construct(string $message = "", int $code = 0, Throwable $previous = null) + public function __construct(string $message = "", int $code = 0, Throwable $previous = null) { $message = "No class named `$message` was found, please check if the class name is correct"; parent::__construct($message, 404, $previous); diff --git a/System/Pool/Pool.php b/System/Pool/Pool.php index 62459b6c..2f95881a 100644 --- a/System/Pool/Pool.php +++ b/System/Pool/Pool.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace Snowflake\Pool; -use JetBrains\PhpStorm\Pure; + use Snowflake\Snowflake; /** @@ -21,7 +21,7 @@ class Pool extends \Snowflake\Abstracts\Pool /** * @return Redis */ - #[Pure] public function getRedis(): Redis + public function getRedis(): Redis { return Snowflake::app()->redis_connections; } @@ -29,7 +29,7 @@ class Pool extends \Snowflake\Abstracts\Pool /** * @return Connection */ - #[Pure] public function getDb(): Connection + public function getDb(): Connection { return Snowflake::app()->connections; } diff --git a/System/Snowflake.php b/System/Snowflake.php index 53347ce8..35c7351c 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -7,7 +7,7 @@ namespace Snowflake; use Exception; use HttpServer\IInterface\Task; -use JetBrains\PhpStorm\Pure; + use ReflectionException; use Snowflake\Abstracts\Config; use Snowflake\Core\JSON; @@ -222,7 +222,7 @@ class Snowflake * @return Server|null * @throws */ - #[Pure] public static function getWebSocket(): ?Server + public static function getWebSocket(): ?Server { $server = static::app()->server->getServer(); if (!($server instanceof Server)) { @@ -319,7 +319,7 @@ class Snowflake /** * @return bool */ - #[Pure] public static function isMac(): bool + public static function isMac(): bool { $output = strtolower(PHP_OS | PHP_OS_FAMILY); if (str_contains('mac', $output)) { @@ -334,7 +334,7 @@ class Snowflake /** * @return bool */ - #[Pure] public static function isLinux(): bool + public static function isLinux(): bool { if (!static::isMac()) { return true; diff --git a/Validator/EnumValidator.php b/Validator/EnumValidator.php index dde2338e..b3ae8209 100644 --- a/Validator/EnumValidator.php +++ b/Validator/EnumValidator.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace validator; -use JetBrains\PhpStorm\Pure; + /** * Class EnumValidator @@ -42,7 +42,7 @@ class EnumValidator extends BaseValidator /** * @return string */ - #[Pure] private function i(): string + private function i(): string { return 'The param :attribute value only in ' . implode(',', $this->value); }