Skip to content

Commit

Permalink
Update: 格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Oct 18, 2023
1 parent 7c42c06 commit bc13e06
Show file tree
Hide file tree
Showing 78 changed files with 178 additions and 193 deletions.
2 changes: 1 addition & 1 deletion src/Aop/AfterThrowingJoinPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AfterThrowingJoinPoint extends JoinPoint
public function __construct(string $type, string $method, array &$args, object $target, /**
* 异常.
*/
private readonly ?\Throwable $throwable)
private readonly ?\Throwable $throwable)
{
parent::__construct($type, $method, $args, $target);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Aop/JoinPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class JoinPoint
public function __construct(/**
* 切入点类型.
*/
protected string $type, /**
protected string $type, /**
* 获取切入的方法名.
*/
protected string $method, array &$args, /**
protected string $method, array &$args, /**
* 连接点所在的目标对象
*/
protected ?object $target)
protected ?object $target)
{
$this->args = &$args;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Annotation/Model/ClassAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public function __construct(
* 类名.
*/
private readonly string $className
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Annotation/Model/ClassAnnotationRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public function __construct(
* 注解.
*/
private readonly ?Base $annotation
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Annotation/Model/ConstantAnnotationRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
* 注解.
*/
private readonly ?Base $annotation
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Annotation/Model/MethodAnnotationRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
* 注解.
*/
private readonly ?Base $annotation
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Annotation/Model/PropertyAnnotationRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
* 注解.
*/
private readonly ?Base $annotation
)
{
) {
}

/**
Expand Down
13 changes: 7 additions & 6 deletions src/Bean/BeanProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,14 @@ private static function &callOrigin(object $object, string $className, string $m
*/
private static function doAspect(string $className, string $method, string $pointType, callable $callback): void
{
$items = match ($pointType) {
'Before' => AopManager::getBeforeItems($className, $method),
'After' => AopManager::getAfterItems($className, $method),
'Around' => AopManager::getAroundItems($className, $method),
$items = match ($pointType)
{
'Before' => AopManager::getBeforeItems($className, $method),
'After' => AopManager::getAfterItems($className, $method),
'Around' => AopManager::getAroundItems($className, $method),
'AfterReturning' => AopManager::getAfterReturningItems($className, $method),
'AfterThrowing' => AopManager::getAfterThrowingItems($className, $method),
default => throw new \RuntimeException(sprintf('Unknown pointType %s', $pointType)),
'AfterThrowing' => AopManager::getAfterThrowingItems($className, $method),
default => throw new \RuntimeException(sprintf('Unknown pointType %s', $pointType)),
};
if ($items)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bean/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public function __construct(
* @var array[]|callable[]
*/
private array $binds = []
)
{
) {
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Cli/ImiArgvInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ public function getParameterOption($values, $default = false, bool $onlyParams =

/**
* Returns a stringified representation of the args passed to the command.
*
* @return string
*/
public function __toString(): string
{
Expand Down
12 changes: 6 additions & 6 deletions src/Cli/ImiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ public function getMethodName(): string
public function __construct(/**
* 命令名称.
*/
protected ?string $commandName, /**
protected ?string $commandName, /**
* 命令动作名称.
*/
protected string $actionName, /**
protected string $actionName, /**
* 类名.
*/
protected string $className, /**
protected string $className, /**
* 方法名.
*/
protected string $methodName, /**
protected string $methodName, /**
* 是否启用动态参数支持.
*/
protected bool $dynamicOptions = false, /**
protected bool $dynamicOptions = false, /**
* 命令名称分割符.
*/
protected string $separator = '/')
protected string $separator = '/')
{
$actionName = '' === $actionName ? $methodName : $actionName;

Expand Down
3 changes: 1 addition & 2 deletions src/Core/App/Contract/BaseApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function __construct(
* 命名空间.
*/
protected string $namespace
)
{
) {
}

protected function __loadConfig(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Cron/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Client
public function __construct(/**
* 配置项.
*/
private readonly array $options = [])
private readonly array $options = [])
{
if (!isset($options['socketFile']))
{
Expand Down
18 changes: 9 additions & 9 deletions src/Cron/CronTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,36 @@ class CronTask
public function __construct(/**
* 任务唯一ID.
*/
private readonly string $id, /**
private readonly string $id, /**
* 任务类型.
*
* \Imi\Cron\Consts\CronTaskType 类常量
*/
private readonly string $type, $task, array $cronRules, /**
private readonly string $type, $task, array $cronRules, /**
* 数据.
*/
private $data, /**
private $data, /**
* 最大运行执行时间,单位:秒。该值与分布式锁超时时间共享.
*/
private readonly float $maxExecutionTime = 3, /**
private readonly float $maxExecutionTime = 3, /**
* 定时任务唯一性设置
* 当前实例唯一: current
* 所有实例唯一: all
* 不唯一: null.
*/
private readonly ?string $unique = null, /**
private readonly ?string $unique = null, /**
* 用于锁的 `Redis` 连接池名.
*/
private readonly ?string $redisPool = null, /**
private readonly ?string $redisPool = null, /**
* 获取锁超时时间,单位:秒.
*/
private readonly float $lockWaitTimeout = 3, /**
private readonly float $lockWaitTimeout = 3, /**
* 每次启动服务强制执行.
*/
private readonly bool $force = false, /**
private readonly bool $force = false, /**
* 是否记录成功日志.
*/
private readonly bool $successLog = true)
private readonly bool $successLog = true)
{
$this->task = $task;
$this->cronRules = $this->parseCronRule($cronRules);
Expand Down
3 changes: 1 addition & 2 deletions src/Cron/Message/CommonMsg.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
* 从socket获取的返回信息.
*/
protected $response = []
)
{
) {
}

/**
Expand Down
13 changes: 7 additions & 6 deletions src/Cron/Message/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@ class Result implements IMessage
public function __construct(/**
* 动作.
*/
public string $action, /**
public string $action, /**
* 定时任务ID.
*/
public string $id, /**
public string $id, /**
* 是否成功
*/
public bool $success, /**
public bool $success, /**
* 消息.
*/
public string $message)
public string $message)
{
$this->processType = App::get(ProcessAppContexts::PROCESS_TYPE);
$this->processId = match ($this->processType) {
$this->processId = match ($this->processType)
{
ProcessType::WORKER, ProcessType::TASK_WORKER => (string) Worker::getWorkerId(),
ProcessType::PROCESS => App::get(ProcessAppContexts::PROCESS_NAME) . '#' . Worker::getWorkerId(),
default => throw new \InvalidArgumentException(sprintf('Invalid process type %s', $this->processType)),
default => throw new \InvalidArgumentException(sprintf('Invalid process type %s', $this->processType)),
};
}
}
3 changes: 1 addition & 2 deletions src/Db/Drivers/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
* 连接配置.
*/
protected array $option = []
)
{
) {
}

/**
Expand Down
18 changes: 10 additions & 8 deletions src/Db/Mysql/Drivers/Mysqli/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class Statement extends MysqlBaseStatement implements IMysqlStatement
public function __construct(/**
* 数据库操作对象
*/
protected ?IMysqlDb $db, protected ?\mysqli_stmt $statement, ?\mysqli_result $result, /**
protected ?IMysqlDb $db, protected ?\mysqli_stmt $statement, ?\mysqli_result $result, /**
* 最后执行过的SQL语句.
*/
protected string $lastSql, /**
protected string $lastSql, /**
* SQL 参数映射.
*/
protected ?array $sqlParamsMap = null)
protected ?array $sqlParamsMap = null)
{
$this->result = $result;
}
Expand Down Expand Up @@ -188,12 +188,14 @@ public function execute(array $inputParameters = null): bool
public function fetch(int $fetchStyle = \PDO::FETCH_ASSOC, int $cursorOrientation = \PDO::FETCH_ORI_NEXT, int $cursorOffset = 0)
{
$result = $this->result;
return match ($fetchStyle) {

return match ($fetchStyle)
{
\PDO::FETCH_ASSOC => $result->fetch_assoc(),
\PDO::FETCH_BOTH => $result->fetch_array(),
\PDO::FETCH_NUM => $result->fetch_array(\MYSQLI_NUM),
\PDO::FETCH_OBJ => $result->fetch_object(),
default => throw new DbException(sprintf('Not support fetchStyle %s', $fetchStyle)),
\PDO::FETCH_BOTH => $result->fetch_array(),
\PDO::FETCH_NUM => $result->fetch_array(\MYSQLI_NUM),
\PDO::FETCH_OBJ => $result->fetch_object(),
default => throw new DbException(sprintf('Not support fetchStyle %s', $fetchStyle)),
};
}

Expand Down
3 changes: 1 addition & 2 deletions src/Db/Mysql/Query/FullText/MysqlFullTextOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
* 搜索修饰符.
*/
protected string $searchModifier = ''
)
{
) {
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Pool/DbResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DbResource extends BasePoolResource
public function __construct(\Imi\Pool\Interfaces\IPool $pool, /**
* db对象
*/
private ?IDb $db)
private ?IDb $db)
{
parent::__construct($pool);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Db/Query/Builder/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public function __construct(
* IQuery 类.
*/
protected ?IQuery $query
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Db/Query/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
* 别名.
*/
protected ?string $alias = null
)
{
) {
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Query/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Field extends Table implements IField
public function __construct(?string $database = null, ?string $table = null, /**
* 字段名.
*/
protected ?string $field = null, ?string $alias = null, string $prefix = '')
protected ?string $field = null, ?string $alias = null, string $prefix = '')
{
$this->database = $database;
$this->table = $table;
Expand Down
10 changes: 5 additions & 5 deletions src/Db/Query/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ class Join implements IJoin
public function __construct(IQuery $query, ?string $table = null, /**
* 在 join b on a.id=b.id 中的 a.id.
*/
protected ?string $left = null, /**
protected ?string $left = null, /**
* 在 join b on a.id=b.id 中的 =.
*/
protected ?string $operation = null, /**
protected ?string $operation = null, /**
* join b on a.id=b.id 中的 b.id.
*/
protected ?string $right = null, ?string $tableAlias = null, /**
protected ?string $right = null, ?string $tableAlias = null, /**
* where条件.
*/
protected ?IBaseWhere $where = null, /**
protected ?IBaseWhere $where = null, /**
* join类型,默认inner.
*/
protected string $type = 'inner')
protected string $type = 'inner')
{
$this->table = $thisTable = new Table();
if (null !== $table)
Expand Down
3 changes: 1 addition & 2 deletions src/Db/Query/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
* 排序方向:asc/desc.
*/
protected string $direction = 'asc'
)
{
) {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Db/Query/PaginateResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public function __construct(
* 自定义选项.
*/
protected array $options
)
{
) {
}

/**
Expand Down
Loading

0 comments on commit bc13e06

Please sign in to comment.