From fb5849fd706dd76338047f2071562ecbd5584b14 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 21 May 2026 14:10:38 +0200 Subject: [PATCH 1/2] Most RunParams are readonly --- src/Ssh/RunParams.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Ssh/RunParams.php b/src/Ssh/RunParams.php index 1cd2602f9..a4da5fe72 100644 --- a/src/Ssh/RunParams.php +++ b/src/Ssh/RunParams.php @@ -9,15 +9,15 @@ class RunParams * @param array|null $secrets */ public function __construct( - public ?string $shell = null, - public ?string $cwd = null, - public ?array $env = null, + public readonly ?string $shell = null, + public readonly ?string $cwd = null, + public readonly ?array $env = null, public ?string $dotenv = null, - public bool $nothrow = false, + public readonly bool $nothrow = false, public ?int $timeout = null, public bool $killOnTimeout = true, - public ?int $idleTimeout = null, - public bool $forceOutput = false, + public readonly ?int $idleTimeout = null, + public readonly bool $forceOutput = false, #[\SensitiveParameter] public ?array $secrets = null, ) {} From a2167824db0462191e3995626c2c2431f3eb3bbb Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 21 May 2026 14:14:27 +0200 Subject: [PATCH 2/2] Update RunParams.php --- src/Ssh/RunParams.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Ssh/RunParams.php b/src/Ssh/RunParams.php index a4da5fe72..040d64324 100644 --- a/src/Ssh/RunParams.php +++ b/src/Ssh/RunParams.php @@ -14,12 +14,12 @@ public function __construct( public readonly ?array $env = null, public ?string $dotenv = null, public readonly bool $nothrow = false, - public ?int $timeout = null, - public bool $killOnTimeout = true, + public readonly ?int $timeout = null, + public readonly bool $killOnTimeout = true, public readonly ?int $idleTimeout = null, public readonly bool $forceOutput = false, #[\SensitiveParameter] - public ?array $secrets = null, + public readonly ?array $secrets = null, ) {} /** @@ -31,10 +31,17 @@ public function with( ?int $timeout = null, ?bool $killOnTimeout = null, ): self { - $params = clone $this; - $params->secrets = array_merge($params->secrets ?? [], $secrets ?? []); - $params->timeout = $timeout ?? $params->timeout; - $params->killOnTimeout = $killOnTimeout ?? $params->killOnTimeout; - return $params; + return new self( + $this->shell, + $this->cwd, + $this->env, + $this->dotenv, + $this->nothrow, + $timeout ?? $this->timeout, + $killOnTimeout ?? $this->killOnTimeout, + $this->idleTimeout, + $this->forceOutput, + array_merge($this->secrets ?? [], $secrets ?? []), + ); } }