Skip to content

Commit

Permalink
优化注释,尽可能使用 inheritDoc 注释
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Oct 13, 2021
1 parent 7876aec commit 88df621
Show file tree
Hide file tree
Showing 51 changed files with 128 additions and 241 deletions.
2 changes: 1 addition & 1 deletion src/HotUpdate/Listener/OnServerCreateAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class OnServerCreateAfter implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
18 changes: 9 additions & 9 deletions src/Http/Message/WorkermanRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __construct(Worker $worker, TcpConnection $connection, \Workerma
}

/**
* 初始化协议版本.
* {@inheritDoc}
*/
protected function initProtocolVersion(): void
{
$this->protocolVersion = $this->workermanRequest->protocolVersion();
}

/**
* 初始化 headers.
* {@inheritDoc}
*/
protected function initHeaders(): void
{
Expand All @@ -56,15 +56,15 @@ protected function initHeaders(): void
}

/**
* 初始化 body.
* {@inheritDoc}
*/
protected function initBody(): void
{
$this->body = new MemoryStream($this->workermanRequest->rawBody());
}

/**
* 初始化 uri.
* {@inheritDoc}
*/
protected function initUri(): void
{
Expand All @@ -83,23 +83,23 @@ protected function initUri(): void
}

/**
* 初始化 method.
* {@inheritDoc}
*/
protected function initMethod(): void
{
$this->method = $this->workermanRequest->method();
}

/**
* 初始化 server.
* {@inheritDoc}
*/
protected function initServer(): void
{
$this->server = [];
}

/**
* 初始化请求参数.
* {@inheritDoc}
*/
protected function initRequestParams(): void
{
Expand All @@ -111,7 +111,7 @@ protected function initRequestParams(): void
}

/**
* 初始化上传文件.
* {@inheritDoc}
*/
protected function initUploadedFiles(): void
{
Expand Down Expand Up @@ -143,7 +143,7 @@ public function getConnection(): TcpConnection
}

