Upgrade friendsofphp/php-cs-fixer to ^3.0 (#3566)

* Upgrade friendsofphp/php-cs-fixer to ^3.0 and format code

* Rename barnch  to 2.2

* Create CHANGELOG-2.2.md
This commit is contained in:
李铭昕 2021-05-11 12:18:49 +08:00 committed by GitHub
parent 8c998f6bc3
commit 3b097dc70a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 182 additions and 177 deletions

View File

@ -9,7 +9,7 @@ This file is part of Hyperf.
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
EOF;
return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
@ -17,7 +17,7 @@ return PhpCsFixer\Config::create()
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'commentType' => 'PHPDoc',
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',

5
CHANGELOG-2.2.md Normal file
View File

@ -0,0 +1,5 @@
# v2.2.0 - TBD
## Dependencies Upgrade
- Upgraded `friendsofphp/php-cs-fixer` to `^3.0`;

View File

@ -9,7 +9,7 @@ then
fi
NOW=$(date +%s)
CURRENT_BRANCH="master"
CURRENT_BRANCH="2.2"
VERSION=$1
BASEPATH=$(cd `dirname $0`; cd ../src/; pwd)

View File

@ -3,7 +3,7 @@
set -e
set -x
CURRENT_BRANCH="master"
CURRENT_BRANCH="2.2"
BASEPATH=$(cd `dirname $0`; cd ../src/; pwd)
REPOS=$@

View File

@ -38,7 +38,7 @@
"elasticsearch/elasticsearch": "^7.0",
"fig/http-message-util": "^1.1.2",
"filp/whoops": "^2.7",
"friendsofphp/php-cs-fixer": "^2.14",
"friendsofphp/php-cs-fixer": "^3.0",
"google/protobuf": "^3.6.1",
"grpc/grpc": "^1.15",
"guzzlehttp/guzzle": "^6.3|^7.0",

View File

@ -19,7 +19,7 @@ use Swoole\Coroutine\Client;
class SwooleIO extends AbstractIO
{
const READ_BUFFER_WAIT_INTERVAL = 100000;
public const READ_BUFFER_WAIT_INTERVAL = 100000;
/**
* @var string

View File

@ -13,7 +13,7 @@ namespace Hyperf\Amqp;
class Constants
{
const DELIVERY_MODE_NON_PERSISTENT = 1;
public const DELIVERY_MODE_NON_PERSISTENT = 1;
const DELIVERY_MODE_PERSISTENT = 2;
public const DELIVERY_MODE_PERSISTENT = 2;
}

View File

@ -13,11 +13,11 @@ namespace Hyperf\Amqp\Message;
class Type
{
const DIRECT = 'direct';
public const DIRECT = 'direct';
const FANOUT = 'fanout';
public const FANOUT = 'fanout';
const TOPIC = 'topic';
public const TOPIC = 'topic';
public static function all()
{

View File

@ -16,20 +16,20 @@ class Result
/**
* Acknowledge the message.
*/
const ACK = 'ack';
public const ACK = 'ack';
/**
* Unacknowledge the message.
*/
const NACK = 'nack';
public const NACK = 'nack';
/**
* Reject the message and requeue it.
*/
const REQUEUE = 'requeue';
public const REQUEUE = 'requeue';
/**
* Reject the message and drop it.
*/
const DROP = 'drop';
public const DROP = 'drop';
}

View File

@ -18,7 +18,7 @@ use Hyperf\Di\Aop\ProceedingJoinPoint;
class TimeoutHandler extends AbstractHandler
{
const DEFAULT_TIMEOUT = 5;
public const DEFAULT_TIMEOUT = 5;
protected function process(ProceedingJoinPoint $proceedingJoinPoint, CircuitBreaker $breaker, Annotation $annotation)
{

View File

@ -13,11 +13,11 @@ namespace Hyperf\CircuitBreaker;
class State
{
const CLOSE = 0;
public const CLOSE = 0;
const HALF_OPEN = 1;
public const HALF_OPEN = 1;
const OPEN = 2;
public const OPEN = 2;
protected $state;

View File

@ -18,68 +18,68 @@ class ErrorCodeStub extends AbstractConstants
/**
* @Message("Server Error!")
*/
const SERVER_ERROR = 500;
public const SERVER_ERROR = 500;
/**
* @Message("SHOW ECHO")
* @Echo("ECHO")
*/
const SHOW_ECHO = 501;
public const SHOW_ECHO = 501;
const NO_MESSAGE = 502;
public const NO_MESSAGE = 502;
/**
* @Message("Params[%s] is invalid.")
*/
const PARAMS_INVALID = 503;
public const PARAMS_INVALID = 503;
/**
* @Message("error.message")
*/
const TRANSLATOR_ERROR_MESSAGE = 504;
public const TRANSLATOR_ERROR_MESSAGE = 504;
/**
* @Message("error.not_exist")
*/
const TRANSLATOR_NOT_EXIST = 505;
public const TRANSLATOR_NOT_EXIST = 505;
/**
* @Status("Status enabled")
*/
const STATUS_ENABLE = 1;
public const STATUS_ENABLE = 1;
/**
* @Status("Status disabled")
*/
const STATUS_DISABLE = 0;
public const STATUS_DISABLE = 0;
/**
* @Type("Type enabled")
*/
const TYPE_ENABLE = 1;
public const TYPE_ENABLE = 1;
/**
* @Type("Type disabled")
*/
const TYPE_DISABLE = 0;
public const TYPE_DISABLE = 0;
/**
* @Message("Type1001")
*/
const TYPE_INT = 1001;
public const TYPE_INT = 1001;
/**
* @Message("Type1002.1")
*/
const TYPE_FLOAT = 1002.1;
public const TYPE_FLOAT = 1002.1;
/**
* @Message("Type1003.1")
*/
const TYPE_FLOAT_STRING = '1003.1';
public const TYPE_FLOAT_STRING = '1003.1';
/**
* @Message("TypeString")
*/
const TYPE_STRING = 'string';
public const TYPE_STRING = 'string';
}

View File

@ -20,7 +20,7 @@ use Psr\Log\NullLogger;
abstract class Client
{
const DEFAULT_URI = 'http://127.0.0.1:8500';
public const DEFAULT_URI = 'http://127.0.0.1:8500';
/**
* Will execute this closure everytime when the consul client send a HTTP request,

View File

@ -37,7 +37,7 @@ use RuntimeException;
class ModelUpdateVisitor extends NodeVisitorAbstract
{
const RELATION_METHODS = [
public const RELATION_METHODS = [
'hasMany' => HasMany::class,
'hasManyThrough' => HasManyThrough::class,
'hasOneThrough' => HasOneThrough::class,

View File

@ -13,12 +13,12 @@ namespace Hyperf\Database\Commands\Migrations;
class TableGuesser
{
const CREATE_PATTERNS = [
public const CREATE_PATTERNS = [
'/^create_(\w+)_table$/',
'/^create_(\w+)$/',
];
const CHANGE_PATTERNS = [
public const CHANGE_PATTERNS = [
'/_(to|from|in)_(\w+)_table$/',
'/_(to|from|in)_(\w+)$/',
];

View File

@ -13,9 +13,9 @@ namespace Hyperf\Database\Commands;
class ModelOption
{
const PROPERTY_SNAKE_CASE = 0;
public const PROPERTY_SNAKE_CASE = 0;
const PROPERTY_CAMEL_CASE = 1;
public const PROPERTY_CAMEL_CASE = 1;
/**
* @var string

View File

@ -46,14 +46,14 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
*
* @var string
*/
const CREATED_AT = 'created_at';
public const CREATED_AT = 'created_at';
/**
* The name of the "updated at" column.
*
* @var string
*/
const UPDATED_AT = 'updated_at';
public const UPDATED_AT = 'updated_at';
/**
* Indicates if the IDs are auto-incrementing.

View File

@ -1333,7 +1333,7 @@ class ModelBuilderTestModelSelfRelatedStub extends Model
class ModelBuilderTestStubWithoutTimestamp extends Model
{
const UPDATED_AT = null;
public const UPDATED_AT = null;
protected $table = 'table';
}

View File

@ -13,9 +13,9 @@ namespace Hyperf\Di\Aop;
class RewriteCollection
{
const CLASS_LEVEL = 1;
public const CLASS_LEVEL = 1;
const METHOD_LEVEL = 2;
public const METHOD_LEVEL = 2;
/**
* Which methods can be rewrite.

View File

@ -17,5 +17,5 @@ class LazyProxy extends Proxied
{
use LazyProxyTrait;
const PROXY_TARGET = 'HyperfTest\\Di\\Stub\\Proxied';
public const PROXY_TARGET = 'HyperfTest\\Di\\Stub\\Proxied';
}

View File

@ -19,65 +19,65 @@ use GuzzleHttp\Client as HttpClient;
class EtcdClient
{
// KV
const URI_PUT = 'kv/put';
public const URI_PUT = 'kv/put';
const URI_RANGE = 'kv/range';
public const URI_RANGE = 'kv/range';
const URI_DELETE_RANGE = 'kv/deleterange';
public const URI_DELETE_RANGE = 'kv/deleterange';
const URI_TXN = 'kv/txn';
public const URI_TXN = 'kv/txn';
const URI_COMPACTION = 'kv/compaction';
public const URI_COMPACTION = 'kv/compaction';
// Lease
const URI_GRANT = 'lease/grant';
public const URI_GRANT = 'lease/grant';
const URI_REVOKE = 'kv/lease/revoke';
public const URI_REVOKE = 'kv/lease/revoke';
const URI_KEEPALIVE = 'lease/keepalive';
public const URI_KEEPALIVE = 'lease/keepalive';
const URI_TIMETOLIVE = 'kv/lease/timetolive';
public const URI_TIMETOLIVE = 'kv/lease/timetolive';
// Role
const URI_AUTH_ROLE_ADD = 'auth/role/add';
public const URI_AUTH_ROLE_ADD = 'auth/role/add';
const URI_AUTH_ROLE_GET = 'auth/role/get';
public const URI_AUTH_ROLE_GET = 'auth/role/get';
const URI_AUTH_ROLE_DELETE = 'auth/role/delete';
public const URI_AUTH_ROLE_DELETE = 'auth/role/delete';
const URI_AUTH_ROLE_LIST = 'auth/role/list';
public const URI_AUTH_ROLE_LIST = 'auth/role/list';
// Authenticate
const URI_AUTH_ENABLE = 'auth/enable';
public const URI_AUTH_ENABLE = 'auth/enable';
const URI_AUTH_DISABLE = 'auth/disable';
public const URI_AUTH_DISABLE = 'auth/disable';
const URI_AUTH_AUTHENTICATE = 'auth/authenticate';
public const URI_AUTH_AUTHENTICATE = 'auth/authenticate';
// User
const URI_AUTH_USER_ADD = 'auth/user/add';
public const URI_AUTH_USER_ADD = 'auth/user/add';
const URI_AUTH_USER_GET = 'auth/user/get';
public const URI_AUTH_USER_GET = 'auth/user/get';
const URI_AUTH_USER_DELETE = 'auth/user/delete';
public const URI_AUTH_USER_DELETE = 'auth/user/delete';
const URI_AUTH_USER_CHANGE_PASSWORD = 'auth/user/changepw';
public const URI_AUTH_USER_CHANGE_PASSWORD = 'auth/user/changepw';
const URI_AUTH_USER_LIST = 'auth/user/list';
public const URI_AUTH_USER_LIST = 'auth/user/list';
const URI_AUTH_ROLE_GRANT = 'auth/role/grant';
public const URI_AUTH_ROLE_GRANT = 'auth/role/grant';
const URI_AUTH_ROLE_REVOKE = 'auth/role/revoke';
public const URI_AUTH_ROLE_REVOKE = 'auth/role/revoke';
const URI_AUTH_USER_GRANT = 'auth/user/grant';
public const URI_AUTH_USER_GRANT = 'auth/user/grant';
const URI_AUTH_USER_REVOKE = 'auth/user/revoke';
public const URI_AUTH_USER_REVOKE = 'auth/user/revoke';
const PERMISSION_READ = 0;
public const PERMISSION_READ = 0;
const PERMISSION_WRITE = 1;
public const PERMISSION_WRITE = 1;
const PERMISSION_READWRITE = 2;
public const PERMISSION_READWRITE = 2;
/**
* @var HttpClient

View File

@ -20,7 +20,7 @@ use SplPriorityQueue;
class ExceptionHandlerListener implements ListenerInterface
{
const HANDLER_KEY = 'exceptions.handler';
public const HANDLER_KEY = 'exceptions.handler';
/**
* @var ConfigInterface

View File

@ -31,10 +31,10 @@ use function substr;
class AnnotationReader
{
// In this mode, no exceptions will be thrown for incorrect annotations (unless the name of the annotation we are looking for is part of the docblock)
const LAX_MODE = 'LAX_MODE';
public const LAX_MODE = 'LAX_MODE';
// In this mode, exceptions will be thrown for any incorrect annotations.
const STRICT_MODE = 'STRICT_MODE';
public const STRICT_MODE = 'STRICT_MODE';
/**
* @var Reader

View File

@ -22,7 +22,7 @@ use Swoole\Coroutine\Http2\Client as SwooleHttp2Client;
class GrpcClient
{
const GRPC_DEFAULT_TIMEOUT = 3.0;
public const GRPC_DEFAULT_TIMEOUT = 3.0;
/**
* @var ChannelPool

View File

@ -15,7 +15,7 @@ use Google\Protobuf\Internal\Message;
class Parser
{
const GRPC_ERROR_NO_RESPONSE = -1;
public const GRPC_ERROR_NO_RESPONSE = -1;
public static function pack(string $data): string
{

View File

@ -21,12 +21,12 @@ class StatusCode
/**
* The operation completed successfully.
*/
const OK = 0;
public const OK = 0;
/**
* The operation was cancelled (typically by the caller).
*/
const CANCELLED = 1;
public const CANCELLED = 1;
/**
* Unknown error. An example of where this error may be returned is
@ -35,7 +35,7 @@ class StatusCode
* errors raised by APIs that do not return enough error information
* may be converted to this error.
*/
const UNKNOWN = 2;
public const UNKNOWN = 2;
/**
* Client specified an invalid argument. Note that this differs
@ -43,7 +43,7 @@ class StatusCode
* that are problematic regardless of the state of the system
* (e.g., a malformed file name).
*/
const INVALID_ARGUMENT = 3;
public const INVALID_ARGUMENT = 3;
/**
* Deadline expired before operation could complete. For operations
@ -52,17 +52,17 @@ class StatusCode
* successful response from a server could have been delayed long
* enough for the deadline to expire.
*/
const DEADLINE_EXCEEDED = 4;
public const DEADLINE_EXCEEDED = 4;
/**
* Some requested entity (e.g., file or directory) was not found.
*/
const NOT_FOUND = 5;
public const NOT_FOUND = 5;
/**
* Some entity that we attempted to create (e.g., file or directory) already exists.
*/
const ALREADY_EXISTS = 6;
public const ALREADY_EXISTS = 6;
/**
* The caller does not have permission to execute the specified
@ -72,13 +72,13 @@ class StatusCode
* used if the caller cannot be identified (use UNAUTHENTICATED
* instead for those errors).
*/
const PERMISSION_DENIED = 7;
public const PERMISSION_DENIED = 7;
/**
* Some resource has been exhausted, perhaps a per-user quota, or
* perhaps the entire file system is out of space.
*/
const RESOURCE_EXHAUSTED = 8;
public const RESOURCE_EXHAUSTED = 8;
/**
* Operation was rejected because the system is not in a state
@ -97,7 +97,7 @@ class StatusCode
* should be returned since the client should not retry unless
* they have first fixed up the directory by deleting files from it.
*/
const FAILED_PRECONDITION = 9;
public const FAILED_PRECONDITION = 9;
/**
* The operation was aborted, typically due to a concurrency issue
@ -106,7 +106,7 @@ class StatusCode
* <p>See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
const ABORTED = 10;
public const ABORTED = 10;
/**
* Operation was attempted past the valid range. E.g., seeking or
@ -124,19 +124,19 @@ class StatusCode
* so that callers who are iterating through
* a space can easily look for an OUT_OF_RANGE error to detect when they are done.
*/
const OUT_OF_RANGE = 11;
public const OUT_OF_RANGE = 11;
/**
* Operation is not implemented or not supported/enabled in this service.
*/
const UNIMPLEMENTED = 12;
public const UNIMPLEMENTED = 12;
/**
* Internal errors. Means some invariants expected by underlying
* system has been broken. If you see one of these errors,
* something is very broken.
*/
const INTERNAL = 13;
public const INTERNAL = 13;
/**
* The service is currently unavailable. This is a most likely a
@ -147,23 +147,23 @@ class StatusCode
* <p>See litmus test above for deciding between FAILED_PRECONDITION,
* ABORTED, and UNAVAILABLE.
*/
const UNAVAILABLE = 14;
public const UNAVAILABLE = 14;
/**
* Unrecoverable data loss or corruption.
*/
const DATA_LOSS = 15;
public const DATA_LOSS = 15;
/**
* The request does not have valid authentication credentials for the
* operation.
*/
const UNAUTHENTICATED = 16;
public const UNAUTHENTICATED = 16;
/**
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
const HTTP_CODE_MAPPING = [
public const HTTP_CODE_MAPPING = [
self::OK => 200,
self::CANCELLED => 499,
self::UNKNOWN => 500,

View File

@ -13,9 +13,9 @@ namespace Hyperf\HttpMessage\Cookie;
class Cookie
{
const SAMESITE_LAX = 'lax';
public const SAMESITE_LAX = 'lax';
const SAMESITE_STRICT = 'strict';
public const SAMESITE_STRICT = 'strict';
protected $name;

View File

@ -21,7 +21,7 @@ class Uri implements UriInterface
* we apply this default host when no host is given yet to form a
* valid URI.
*/
const DEFAULT_HTTP_HOST = 'localhost';
public const DEFAULT_HTTP_HOST = 'localhost';
/**
* @var array

View File

@ -20,17 +20,17 @@ use Psr\Http\Message\ServerRequestInterface;
class ResponseBuilder
{
const SERVER_ERROR = -32000;
public const SERVER_ERROR = -32000;
const INVALID_REQUEST = -32600;
public const INVALID_REQUEST = -32600;
const METHOD_NOT_FOUND = -32601;
public const METHOD_NOT_FOUND = -32601;
const INVALID_PARAMS = -32602;
public const INVALID_PARAMS = -32602;
const INTERNAL_ERROR = -32603;
public const INTERNAL_ERROR = -32603;
const PARSE_ERROR = -32700;
public const PARSE_ERROR = -32700;
/**
* @var \Hyperf\Rpc\Contract\DataFormatterInterface

View File

@ -16,7 +16,7 @@ use longlang\phpkafka\Consumer\Assignor\RoundRobinAssignor;
class KafkaStrategy
{
const RANGE_ASSIGNOR = RangeAssignor::class;
public const RANGE_ASSIGNOR = RangeAssignor::class;
const ROUND_ROBIN_ASSIGNOR = RoundRobinAssignor::class;
public const ROUND_ROBIN_ASSIGNOR = RoundRobinAssignor::class;
}

View File

@ -16,15 +16,15 @@ class Result
/**
* Acknowledge the message.
*/
const ACK = 'ack';
public const ACK = 'ack';
/**
* Reject the message and requeue it.
*/
const REQUEUE = 'requeue';
public const REQUEUE = 'requeue';
/**
* Reject the message and drop it.
*/
const DROP = 'drop';
public const DROP = 'drop';
}

View File

@ -13,9 +13,9 @@ namespace Hyperf\Metric\Adapter\Prometheus;
class Constants
{
const SCRAPE_MODE = 1;
public const SCRAPE_MODE = 1;
const PUSH_MODE = 2;
public const PUSH_MODE = 2;
const CUSTOM_MODE = 3;
public const CUSTOM_MODE = 3;
}

View File

@ -28,7 +28,7 @@ use Prometheus\Storage\Adapter;
*/
class Redis implements Adapter
{
const PROMETHEUS_METRIC_KEYS_SUFFIX = '_METRIC_KEYS';
public const PROMETHEUS_METRIC_KEYS_SUFFIX = '_METRIC_KEYS';
/**
* @var array

View File

@ -13,7 +13,7 @@ namespace Hyperf\Nacos;
class Constants
{
const CONFIG_MERGE_OVERWRITE = 1;
public const CONFIG_MERGE_OVERWRITE = 1;
const CONFIG_MERGE_APPEND = 2;
public const CONFIG_MERGE_APPEND = 2;
}

View File

@ -16,15 +16,15 @@ class Result
/**
* Acknowledge the message.
*/
const ACK = 'ack';
public const ACK = 'ack';
/**
* Reject the message and requeue it.
*/
const REQUEUE = 'requeue';
public const REQUEUE = 'requeue';
/**
* Reject the message and drop it.
*/
const DROP = 'drop';
public const DROP = 'drop';
}

View File

@ -16,11 +16,11 @@ use Swoole\Coroutine\Socket;
class Subscriber
{
const TYPE_RESPONSE = 0;
public const TYPE_RESPONSE = 0;
const TYPE_ERROR = 1;
public const TYPE_ERROR = 1;
const TYPE_MESSAGE = 2;
public const TYPE_MESSAGE = 2;
/**
* @var \Swoole\Coroutine\Socket

View File

@ -15,7 +15,7 @@ use Hyperf\Contract\PackerInterface;
interface ProtocolPackerInterface extends PackerInterface
{
const HEAD_LENGTH = 4;
public const HEAD_LENGTH = 4;
public function length(string $head): int;
}

View File

@ -19,7 +19,7 @@ use function make;
class RateLimitHandler
{
const RATE_LIMIT_BUCKETS = 'rateLimit:buckets';
public const RATE_LIMIT_BUCKETS = 'rateLimit:buckets';
/**
* @var \Redis

View File

@ -23,7 +23,7 @@ use function make;
class RedisStorage implements Storage, GlobalScope
{
const KEY_PREFIX = 'rateLimiter:storage:';
public const KEY_PREFIX = 'rateLimiter:storage:';
/**
* @var Mutex

View File

@ -16,102 +16,102 @@ class Event
/**
* Swoole onStart event.
*/
const ON_START = 'start';
public const ON_START = 'start';
/**
* Swoole onWorkerStart event.
*/
const ON_WORKER_START = 'workerStart';
public const ON_WORKER_START = 'workerStart';
/**
* Swoole onWorkerStop event.
*/
const ON_WORKER_STOP = 'workerStop';
public const ON_WORKER_STOP = 'workerStop';
/**
* Swoole onWorkerExit event.
*/
const ON_WORKER_EXIT = 'workerExit';
public const ON_WORKER_EXIT = 'workerExit';
/**
* Swoole onWorkerError event.
*/
const ON_WORKER_ERROR = 'workerError';
public const ON_WORKER_ERROR = 'workerError';
/**
* Swoole onPipeMessage event.
*/
const ON_PIPE_MESSAGE = 'pipeMessage';
public const ON_PIPE_MESSAGE = 'pipeMessage';
/**
* Swoole onRequest event.
*/
const ON_REQUEST = 'request';
public const ON_REQUEST = 'request';
/**
* Swoole onReceive event.
*/
const ON_RECEIVE = 'receive';
public const ON_RECEIVE = 'receive';
/**
* Swoole onConnect event.
*/
const ON_CONNECT = 'connect';
public const ON_CONNECT = 'connect';
/**
* Swoole onHandShake event.
*/
const ON_HAND_SHAKE = 'handshake';
public const ON_HAND_SHAKE = 'handshake';
/**
* Swoole onOpen event.
*/
const ON_OPEN = 'open';
public const ON_OPEN = 'open';
/**
* Swoole onMessage event.
*/
const ON_MESSAGE = 'message';
public const ON_MESSAGE = 'message';
/**
* Swoole onClose event.
*/
const ON_CLOSE = 'close';
public const ON_CLOSE = 'close';
/**
* Swoole onTask event.
*/
const ON_TASK = 'task';
public const ON_TASK = 'task';
/**
* Swoole onFinish event.
*/
const ON_FINISH = 'finish';
public const ON_FINISH = 'finish';
/**
* Swoole onShutdown event.
*/
const ON_SHUTDOWN = 'shutdown';
public const ON_SHUTDOWN = 'shutdown';
/**
* Swoole onPacket event.
*/
const ON_PACKET = 'packet';
public const ON_PACKET = 'packet';
/**
* Swoole onManagerStart event.
*/
const ON_MANAGER_START = 'managerStart';
public const ON_MANAGER_START = 'managerStart';
/**
* Swoole onManagerStop event.
*/
const ON_MANAGER_STOP = 'managerStop';
public const ON_MANAGER_STOP = 'managerStop';
/**
* Before server start, it's not a swoole event.
*/
const ON_BEFORE_START = 'beforeStart';
public const ON_BEFORE_START = 'beforeStart';
public static function isSwooleEvent($event): bool
{

View File

@ -19,11 +19,11 @@ use Swoole\Server as SwooleServer;
interface ServerInterface
{
const SERVER_HTTP = 1;
public const SERVER_HTTP = 1;
const SERVER_WEBSOCKET = 2;
public const SERVER_WEBSOCKET = 2;
const SERVER_BASE = 3;
public const SERVER_BASE = 3;
public function __construct(ContainerInterface $container, LoggerInterface $logger, EventDispatcherInterface $dispatcher);

View File

@ -13,9 +13,9 @@ namespace Hyperf\Signal;
interface SignalHandlerInterface
{
const WORKER = 1;
public const WORKER = 1;
const PROCESS = 2;
public const PROCESS = 2;
/**
* @return array [[ WOKKER, SIGNAL ]]

View File

@ -18,7 +18,7 @@ use Hyperf\Snowflake\MetaGenerator;
abstract class RedisMetaGenerator extends MetaGenerator
{
const DEFAULT_REDIS_KEY = 'hyperf:snowflake:workerId';
public const DEFAULT_REDIS_KEY = 'hyperf:snowflake:workerId';
/**
* @var ConfigInterface

View File

@ -13,7 +13,7 @@ namespace Hyperf\Snowflake;
interface MetaGeneratorInterface
{
const DEFAULT_BEGIN_SECOND = 1560960000;
public const DEFAULT_BEGIN_SECOND = 1560960000;
public function generate(): Meta;

View File

@ -13,17 +13,17 @@ namespace Hyperf\SocketIOServer\Parser;
class Engine
{
const OPEN = '0';
public const OPEN = '0';
const CLOSE = '1';
public const CLOSE = '1';
const PING = '2';
public const PING = '2';
const PONG = '3';
public const PONG = '3';
const MESSAGE = '4';
public const MESSAGE = '4';
const UPGRADE = '5';
public const UPGRADE = '5';
const NOOP = '6';
public const NOOP = '6';
}

View File

@ -13,13 +13,13 @@ namespace Hyperf\SocketIOServer\Parser;
class Packet implements \ArrayAccess
{
const OPEN = '0';
public const OPEN = '0';
const CLOSE = '1';
public const CLOSE = '1';
const EVENT = '2';
public const EVENT = '2';
const ACK = '3';
public const ACK = '3';
/**
* @var string

View File

@ -13,9 +13,9 @@ namespace Hyperf\Utils\Codec;
class Base62
{
const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
public const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
const BASE = 62;
public const BASE = 62;
public static function encode(int $number): string
{

View File

@ -16,10 +16,10 @@ class Constants
/**
* Swoole onWorkerStart event.
*/
const WORKER_START = 'workerStart';
public const WORKER_START = 'workerStart';
/**
* Swoole onWorkerExit event.
*/
const WORKER_EXIT = 'workerExit';
public const WORKER_EXIT = 'workerExit';
}

View File

@ -18,7 +18,7 @@ interface FinderInterface
*
* @var string
*/
const HINT_PATH_DELIMITER = '::';
public const HINT_PATH_DELIMITER = '::';
/**
* Get the fully qualified location of the view.

View File

@ -13,7 +13,7 @@ namespace Hyperf\View;
class Mode
{
const TASK = 'task';
public const TASK = 'task';
const SYNC = 'sync';
public const SYNC = 'sync';
}

View File

@ -16,7 +16,7 @@ use Hyperf\Utils\Context as CoContext;
class Context
{
const FD = 'ws.fd';
public const FD = 'ws.fd';
/**
* @var array

View File

@ -21,7 +21,7 @@ use Psr\Http\Message\ServerRequestInterface;
class CoreMiddleware extends HttpCoreMiddleware
{
const HANDLER_NAME = 'class';
public const HANDLER_NAME = 'class';
/**
* Handle the response when found.

View File

@ -13,15 +13,15 @@ namespace Hyperf\WebSocketServer;
class Security
{
const VERSION = '13';
public const VERSION = '13';
const PATTEN = '#^[+/0-9A-Za-z]{21}[AQgw]==$#';
public const PATTEN = '#^[+/0-9A-Za-z]{21}[AQgw]==$#';
const KEY = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
public const KEY = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
const SEC_WEBSOCKET_KEY = 'Sec-Websocket-Key';
public const SEC_WEBSOCKET_KEY = 'Sec-Websocket-Key';
const SEC_WEBSOCKET_PROTOCOL = 'Sec-WebSocket-Protocol';
public const SEC_WEBSOCKET_PROTOCOL = 'Sec-WebSocket-Protocol';
public function isInvalidSecurityKey(string $key): bool
{