1616use Laminas \Log \Writer \Db ;
1717use Laminas \Mail \Message ;
1818use Laminas \Mail \Transport \TransportInterface ;
19+ use Laminas \Stdlib \ParametersInterface ;
1920use Laminas \Stdlib \RequestInterface ;
2021use RuntimeException ;
2122use 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