Skip to content

Commit

Permalink
修复 rector
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Oct 25, 2023
1 parent 5f4c642 commit bcee8c4
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Bean/Annotation/Model/ClassAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getClassAnnotations(): array
*/
public function addClassAnnotations(array $classAnnotations): self
{
$this->classAnnotations = array_merge($this->classAnnotations, $classAnnotations);
$this->classAnnotations = [...$this->classAnnotations, ...$classAnnotations];

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function run(): void
}
$this->excludePaths[] = Imi::getRuntimePath();
Log::info('Process [hotUpdate] start');
$monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths);
$monitor = App::newInstance($this->monitorClass, [...$this->defaultPath, ...$this->includePaths], $this->excludePaths);
$time = 0;
$this->initBuildRuntime();
/** @phpstan-ignore-next-line */
Expand Down
2 changes: 1 addition & 1 deletion src/Components/swoole/src/HotUpdate/HotUpdateProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function run(\Swoole\Process $process): void
}
$this->excludePaths[] = Imi::getRuntimePath();
Log::info('Process [hotUpdate] start');
$monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths);
$monitor = App::newInstance($this->monitorClass, [...$this->defaultPath, ...$this->includePaths], $this->excludePaths);
$time = 0;
$this->initBuildRuntime();
$this->startBuildRuntimeTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function run(Worker $worker): void
}
$this->excludePaths[] = Imi::getRuntimePath();
Log::info('Process [hotUpdate] start');
$monitor = App::newInstance($this->monitorClass, array_merge($this->defaultPath, $this->includePaths), $this->excludePaths);
$monitor = App::newInstance($this->monitorClass, [...$this->defaultPath, ...$this->includePaths], $this->excludePaths);
$time = 0;
$this->initBuildRuntime();
/** @phpstan-ignore-next-line */
Expand Down
2 changes: 1 addition & 1 deletion src/Config/DotEnv/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ private static function process(array $entries)
{
/* @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry[],string> */
// @phpstan-ignore-next-line
return array_reduce($entries, static fn (Result $result, string $raw) => $result->flatMap(static fn (array $entries) => EntryParser::parse($raw)->map(static fn (Entry $entry) => array_merge($entries, [$entry]))), Success::create([]));
return array_reduce($entries, static fn (Result $result, string $raw) => $result->flatMap(static fn (array $entries) => EntryParser::parse($raw)->map(static fn (Entry $entry) => [...$entries, $entry])), Success::create([]));
}
}
2 changes: 1 addition & 1 deletion src/Cron/CronCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function getAllDay(string $day, int $lastTime): array
}
rsort($negatives, \SORT_NUMERIC);

return array_values(array_merge($list, $negatives));
return array_values([...$list, ...$negatives]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Db/Query/Where/WhereBrackets.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function toStringWithoutLogic(IQuery $query): string
{
$result .= ' ' . $callResultItem->getLogicalOperator() . ' ' . $callResultItem->toStringWithoutLogic($query);
}
$binds = array_merge($binds, $callResultItem->getBinds());
$binds = [...$binds, ...$callResultItem->getBinds()];
}
else
{
Expand All @@ -93,7 +93,7 @@ public function toStringWithoutLogic(IQuery $query): string
elseif ($callResult instanceof IBaseWhere)
{
$result = $callResult->toStringWithoutLogic($query);
$binds = array_merge($binds, $callResult->getBinds());
$binds = [...$binds, ...$callResult->getBinds()];

return '(' . $result . ')';
}
Expand Down
10 changes: 5 additions & 5 deletions src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ protected function __insert(mixed $data): IResult
// 子模型插入
ModelRelationManager::insertModel($this);
}
$this->__originData = array_merge($this->__originData, ObjectArrayHelper::toArray($data));
$this->__originData = [...$this->__originData, ...ObjectArrayHelper::toArray($data)];
$this->__recordExists = true;

return $result;
Expand Down Expand Up @@ -504,7 +504,7 @@ protected function __update(mixed $data): IResult
ModelRelationManager::updateModel($this);
}

$this->__originData = array_merge($this->__originData, ObjectArrayHelper::toArray($data));
$this->__originData = [...$this->__originData, ...ObjectArrayHelper::toArray($data)];

return $result;
}
Expand Down Expand Up @@ -572,7 +572,7 @@ public function save(): IResult
$this[$autoIncrementField] = $result->getLastInsertId();
}
}
$this->__originData = array_merge($this->__originData, ObjectArrayHelper::toArray($data));
$this->__originData = [...$this->__originData, ...ObjectArrayHelper::toArray($data)];
$this->__recordExists = true;

if ($isBean)
Expand Down Expand Up @@ -655,7 +655,7 @@ public function queryRelations(string ...$names): void
}
else
{
$this->__serializedFields = array_merge($this->__fieldNames, $names);
$this->__serializedFields = [...$this->__fieldNames, ...$names];
}
}

