1616use CodeIgniter \HTTP \ResponseInterface ;
1717
1818/**
19- * Class ChromeLoggerHandler
20- *
2119 * Allows for logging items to the Chrome console for debugging.
2220 * Requires the ChromeLogger extension installed in your browser.
2321 *
@@ -41,7 +39,16 @@ class ChromeLoggerHandler extends BaseHandler
4139 /**
4240 * The final data that is sent to the browser.
4341 *
44- * @var array
42+ * @var array{
43+ * version: float,
44+ * columns: list<string>,
45+ * rows: list<array{
46+ * 0: list<string>,
47+ * 1: string,
48+ * 2: string,
49+ * }>,
50+ * request_uri?: string,
51+ * }
4552 */
4653 protected $ json = [
4754 'version ' => self ::VERSION ,
@@ -63,7 +70,7 @@ class ChromeLoggerHandler extends BaseHandler
6370 /**
6471 * Maps the log levels to the ChromeLogger types.
6572 *
66- * @var array
73+ * @var array<string, string>
6774 */
6875 protected $ levels = [
6976 'emergency ' => 'error ' ,
@@ -77,7 +84,7 @@ class ChromeLoggerHandler extends BaseHandler
7784 ];
7885
7986 /**
80- * Constructor
87+ * @param array{handles?: list<string>} $config
8188 */
8289 public function __construct (array $ config = [])
8390 {
@@ -97,10 +104,8 @@ public function __construct(array $config = [])
97104 */
98105 public function handle ($ level , $ message ): bool
99106 {
100- // Format our message
101107 $ message = $ this ->format ($ message );
102108
103- // Generate Backtrace info
104109 $ backtrace = debug_backtrace (0 , $ this ->backtraceLevel );
105110 $ backtrace = end ($ backtrace );
106111
@@ -116,11 +121,7 @@ public function handle($level, $message): bool
116121 $ type = $ this ->levels [$ level ];
117122 }
118123
119- $ this ->json ['rows ' ][] = [
120- [$ message ],
121- $ backtraceMessage ,
122- $ type ,
123- ];
124+ $ this ->json ['rows ' ][] = [[$ message ], $ backtraceMessage , $ type ];
124125
125126 $ this ->sendLogs ();
126127
@@ -130,9 +131,9 @@ public function handle($level, $message): bool
130131 /**
131132 * Converts the object to display nicely in the Chrome Logger UI.
132133 *
133- * @param array|int| object|string $object
134+ * @param object|string $object
134135 *
135- * @return array
136+ * @return array<string, mixed>|string
136137 */
137138 protected function format ($ object )
138139 {
0 commit comments