@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @param Query $query |
18 | 18 | */ |
19 | - public function __invoke(array|null $query = null): ResourceObject; |
|
19 | + public function __invoke(array | null $query = null): ResourceObject; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Set query |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
44 | 44 | |
45 | 45 | // Filter out framework internal calls to focus on user code |
46 | - $filtered = array_filter($backtrace, static function (array $frame): bool { |
|
47 | - if (! isset($frame['file'])) { |
|
46 | + $filtered = array_filter($backtrace, static function(array $frame): bool { |
|
47 | + if (!isset($frame['file'])) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Skip vendor files except user application |
57 | - if (str_contains($frame['file'], '/vendor/') && ! str_contains($frame['file'], '/tests/')) { |
|
57 | + if (str_contains($frame['file'], '/vendor/') && !str_contains($frame['file'], '/tests/')) { |
|
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Skip PHPUnit test framework files |
62 | - return ! str_contains($frame['file'], '/phpunit/'); |
|
62 | + return !str_contains($frame['file'], '/phpunit/'); |
|
63 | 63 | }); |
64 | 64 | |
65 | 65 | // Reset array keys and limit results |
66 | 66 | $result = array_slice(array_values($filtered), 0, $limit); |
67 | 67 | |
68 | 68 | // Clean up the frames to only include relevant information |
69 | - return array_map(static function (array $frame): array { |
|
69 | + return array_map(static function(array $frame): array { |
|
70 | 70 | $clean = ['function' => $frame['function']]; |
71 | 71 | |
72 | 72 | if (isset($frame['file'])) { |
@@ -46,6 +46,6 @@ |
||
46 | 46 | $crc = crc32($this->exceptionAsString); |
47 | 47 | $crcHex = dechex($crc & 0xFFFFFFFF); // Ensure positive hex value |
48 | 48 | |
49 | - return 'e-bear-resource-' . $crcHex; |
|
49 | + return 'e-bear-resource-'.$crcHex; |
|
50 | 50 | } |
51 | 51 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public static function start(): self |
34 | 34 | { |
35 | - if (! function_exists('xhprof_enable')) { |
|
35 | + if (!function_exists('xhprof_enable')) { |
|
36 | 36 | return new self(); // @codeCoverageIgnore |
37 | 37 | } |
38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function stop(string $uri): self |
49 | 49 | { |
50 | - if ($this->profileId === null || ! function_exists('xhprof_disable')) { |
|
50 | + if ($this->profileId === null || !function_exists('xhprof_disable')) { |
|
51 | 51 | return new self(); // @codeCoverageIgnore |
52 | 52 | } |
53 | 53 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $crc = crc32($this->exceptionAsString); |
67 | 67 | $crcHex = dechex($crc & 0xFFFFFFFF); // Ensure positive hex value |
68 | 68 | |
69 | - return 'e-bear-resource-' . $crcHex; |
|
69 | + return 'e-bear-resource-'.$crcHex; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** @return array<string, mixed> */ |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public static function start(): self |
38 | 38 | { |
39 | - if (! extension_loaded('xdebug') || ! function_exists('xdebug_start_trace')) { |
|
39 | + if (!extension_loaded('xdebug') || !function_exists('xdebug_start_trace')) { |
|
40 | 40 | return new self(); // @codeCoverageIgnore |
41 | 41 | } |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $envMode = getenv('XDEBUG_MODE'); |
45 | 45 | $iniMode = ini_get('xdebug.mode'); |
46 | 46 | $xdebugMode = $envMode !== false ? $envMode : ($iniMode !== false ? $iniMode : ''); |
47 | - if (! str_contains($xdebugMode, 'trace')) { |
|
47 | + if (!str_contains($xdebugMode, 'trace')) { |
|
48 | 48 | return new self(); // @codeCoverageIgnore |
49 | 49 | } |
50 | 50 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $outputDir = sys_get_temp_dir(); // @codeCoverageIgnore |
64 | 64 | } |
65 | 65 | |
66 | - $traceFilePrefix = rtrim($outputDir, '/') . '/' . $instance->traceId; |
|
66 | + $traceFilePrefix = rtrim($outputDir, '/').'/'.$instance->traceId; |
|
67 | 67 | xdebug_start_trace($traceFilePrefix); // @codeCoverageIgnore |
68 | 68 | |
69 | 69 | // Note: Return value is void, trace may fail silently if already started elsewhere |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | public function stop(): self |
74 | 74 | { |
75 | - if (! $this->canStopTrace()) { |
|
75 | + if (!$this->canStopTrace()) { |
|
76 | 76 | return new self(); // @codeCoverageIgnore |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | private function canStopTrace(): bool |
83 | 83 | { |
84 | - if (! function_exists('xdebug_stop_trace')) { |
|
84 | + if (!function_exists('xdebug_stop_trace')) { |
|
85 | 85 | return false; // @codeCoverageIgnore |
86 | 86 | } |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $iniMode = ini_get('xdebug.mode'); |
91 | 91 | $xdebugMode = $envMode !== false ? $envMode : ($iniMode !== false ? $iniMode : ''); |
92 | 92 | |
93 | - if (! str_contains($xdebugMode, 'trace')) { |
|
93 | + if (!str_contains($xdebugMode, 'trace')) { |
|
94 | 94 | return false; // @codeCoverageIgnore |
95 | 95 | } |
96 | 96 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | // Try to stop trace and get the trace file path |
109 | 109 | // Suppress "Function trace was not started" error for graceful handling |
110 | - set_error_handler(static function (int $errno, string $errstr): bool { |
|
110 | + set_error_handler(static function(int $errno, string $errstr): bool { |
|
111 | 111 | // Ignore specific xdebug trace errors (only handle E_NOTICE) |
112 | 112 | return $errno === E_NOTICE && str_contains($errstr, 'Function trace was not started'); |
113 | 113 | }); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | restore_error_handler(); |
121 | 121 | } |
122 | 122 | |
123 | - if ($traceFile === false || ! is_string($traceFile) || ! file_exists($traceFile)) { |
|
123 | + if ($traceFile === false || !is_string($traceFile) || !file_exists($traceFile)) { |
|
124 | 124 | return new self(); // @codeCoverageIgnore |
125 | 125 | } |
126 | 126 |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | $logDirectory = $argv[1] ?? null; |
14 | 14 | |
15 | -if (! $logDirectory) { |
|
15 | +if (!$logDirectory) { |
|
16 | 16 | fwrite(STDERR, "Usage: php server.php <log-directory>\n"); |
17 | 17 | exit(1); |
18 | 18 | } |
19 | 19 | |
20 | -if (! is_dir($logDirectory)) { |
|
20 | +if (!is_dir($logDirectory)) { |
|
21 | 21 | fwrite(STDERR, "Directory not found: $logDirectory\n"); |
22 | 22 | exit(1); |
23 | 23 | } |
24 | 24 | |
25 | 25 | // Find the latest semantic log file |
26 | -$pattern = rtrim($logDirectory, '/') . '/semantic-dev-*.json'; |
|
26 | +$pattern = rtrim($logDirectory, '/').'/semantic-dev-*.json'; |
|
27 | 27 | $files = glob($pattern); |
28 | 28 | |
29 | 29 | if (empty($files)) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | while ($line = fgets(STDIN)) { |
45 | 45 | $request = json_decode(trim($line), true); |
46 | 46 | |
47 | - if (! $request) { |
|
47 | + if (!$request) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ] |
108 | 108 | }; |
109 | 109 | |
110 | - fwrite(STDOUT, json_encode($response) . "\n"); |
|
110 | + fwrite(STDOUT, json_encode($response)."\n"); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | function getLog(string $file): array |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | 'content' => [ |
144 | 144 | [ |
145 | 145 | 'type' => 'text', |
146 | - 'text' => 'Unknown tool: ' . $toolName, |
|
146 | + 'text' => 'Unknown tool: '.$toolName, |
|
147 | 147 | ], |
148 | 148 | ], |
149 | 149 | 'isError' => true, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $script = $args['script'] ?? ''; |
156 | 156 | $xdebugMode = $args['xdebug_mode'] ?? 'trace'; |
157 | 157 | |
158 | - if (! $script) { |
|
158 | + if (!$script) { |
|
159 | 159 | return [ |
160 | 160 | 'content' => [ |
161 | 161 | [ |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ]; |
168 | 168 | } |
169 | 169 | |
170 | - if (! file_exists($script)) { |
|
170 | + if (!file_exists($script)) { |
|
171 | 171 | return [ |
172 | 172 | 'content' => [ |
173 | 173 | [ |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | |
185 | 185 | // Execute the PHP script with profiling using php-dev.ini |
186 | 186 | $env = "XDEBUG_MODE=$xdebugMode XDEBUG_CONFIG='compression_level=0'"; |
187 | - $phpDevIni = __DIR__ . '/php-dev.ini'; |
|
188 | - $command = "$env php -c " . escapeshellarg($phpDevIni) . " " . escapeshellarg($script) . ' 2>&1'; |
|
187 | + $phpDevIni = __DIR__.'/php-dev.ini'; |
|
188 | + $command = "$env php -c ".escapeshellarg($phpDevIni)." ".escapeshellarg($script).' 2>&1'; |
|
189 | 189 | |
190 | 190 | $output = shell_exec($command); |
191 | 191 | |
192 | 192 | // Find semantic log files created during script execution |
193 | 193 | $logDirectory = $GLOBALS['logDirectory']; |
194 | - $pattern = rtrim($logDirectory, '/') . '/semantic-dev-*.json'; |
|
194 | + $pattern = rtrim($logDirectory, '/').'/semantic-dev-*.json'; |
|
195 | 195 | |
196 | 196 | $files = glob($pattern); |
197 | 197 | $newLogFiles = array_filter($files, static fn ($file) => filemtime($file) >= $beforeExecution); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | 'content' => [ |
220 | 220 | [ |
221 | 221 | 'type' => 'text', |
222 | - 'text' => "Script executed successfully.\nLog file: $executionLog\n\nSemantic Log Data:\n" . json_encode($logData, JSON_PRETTY_PRINT), |
|
222 | + 'text' => "Script executed successfully.\nLog file: $executionLog\n\nSemantic Log Data:\n".json_encode($logData, JSON_PRETTY_PRINT), |
|
223 | 223 | ], |
224 | 224 | ], |
225 | 225 | 'isError' => false, |