/**
* 获取客户端地址
* {@inheritDoc}
*/
public function getClientAddress(): IPEndPoint
{
Expand Down
18 changes: 4 additions & 14 deletions src/Http/Message/WorkermanResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function __construct(Worker $worker, TcpConnection $connection, ?\Workerm
}

/**
* 响应头是否可写.
* {@inheritDoc}
*/
public function isHeaderWritable(): bool
{
return $this->workermanResponse && $this->isHeaderWritable;
}

/**
* 响应主体是否可写.
* {@inheritDoc}
*/
public function isBodyWritable(): bool
{
Expand Down Expand Up @@ -99,9 +99,7 @@ private function sendHeaders(): void
}

/**
* 发送所有响应数据.
*
* @return static
* {@inheritDoc}
*/
public function send(): self
{
Expand All @@ -118,15 +116,7 @@ public function send(): self
}

/**
* 发送文件,一般用于文件下载.
*
* @param string $filename 要发送的文件名称,文件不存在或没有访问权限sendfile会失败
* @param string|null $contentType Content-Type 响应头,不填则自动识别
* @param string|null $outputFileName 下载文件名,不填则自动识别,如:123.zip
* @param int $offset 上传文件的偏移量,可以指定从文件的中间部分开始传输数据。此特性可用于支持断点续传。
* @param int $length 发送数据的尺寸,默认为整个文件的尺寸
*
* @return static
* {@inheritDoc}
*/
public function sendFile(string $filename, ?string $contentType = null, ?string $outputFileName = null, int $offset = 0, int $length = 0): self
{
Expand Down
2 changes: 1 addition & 1 deletion src/Listener/OnWorkerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class OnWorkerStart implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Process/Annotation/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Process extends Base
{
/**
* 只传一个参数时的参数名.
* {@inheritDoc}
*/
protected ?string $defaultFieldName = 'name';

Expand Down
2 changes: 1 addition & 1 deletion src/Process/Listener/BuildRuntimeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class BuildRuntimeListener implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Process/Listener/LoadRuntimeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class LoadRuntimeListener implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Process/Listener/OnServerCreateAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class OnServerCreateAfter implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
7 changes: 1 addition & 6 deletions src/Process/Parser/ProcessParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
class ProcessParser extends BaseParser
{
/**
* 处理方法.
*
* @param \Imi\Bean\Annotation\Base $annotation 注解类
* @param string $className 类名
* @param string $target 注解目标类型(类/属性/方法)
* @param string $targetName 注解目标名称
* {@inheritDoc}
*/
public function parse(\Imi\Bean\Annotation\Base $annotation, string $className, string $target, string $targetName): void
{
Expand Down
16 changes: 7 additions & 9 deletions src/Server/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class Base extends BaseServer implements IWorkermanServer, IServerGroup
protected string $workerClass = WorkermanServerWorker::class;

/**
* 构造方法.
* {@inheritDoc}
*/
public function __construct(string $name, array $config)
{
Expand Down Expand Up @@ -81,38 +81,38 @@ protected function createServer(): Worker
}

/**
* 是否支持 SSL.
* {@inheritDoc}
*/
public function isSSL(): bool
{
return isset($this->worker) && 'ssl' === $this->worker->transport;
}

/**
* 获取 Workerman Worker 对象
* {@inheritDoc}
*/
public function getWorker(): Worker
{
return $this->worker;
}

/**
* 开启服务
* {@inheritDoc}
*/
public function start(): void
{
}

/**
* 终止服务
* {@inheritDoc}
*/
public function shutdown(): void
{
Worker::stopAll();
}

/**
* 重载服务
* {@inheritDoc}
*/
public function reload(): void
{
Expand Down Expand Up @@ -359,9 +359,7 @@ protected function bindEvents(): void
}

/**
* 获取客户端地址
*
* @param string|int $clientId
* {@inheritDoc}
*/
public function getClientAddress($clientId): IPEndPoint
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Http/Listener/BeforeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class BeforeRequest implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
3 changes: 3 additions & 0 deletions src/Server/Http/Listener/SuperGlobals.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
*/
class SuperGlobals implements IEventListener
{
/**
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
/** @var \Imi\Server\Http\SuperGlobals\Listener\SuperGlobals $superGlobals */
Expand Down
10 changes: 5 additions & 5 deletions src/Server/Http/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class Server extends Base
{
/**
* 构造方法.
* {@inheritDoc}
*/
public function __construct(string $name, array $config)
{
Expand All @@ -33,23 +33,23 @@ public function __construct(string $name, array $config)
}

/**
* 获取协议名称.
* {@inheritDoc}
*/
public function getProtocol(): string
{
return Protocol::HTTP;
}

/**
* 是否为长连接服务
* {@inheritDoc}
*/
public function isLongConnection(): bool
{
return false;
}

/**
* 绑定服务器事件.
* {@inheritDoc}
*/
protected function bindEvents(): void
{
Expand Down Expand Up @@ -93,7 +93,7 @@ protected function bindEvents(): void
}

/**
* 获取实例化 Worker 用的协议.
* {@inheritDoc}
*/
protected function getWorkerScheme(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Listener/AfterClose.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AfterClose implements IEventListener
use TConnectionContextRelease;

/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Listener/OnCloseByFlagRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class OnCloseByFlagRequest implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Listener/OnSendRawByFlagRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class OnSendRawByFlagRequest implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Listener/OnSendRawToAllRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class OnSendRawToAllRequest implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Listener/OnSendRawToGroupRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class OnSendRawToGroupRequest implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Tcp/Listener/BeforeReceive.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class BeforeReceive implements IEventListener
{
/**
* 事件处理方法.
* {@inheritDoc}
*/
public function handle(EventParam $e): void
{
Expand Down
Loading

0 comments on commit 88df621

Please sign in to comment.