Skip to content

Commit a3c80e0

Browse files
committed
docblocks in Logging class
1 parent 2350f2a commit a3c80e0

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

src/Handler/Logging.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Laminas\Log\Writer\Db;
1717
use Laminas\Mail\Message;
1818
use Laminas\Mail\Transport\TransportInterface;
19+
use Laminas\Stdlib\ParametersInterface;
1920
use Laminas\Stdlib\RequestInterface;
2021
use RuntimeException;
2122
use Throwable;
@@ -96,18 +97,27 @@ private function getRequestData(RequestInterface $request): array
9697
}
9798

9899
Assert::isInstanceOf($request, HttpRequest::class);
99-
$queryData = $request->getQuery()->toArray();
100+
101+
/** @var ParametersInterface $query */
102+
$query = $request->getQuery();
103+
/** @var ParametersInterface $post */
104+
$post = $request->getPost();
105+
/** @var ParametersInterface $files*/
106+
$files = $request->getFiles();
107+
108+
$queryData = $query->toArray();
100109
$requestMethod = $request->getMethod();
101-
$bodyData = $request->getPost()->toArray();
110+
$bodyData = $post->toArray();
102111
$rawData = str_replace(PHP_EOL, '', (string) $request->getContent());
103112
$filesData = $this->includeFilesToAttachments
104-
? $request->getFiles()->toArray()
113+
? $files->toArray()
105114
: [];
106-
$cookie = $request->getCookie();
107-
$cookieData = $cookie instanceof Cookie
115+
116+
$cookie = $request->getCookie();
117+
$cookieData = $cookie instanceof Cookie
108118
? $cookie->getArrayCopy()
109119
: [];
110-
$ipAddress = (new RemoteAddress())->getIpAddress();
120+
$ipAddress = (new RemoteAddress())->getIpAddress();
111121

112122
return [
113123
'request_method' => $requestMethod,
@@ -121,7 +131,14 @@ private function getRequestData(RequestInterface $request): array
121131
}
122132

123133
/**
124-
* @return array<string, mixed>
134+
* @return array{
135+
* priority: int,
136+
* errorType: string,
137+
* errorFile: string,
138+
* errorLine: int,
139+
* trace: string,
140+
* errorMessage: string
141+
* }
125142
*/
126143
private function collectErrorExceptionData(Throwable $throwable): array
127144
{
@@ -250,8 +267,11 @@ private function sendMail(int $priority, string $errorMessage, array $extra, str
250267
public function handleErrorException(Throwable $throwable, RequestInterface $request): void
251268
{
252269
$collectedExceptionData = $this->collectErrorExceptionData($throwable);
253-
$extra = $this->collectErrorExceptionExtraData($collectedExceptionData, $request);
254-
$serverUrl = $extra[self::SERVER_URL];
270+
/**
271+
* @var array{url: string, server_url: string, mixed} $extra
272+
*/
273+
$extra = $this->collectErrorExceptionExtraData($collectedExceptionData, $request);
274+
$serverUrl = $extra[self::SERVER_URL];
255275

256276
try {
257277
if (

0 commit comments

Comments
 (0)