Skip to content

Commit 97534c4

Browse files
author
Chris Huber
committed
style: satisfy workspace probe lint
1 parent 3a97cd3 commit 97534c4

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

inc/Workspace/WorkspaceCoreUtilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ private function build_primary_freshness_report( string $repo_path, string $hand
692692
);
693693
}
694694

695-
return $this->build_primary_freshness_report_from_status_output((string) ( $status_result['output'] ?? '' ), $handle);
695+
return $this->build_primary_freshness_report_from_status_output(( string ) ( $status_result['output'] ?? '' ), $handle);
696696
}
697697

698698
/**

inc/Workspace/WorkspaceRepositoryLifecycle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,10 @@ public function show_repo( string $handle ): array|\WP_Error {
754754
if ( empty($inspection['exists']) && null === $context_policy ) {
755755
$resolved_handle = $this->resolve_primary_repo_name($handle);
756756
if ( ! is_wp_error($resolved_handle) && $resolved_handle !== $handle ) {
757-
$handle = $resolved_handle;
758-
$parsed = $this->parse_handle($handle);
759-
$repo_path = $this->workspace_path . '/' . $parsed['dir_name'];
760-
$inspection = WorkspaceTargetInspector::inspect($repo_path, $parsed['dir_name']);
757+
$handle = $resolved_handle;
758+
$parsed = $this->parse_handle($handle);
759+
$repo_path = $this->workspace_path . '/' . $parsed['dir_name'];
760+
$inspection = WorkspaceTargetInspector::inspect($repo_path, $parsed['dir_name']);
761761
if ( is_wp_error($inspection) ) {
762762
return $inspection;
763763
}
@@ -780,7 +780,7 @@ public function show_repo( string $handle ): array|\WP_Error {
780780
'commit' => $inspection['commit'] ?? null,
781781
'dirty' => (int) ( $inspection['dirty'] ?? 0 ),
782782
'primary_freshness' => ! $parsed['is_worktree'] && is_string($inspection['branch_status'] ?? null)
783-
? $this->build_primary_freshness_report_from_status_output((string) $inspection['branch_status'], $parsed['dir_name'])
783+
? $this->build_primary_freshness_report_from_status_output(( string ) $inspection['branch_status'], $parsed['dir_name'])
784784
: null,
785785
);
786786
if ( null !== $context_policy ) {

inc/Workspace/WorkspaceTargetInspector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function inspect( string $path, string $handle ): array|\WP_Error
5252
$result = ProcessRunner::run(
5353
$command,
5454
array(
55-
'timeout_seconds' => $timeout,
55+
'timeout_seconds' => $timeout,
5656
'separate_streams' => true,
5757
'output_cap_bytes' => 32768,
5858
'error_code' => 'workspace_target_lookup_failed',
@@ -81,7 +81,7 @@ public static function inspect( string $path, string $handle ): array|\WP_Error
8181
);
8282
}
8383

84-
$decoded = json_decode((string) ( $result['stdout'] ?? '' ), true);
84+
$decoded = json_decode(( string ) ( $result['stdout'] ?? '' ), true);
8585
if ( ! is_array($decoded) ) {
8686
return new \WP_Error(
8787
'workspace_target_lookup_invalid_response',

inc/Workspace/workspace-target-probe.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
exit(2);
1010
}
1111

12-
$path = (string) $argv[1];
12+
$workspace_path = (string) $argv[1];
1313
$filesystem_probe = (string) ( $argv[2] ?? '' );
1414
$git_command = (string) ( $argv[3] ?? 'git' );
1515

@@ -18,20 +18,20 @@
1818
$output = array();
1919
$exit = 0;
2020
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec -- Injected read-only probe remains outer-deadline-controlled.
21-
exec($filesystem_probe . ' ' . escapeshellarg($path), $output, $exit);
21+
exec($filesystem_probe . ' ' . escapeshellarg($workspace_path), $output, $exit);
2222
$exists = 0 === $exit && '1' === trim(implode("\n", $output));
2323
} else {
24-
$exists = is_dir($path);
24+
$exists = is_dir($workspace_path);
2525
}
2626
if ( ! $exists ) {
2727
fwrite(STDOUT, json_encode(array( 'exists' => false ), JSON_UNESCAPED_SLASHES));
2828
exit(0);
2929
}
3030

3131
/** @return string|null */
32-
$git_probe = static function ( string $operation, string $args ) use ( $path, $git_command ): ?string {
32+
$git_probe = static function ( string $operation, string $args ) use ( $workspace_path, $git_command ): ?string {
3333
fwrite(STDERR, 'DMC_BOUNDARY:git:' . $operation . "\n");
34-
$command = $git_command . ' --no-optional-locks -C ' . escapeshellarg($path) . ' ' . $args . ' 2>&1';
34+
$command = $git_command . ' --no-optional-locks -C ' . escapeshellarg($workspace_path) . ' ' . $args . ' 2>&1';
3535
$output = array();
3636
$exit = 0;
3737
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec -- Isolated, outer-deadline-controlled read-only probe.

0 commit comments

Comments
 (0)