diff --git a/inc/Workspace/WorkspaceCoreUtilities.php b/inc/Workspace/WorkspaceCoreUtilities.php index 4153e1d..e4aafb8 100644 --- a/inc/Workspace/WorkspaceCoreUtilities.php +++ b/inc/Workspace/WorkspaceCoreUtilities.php @@ -692,7 +692,7 @@ private function build_primary_freshness_report( string $repo_path, string $hand ); } - return $this->build_primary_freshness_report_from_status_output((string) ( $status_result['output'] ?? '' ), $handle); + return $this->build_primary_freshness_report_from_status_output(( string ) ( $status_result['output'] ?? '' ), $handle); } /** diff --git a/inc/Workspace/WorkspaceRepositoryLifecycle.php b/inc/Workspace/WorkspaceRepositoryLifecycle.php index e304b7b..c7aff09 100644 --- a/inc/Workspace/WorkspaceRepositoryLifecycle.php +++ b/inc/Workspace/WorkspaceRepositoryLifecycle.php @@ -754,10 +754,10 @@ public function show_repo( string $handle ): array|\WP_Error { if ( empty($inspection['exists']) && null === $context_policy ) { $resolved_handle = $this->resolve_primary_repo_name($handle); if ( ! is_wp_error($resolved_handle) && $resolved_handle !== $handle ) { - $handle = $resolved_handle; - $parsed = $this->parse_handle($handle); - $repo_path = $this->workspace_path . '/' . $parsed['dir_name']; - $inspection = WorkspaceTargetInspector::inspect($repo_path, $parsed['dir_name']); + $handle = $resolved_handle; + $parsed = $this->parse_handle($handle); + $repo_path = $this->workspace_path . '/' . $parsed['dir_name']; + $inspection = WorkspaceTargetInspector::inspect($repo_path, $parsed['dir_name']); if ( is_wp_error($inspection) ) { return $inspection; } @@ -780,7 +780,7 @@ public function show_repo( string $handle ): array|\WP_Error { 'commit' => $inspection['commit'] ?? null, 'dirty' => (int) ( $inspection['dirty'] ?? 0 ), 'primary_freshness' => ! $parsed['is_worktree'] && is_string($inspection['branch_status'] ?? null) - ? $this->build_primary_freshness_report_from_status_output((string) $inspection['branch_status'], $parsed['dir_name']) + ? $this->build_primary_freshness_report_from_status_output(( string ) $inspection['branch_status'], $parsed['dir_name']) : null, ); if ( null !== $context_policy ) { diff --git a/inc/Workspace/WorkspaceTargetInspector.php b/inc/Workspace/WorkspaceTargetInspector.php index 11c34e2..1021d9a 100644 --- a/inc/Workspace/WorkspaceTargetInspector.php +++ b/inc/Workspace/WorkspaceTargetInspector.php @@ -52,7 +52,7 @@ public static function inspect( string $path, string $handle ): array|\WP_Error $result = ProcessRunner::run( $command, array( - 'timeout_seconds' => $timeout, + 'timeout_seconds' => $timeout, 'separate_streams' => true, 'output_cap_bytes' => 32768, 'error_code' => 'workspace_target_lookup_failed', @@ -81,7 +81,7 @@ public static function inspect( string $path, string $handle ): array|\WP_Error ); } - $decoded = json_decode((string) ( $result['stdout'] ?? '' ), true); + $decoded = json_decode(( string ) ( $result['stdout'] ?? '' ), true); if ( ! is_array($decoded) ) { return new \WP_Error( 'workspace_target_lookup_invalid_response', diff --git a/inc/Workspace/workspace-target-probe.php b/inc/Workspace/workspace-target-probe.php index 30210e5..65b74a9 100644 --- a/inc/Workspace/workspace-target-probe.php +++ b/inc/Workspace/workspace-target-probe.php @@ -9,7 +9,7 @@ exit(2); } -$path = (string) $argv[1]; +$workspace_path = (string) $argv[1]; $filesystem_probe = (string) ( $argv[2] ?? '' ); $git_command = (string) ( $argv[3] ?? 'git' ); @@ -18,10 +18,10 @@ $output = array(); $exit = 0; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec -- Injected read-only probe remains outer-deadline-controlled. - exec($filesystem_probe . ' ' . escapeshellarg($path), $output, $exit); + exec($filesystem_probe . ' ' . escapeshellarg($workspace_path), $output, $exit); $exists = 0 === $exit && '1' === trim(implode("\n", $output)); } else { - $exists = is_dir($path); + $exists = is_dir($workspace_path); } if ( ! $exists ) { fwrite(STDOUT, json_encode(array( 'exists' => false ), JSON_UNESCAPED_SLASHES)); @@ -29,9 +29,9 @@ } /** @return string|null */ -$git_probe = static function ( string $operation, string $args ) use ( $path, $git_command ): ?string { +$git_probe = static function ( string $operation, string $args ) use ( $workspace_path, $git_command ): ?string { fwrite(STDERR, 'DMC_BOUNDARY:git:' . $operation . "\n"); - $command = $git_command . ' --no-optional-locks -C ' . escapeshellarg($path) . ' ' . $args . ' 2>&1'; + $command = $git_command . ' --no-optional-locks -C ' . escapeshellarg($workspace_path) . ' ' . $args . ' 2>&1'; $output = array(); $exit = 0; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec -- Isolated, outer-deadline-controlled read-only probe.