Expand All @@ -677,7 +677,7 @@ public static function queryRelationsList(iterable $list, string ...$names): ite
}
else
{
$__serializedFields = array_merge($model->__fieldNames, $names);
$__serializedFields = [...$model->__fieldNames, ...$names];
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Server/Http/Listener/HttpRouteInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function parseAnnotations(): void
/** @var Middleware $middleware */
foreach (AnnotationManager::getClassAnnotations($className, Middleware::class) as $middleware)
{
$classMiddlewares = array_merge($classMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$classMiddlewares = [...$classMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
foreach (AnnotationManager::getMethodsAnnotations($className, Action::class) as $methodName => $_)
{
Expand Down Expand Up @@ -99,11 +99,11 @@ protected function parseAnnotations(): void
/** @var Middleware $middleware */
foreach ($annotations[Middleware::class] as $middleware)
{
$methodMiddlewares = array_merge($methodMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$methodMiddlewares = [...$methodMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
}
// 最终中间件
$middlewares = array_values(array_unique(array_merge($classMiddlewares, $methodMiddlewares)));
$middlewares = array_values(array_unique([...$classMiddlewares, ...$methodMiddlewares]));

/** @var Route[] $routes */
foreach ($routes as $routeItem)
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Http/SuperGlobals/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function jsonSerialize()
}
if ($serverParams)
{
return array_merge($this->defaultServer, array_change_key_case($serverParams, \CASE_UPPER));
return [...$this->defaultServer, ...array_change_key_case($serverParams, \CASE_UPPER)];
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/Server/TcpServer/Listener/TcpRouteInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function parseAnnotations(EventParam $e): void
/** @var TcpMiddleware $middleware */
foreach (AnnotationManager::getClassAnnotations($className, TcpMiddleware::class) as $middleware)
{
$classMiddlewares = array_merge($classMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$classMiddlewares = [...$classMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
foreach (AnnotationManager::getMethodsAnnotations($className, TcpAction::class) as $methodName => $_)
{
Expand All @@ -77,10 +77,10 @@ private function parseAnnotations(EventParam $e): void
/** @var TcpMiddleware $middleware */
foreach ($annotations[TcpMiddleware::class] as $middleware)
{
$methodMiddlewares = array_merge($methodMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$methodMiddlewares = [...$methodMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
// 最终中间件
$middlewares = array_values(array_unique(array_merge($classMiddlewares, $methodMiddlewares)));
$middlewares = array_values(array_unique([...$classMiddlewares, ...$methodMiddlewares]));

foreach ($routes as $routeItem)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Server/UdpServer/Listener/UdpRouteInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function parseAnnotations(EventParam $e): void
/** @var UdpMiddleware $middleware */
foreach (AnnotationManager::getClassAnnotations($className, UdpMiddleware::class) as $middleware)
{
$classMiddlewares = array_merge($classMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$classMiddlewares = [...$classMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
foreach (AnnotationManager::getMethodsAnnotations($className, UdpAction::class) as $methodName => $methodItem)
{
Expand All @@ -81,10 +81,10 @@ private function parseAnnotations(EventParam $e): void
/** @var UdpMiddleware $middleware */
foreach ($annotations[UdpMiddleware::class] as $middleware)
{
$methodMiddlewares = array_merge($methodMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$methodMiddlewares = [...$methodMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
// 最终中间件
$middlewares = array_values(array_unique(array_merge($classMiddlewares, $methodMiddlewares)));
$middlewares = array_values(array_unique([...$classMiddlewares, ...$methodMiddlewares]));

foreach ($routes as $routeItem)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Server/WebSocket/Listener/WSRouteInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function parseAnnotations(EventParam $e): void
/** @var WSMiddleware $middleware */
foreach (AnnotationManager::getClassAnnotations($className, WSMiddleware::class) as $middleware)
{
$classMiddlewares = array_merge($classMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$classMiddlewares = [...$classMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
foreach (AnnotationManager::getMethodsAnnotations($className, WSAction::class) as $methodName => $_)
{
Expand All @@ -81,10 +81,10 @@ private function parseAnnotations(EventParam $e): void
/** @var WSMiddleware $middleware */
foreach ($annotations[WSMiddleware::class] as $middleware)
{
$methodMiddlewares = array_merge($methodMiddlewares, $this->getMiddlewares($middleware->middlewares, $name));
$methodMiddlewares = [...$methodMiddlewares, ...$this->getMiddlewares($middleware->middlewares, $name)];
}
// 最终中间件
$middlewares = array_values(array_unique(array_merge($classMiddlewares, $methodMiddlewares)));
$middlewares = array_values(array_unique([...$classMiddlewares, ...$methodMiddlewares]));

foreach ($routes as $routeItem)
{
Expand Down

0 comments on commit bcee8c4

Please sign in to comment.