@@ -9,17 +9,17 @@ class RunParams
99 * @param array<string, scalar>|null $secrets
1010 */
1111 public function __construct (
12- public ?string $ shell = null ,
13- public ?string $ cwd = null ,
14- public ?array $ env = null ,
12+ public readonly ?string $ shell = null ,
13+ public readonly ?string $ cwd = null ,
14+ public readonly ?array $ env = null ,
1515 public ?string $ dotenv = null ,
16- public bool $ nothrow = false ,
17- public ?int $ timeout = null ,
18- public bool $ killOnTimeout = true ,
19- public ?int $ idleTimeout = null ,
20- public bool $ forceOutput = false ,
16+ public readonly bool $ nothrow = false ,
17+ public readonly ?int $ timeout = null ,
18+ public readonly bool $ killOnTimeout = true ,
19+ public readonly ?int $ idleTimeout = null ,
20+ public readonly bool $ forceOutput = false ,
2121 #[\SensitiveParameter]
22- public ?array $ secrets = null ,
22+ public readonly ?array $ secrets = null ,
2323 ) {}
2424
2525 /**
@@ -31,10 +31,17 @@ public function with(
3131 ?int $ timeout = null ,
3232 ?bool $ killOnTimeout = null ,
3333 ): self {
34- $ params = clone $ this ;
35- $ params ->secrets = array_merge ($ params ->secrets ?? [], $ secrets ?? []);
36- $ params ->timeout = $ timeout ?? $ params ->timeout ;
37- $ params ->killOnTimeout = $ killOnTimeout ?? $ params ->killOnTimeout ;
38- return $ params ;
34+ return new self (
35+ $ this ->shell ,
36+ $ this ->cwd ,
37+ $ this ->env ,
38+ $ this ->dotenv ,
39+ $ this ->nothrow ,
40+ $ timeout ?? $ this ->timeout ,
41+ $ killOnTimeout ?? $ this ->killOnTimeout ,
42+ $ this ->idleTimeout ,
43+ $ this ->forceOutput ,
44+ array_merge ($ this ->secrets ?? [], $ secrets ?? []),
45+ );
3946 }
4047}
0 commit comments