@@ -48,31 +48,30 @@ class DebugInfo
4848 /**
4949 * Create a new DebugInfo instance.
5050 *
51- * @param array<string, mixed> $requestData Request data (method, uri, headers, body)
52- * @param ResponseInterface|null $response The HTTP response
53- * @param array<string, float> $timings Timing information for the request
54- * @param array<string, mixed> $connectionStats Connection statistics
55- * @param int $memoryUsage Memory usage in bytes
51+ * @param array<string, mixed> $requestData Request data (method, uri, headers, body)
52+ * @param ResponseInterface|null $response The HTTP response
53+ * @param array<string, float> $timings Timing information for the request
54+ * @param array<string, mixed> $connectionStats Connection statistics
55+ * @param int $memoryUsage Memory usage in bytes
5656 */
5757 public function __construct (
5858 protected array $ requestData ,
5959 protected ?ResponseInterface $ response ,
6060 protected array $ timings = [],
6161 protected array $ connectionStats = [],
6262 protected int $ memoryUsage = 0 ,
63- ) {
64- }
63+ ) {}
6564
6665 /**
6766 * Create a DebugInfo instance from a request and response.
6867 *
69- * @param string $method HTTP method
70- * @param string $uri Request URI
71- * @param array<string, mixed> $options Request options including headers and body
72- * @param ResponseInterface|null $response The HTTP response
73- * @param array<string, float> $timings Timing information
74- * @param array<string, mixed> $connectionStats Connection statistics
75- * @param int $memoryUsage Memory usage in bytes
68+ * @param string $method HTTP method
69+ * @param string $uri Request URI
70+ * @param array<string, mixed> $options Request options including headers and body
71+ * @param ResponseInterface|null $response The HTTP response
72+ * @param array<string, float> $timings Timing information
73+ * @param array<string, mixed> $connectionStats Connection statistics
74+ * @param int $memoryUsage Memory usage in bytes
7675 */
7776 public static function create (
7877 string $ method ,
@@ -109,7 +108,7 @@ public static function getDefaultOptions(): array
109108 /**
110109 * Set default debug options.
111110 *
112- * @param array<string, mixed> $options
111+ * @param array<string, mixed> $options
113112 */
114113 public static function setDefaultOptions (array $ options ): void
115114 {
@@ -119,8 +118,7 @@ public static function setDefaultOptions(array $options): void
119118 /**
120119 * Sanitize options to redact sensitive information.
121120 *
122- * @param array<string, mixed> $options The options to sanitize
123- *
121+ * @param array<string, mixed> $options The options to sanitize
124122 * @return array<string, mixed> Sanitized options
125123 */
126124 protected static function sanitizeOptions (array $ options ): array
@@ -143,8 +141,7 @@ protected static function sanitizeOptions(array $options): array
143141 /**
144142 * Sanitize headers to redact sensitive information.
145143 *
146- * @param array<string, mixed> $headers The headers to sanitize
147- *
144+ * @param array<string, mixed> $headers The headers to sanitize
148145 * @return array<string, mixed> Sanitized headers
149146 */
150147 protected static function sanitizeHeaders (array $ headers ): array
@@ -213,8 +210,7 @@ public function getMemoryUsage(): int
213210 /**
214211 * Format the request information for output.
215212 *
216- * @param array<string, mixed> $options Output options
217- *
213+ * @param array<string, mixed> $options Output options
218214 * @return array<string, mixed>
219215 */
220216 public function formatRequest (array $ options = []): array
@@ -231,7 +227,7 @@ public function formatRequest(array $options = []): array
231227
232228 if ($ options ['request_body ' ]) {
233229 $ body = $ this ->requestData ['body ' ] ?? null ;
234- if (null !== $ body ) {
230+ if ($ body !== null ) {
235231 $ formatted ['body ' ] = $ this ->formatBody ($ body , $ options ['request_body ' ]);
236232 }
237233 }
@@ -242,13 +238,12 @@ public function formatRequest(array $options = []): array
242238 /**
243239 * Format the response information for output.
244240 *
245- * @param array<string, mixed> $options Output options
246- *
241+ * @param array<string, mixed> $options Output options
247242 * @return array<string, mixed>|null
248243 */
249244 public function formatResponse (array $ options = []): ?array
250245 {
251- if (null === $ this ->response ) {
246+ if ($ this ->response === null ) {
252247 return null ;
253248 }
254249
@@ -262,7 +257,7 @@ public function formatResponse(array $options = []): ?array
262257 $ formatted ['headers ' ] = self ::sanitizeHeaders ($ this ->response ->getHeaders ());
263258 }
264259
265- if (false !== $ options ['response_body ' ]) {
260+ if ($ options ['response_body ' ] !== false ) {
266261 $ body = (string ) $ this ->response ->getBody ();
267262 $ this ->response ->getBody ()->rewind ();
268263 $ formatted ['body ' ] = $ this ->formatBody ($ body , $ options ['response_body ' ]);
@@ -274,8 +269,7 @@ public function formatResponse(array $options = []): ?array
274269 /**
275270 * Get the debug information as an array.
276271 *
277- * @param array<string, mixed> $options Output options
278- *
272+ * @param array<string, mixed> $options Output options
279273 * @return array<string, mixed>
280274 */
281275 public function toArray (array $ options = []): array
@@ -285,11 +279,11 @@ public function toArray(array $options = []): array
285279 'request ' => $ this ->formatRequest ($ options ),
286280 ];
287281
288- if (null !== $ this ->response ) {
282+ if ($ this ->response !== null ) {
289283 $ result ['response ' ] = $ this ->formatResponse ($ options );
290284 }
291285
292- if ($ options ['timing ' ] && !empty ($ this ->timings )) {
286+ if ($ options ['timing ' ] && ! empty ($ this ->timings )) {
293287 $ result ['performance ' ] = $ this ->timings ;
294288 }
295289
@@ -300,7 +294,7 @@ public function toArray(array $options = []): array
300294 ];
301295 }
302296
303- if (!empty ($ this ->connectionStats )) {
297+ if (! empty ($ this ->connectionStats )) {
304298 $ result ['connection ' ] = $ this ->connectionStats ;
305299 }
306300
@@ -310,7 +304,7 @@ public function toArray(array $options = []): array
310304 /**
311305 * Get the debug information as a JSON string.
312306 *
313- * @param array<string, mixed> $options Output options
307+ * @param array<string, mixed> $options Output options
314308 */
315309 public function dump (array $ options = []): string
316310 {
@@ -320,12 +314,12 @@ public function dump(array $options = []): string
320314 /**
321315 * Format a body for output, optionally truncating.
322316 *
323- * @param mixed $body The body content
324- * @param bool|int $option True for full body, int for max bytes, false to disable
317+ * @param mixed $body The body content
318+ * @param bool|int $option True for full body, int for max bytes, false to disable
325319 */
326320 protected function formatBody (mixed $ body , bool |int $ option ): mixed
327321 {
328- if (false === $ option ) {
322+ if ($ option === false ) {
329323 return null ;
330324 }
331325
@@ -334,7 +328,7 @@ protected function formatBody(mixed $body, bool|int $option): mixed
334328 $ body = json_encode ($ body , JSON_PRETTY_PRINT );
335329 }
336330
337- if (!is_string ($ body )) {
331+ if (! is_string ($ body )) {
338332 return $ body ;
339333 }
340334
@@ -356,7 +350,7 @@ protected function formatBytes(int $bytes): string
356350
357351 while ($ bytes >= 1024 && $ unitIndex < count ($ units ) - 1 ) {
358352 $ bytes /= 1024 ;
359- ++ $ unitIndex ;
353+ $ unitIndex++ ;
360354 }
361355
362356 return round ($ bytes , 2 ).' ' .$ units [$ unitIndex ];
0 commit comments