Skip to content

Commit

Permalink
Add return type
Browse files Browse the repository at this point in the history
  • Loading branch information
kitloong committed Jun 27, 2024
1 parent 824a783 commit 5542b50
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/HttpLog/LogWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ public function log(Request $request, string $uniqId): void
Log::channel(config('app-logger.http.channel'))->info($message);
}

/**
* @return array{
* uniqid: string,
* method: string,
* uri: string,
* body: array<string, mixed>,
* headers: array<string, array<string>>,
* files: array<string>
* }
*/
protected function getMessages(Request $request, string $uniqId): array
{
$files = (new Collection(iterator_to_array($request->files)))
Expand Down
12 changes: 8 additions & 4 deletions src/PerformanceLog/LogWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ public function log(Request $request, $response, string $uniqId): void
}

/**
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Response $response
* @param string $uniqId
* @return array
* @return array{
* uniqid: string,
* method: string,
* uri: string,
* status: int,
* time: string,
* memory: string
* }
*/
protected function getMessages(Request $request, $response, string $uniqId): array
{
Expand Down
7 changes: 7 additions & 0 deletions src/QueryLog/LogWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public function log(): void
});
}

/**
* @return array{
* time: float,
* connection_name: string,
* sql: string
* }
*/
protected function getMessages(QueryExecuted $query): array
{
$sql = $query->sql;
Expand Down

0 comments on commit 5542b50

Please sign in to comment.