Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Oct 13, 2023
1 parent 586b0dc commit 9b31848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Support/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function jsonResource(JsonResource $resource): array
/**
* Format data.
*
* @param $data
* @param $data
* @return array|object
*/
protected function formatData($data): array|object
Expand Down Expand Up @@ -136,7 +136,7 @@ protected function formatMessage(int $code, string $message = ''): ?string
$localizationKey = join('.', [Config::get('response.locale', 'enums'), $code]);

return match (true) {
!$message && Lang::has($localizationKey) => Lang::get($localizationKey),
! $message && Lang::has($localizationKey) => Lang::get($localizationKey),
default => $message
};
}
Expand Down Expand Up @@ -171,7 +171,7 @@ protected function formatStatus(int $statusCode): string
* Http status code.
*
* @param int $code
* @param $oriData
* @param $oriData
* @return int
*/
protected function formatStatusCode(int $code, $oriData): int
Expand Down Expand Up @@ -260,7 +260,7 @@ protected function formatDataFields(array $data): array
$formatConfig = \config('response.format.config', []);

foreach ($formatConfig as $key => $config) {
if (!Arr::has($data, $key)) {
if (! Arr::has($data, $key)) {
continue;
}

Expand All @@ -273,7 +273,7 @@ protected function formatDataFields(array $data): array
$key = $alias;
}

if (!$show) {
if (! $show) {
$data = Arr::except($data, $key);
}
}
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/FailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Jiannei\Response\Laravel\Support\Facades\Response;
use Jiannei\Response\Laravel\Tests\Enums\ResponseEnum;


test('fail', function () {
try {
// 方式一:Controller 中直接返回失败,这里本质上是通过 JsonResponse 是抛出了一个 HttpResponseException,需要捕获异常后才能拿到真实响应
Expand Down Expand Up @@ -67,4 +66,4 @@
'error' => (object) [],
]));
}
});
});

0 comments on commit 9b31848

Please sign in to comment.