Skip to content

Commit 7414627

Browse files
authored
Refactor: rename CloneWith::with to CloneWith::cloneWith (#664)
1 parent 8358594 commit 7414627

20 files changed

+97
-97
lines changed

src/Client/Schedule/Action/StartWorkflowAction.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ public function withWorkflowId(string $workflowId): self
145145
$workflowId !== '' or throw new \InvalidArgumentException('Workflow ID cannot be empty.');
146146

147147
/** @see self::$workflowId */
148-
return $this->with('workflowId', $workflowId);
148+
return $this->cloneWith('workflowId', $workflowId);
149149
}
150150

151151
public function withWorkflowType(string|WorkflowType $workflowType): self
152152
{
153153
\is_string($workflowType) and $workflowType = self::createWorkflowType($workflowType);
154154

155155
/** @see self::$workflowType */
156-
return $this->with('workflowType', $workflowType);
156+
return $this->cloneWith('workflowType', $workflowType);
157157
}
158158

159159
public function withTaskQueue(string|TaskQueue $taskQueue): self
160160
{
161161
\is_string($taskQueue) and $taskQueue = TaskQueue::new($taskQueue);
162162

163163
/** @see self::$taskQueue */
164-
return $this->with('taskQueue', $taskQueue);
164+
return $this->cloneWith('taskQueue', $taskQueue);
165165
}
166166

167167
/**
@@ -174,7 +174,7 @@ public function withInput(array|ValuesInterface $values): self
174174
$values instanceof ValuesInterface or $values = EncodedValues::fromValues($values);
175175

176176
/** @see self::$input */
177-
return $this->with('input', $values);
177+
return $this->cloneWith('input', $values);
178178
}
179179

180180
/**
@@ -189,7 +189,7 @@ public function withWorkflowExecutionTimeout(mixed $timeout): self
189189
: DateInterval::parse($timeout, DateInterval::FORMAT_SECONDS);
190190

191191
/** @see self::$workflowExecutionTimeout */
192-
return $this->with('workflowExecutionTimeout', $timeout);
192+
return $this->cloneWith('workflowExecutionTimeout', $timeout);
193193
}
194194

195195
/**
@@ -204,7 +204,7 @@ public function withWorkflowRunTimeout(mixed $timeout): self
204204
: DateInterval::parse($timeout, DateInterval::FORMAT_SECONDS);
205205

206206
/** @see self::$workflowRunTimeout */
207-
return $this->with('workflowRunTimeout', $timeout);
207+
return $this->cloneWith('workflowRunTimeout', $timeout);
208208
}
209209

210210
/**
@@ -219,13 +219,13 @@ public function withWorkflowTaskTimeout(mixed $timeout): self
219219
: DateInterval::parse($timeout, DateInterval::FORMAT_SECONDS);
220220

221221
/** @see self::$workflowTaskTimeout */
222-
return $this->with('workflowTaskTimeout', $timeout);
222+
return $this->cloneWith('workflowTaskTimeout', $timeout);
223223
}
224224

225225
public function withWorkflowIdReusePolicy(IdReusePolicy $policy): self
226226
{
227227
/** @see self::$workflowIdReusePolicy */
228-
return $this->with('workflowIdReusePolicy', $policy);
228+
return $this->cloneWith('workflowIdReusePolicy', $policy);
229229
}
230230

231231
/**
@@ -234,7 +234,7 @@ public function withWorkflowIdReusePolicy(IdReusePolicy $policy): self
234234
public function withRetryPolicy(RetryOptions $retryPolicy): self
235235
{
236236
/** @see self::$retryPolicy */
237-
return $this->with('retryPolicy', $retryPolicy);
237+
return $this->cloneWith('retryPolicy', $retryPolicy);
238238
}
239239

240240
/**
@@ -247,7 +247,7 @@ public function withMemo(iterable|EncodedCollection $values): self
247247
$values instanceof EncodedCollection or $values = EncodedCollection::fromValues($values);
248248

249249
/** @see self::$memo */
250-
return $this->with('memo', $values);
250+
return $this->cloneWith('memo', $values);
251251
}
252252

253253
/**
@@ -260,7 +260,7 @@ public function withSearchAttributes(iterable|EncodedCollection $values): self
260260
$values instanceof EncodedCollection or $values = EncodedCollection::fromValues($values);
261261

262262
/** @see self::$searchAttributes */
263-
return $this->with('searchAttributes', $values);
263+
return $this->cloneWith('searchAttributes', $values);
264264
}
265265

266266
/**
@@ -273,7 +273,7 @@ public function withHeader(iterable|HeaderInterface $values): self
273273
$values instanceof HeaderInterface or $values = \Temporal\Interceptor\Header::fromValues($values);
274274

275275
/** @see self::$header */
276-
return $this->with('header', $values);
276+
return $this->cloneWith('header', $values);
277277
}
278278

279279
/**
@@ -286,7 +286,7 @@ public function withHeader(iterable|HeaderInterface $values): self
286286
public function withStaticSummary(string $summary): self
287287
{
288288
/** @see self::$userMetadata */
289-
return $this->with('userMetadata', $this->userMetadata->withSummary($summary));
289+
return $this->cloneWith('userMetadata', $this->userMetadata->withSummary($summary));
290290
}
291291

292292
/**
@@ -300,7 +300,7 @@ public function withStaticSummary(string $summary): self
300300
public function withStaticDetails(string $details): self
301301
{
302302
/** @see self::$userMetadata */
303-
return $this->with('userMetadata', $this->userMetadata->withDetails($details));
303+
return $this->cloneWith('userMetadata', $this->userMetadata->withDetails($details));
304304
}
305305

306306
private static function createWorkflowType(string $name): WorkflowType

src/Client/Schedule/BackfillPeriod.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function new(
5151
public function withStartTime(\DateTimeInterface|string $dateTime): self
5252
{
5353
/** @see self::$startTime */
54-
return $this->with('startTime', DateTime::parse($dateTime, class: \DateTimeImmutable::class));
54+
return $this->cloneWith('startTime', DateTime::parse($dateTime, class: \DateTimeImmutable::class));
5555
}
5656

5757
/**
@@ -60,7 +60,7 @@ public function withStartTime(\DateTimeInterface|string $dateTime): self
6060
public function withEndTime(\DateTimeInterface|string $dateTime): self
6161
{
6262
/** @see self::$endTime */
63-
return $this->with('endTime', DateTime::parse($dateTime, class: \DateTimeImmutable::class));
63+
return $this->cloneWith('endTime', DateTime::parse($dateTime, class: \DateTimeImmutable::class));
6464
}
6565

6666
/**
@@ -69,6 +69,6 @@ public function withEndTime(\DateTimeInterface|string $dateTime): self
6969
public function withOverlapPolicy(ScheduleOverlapPolicy $overlapPolicy): self
7070
{
7171
/** @see self::$overlapPolicy */
72-
return $this->with('overlapPolicy', $overlapPolicy);
72+
return $this->cloneWith('overlapPolicy', $overlapPolicy);
7373
}
7474
}

src/Client/Schedule/Policy/SchedulePolicies.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function new(): self
6767
*/
6868
public function withOverlapPolicy(ScheduleOverlapPolicy $overlapPolicy): self
6969
{
70-
return $this->with('overlapPolicy', $overlapPolicy);
70+
return $this->cloneWith('overlapPolicy', $overlapPolicy);
7171
}
7272

7373
/**
@@ -86,7 +86,7 @@ public function withCatchupWindow(mixed $interval): self
8686
// Can't be less than 10 seconds.
8787
\assert($interval->totalSeconds >= 10);
8888

89-
return $this->with('catchupWindow', $interval);
89+
return $this->cloneWith('catchupWindow', $interval);
9090
}
9191

9292
/**
@@ -96,6 +96,6 @@ public function withCatchupWindow(mixed $interval): self
9696
*/
9797
public function withPauseOnFailure(bool $pauseOnFailure = true): self
9898
{
99-
return $this->with('pauseOnFailure', $pauseOnFailure);
99+
return $this->cloneWith('pauseOnFailure', $pauseOnFailure);
100100
}
101101
}

src/Client/Schedule/Schedule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ public static function new(): self
6060
public function withAction(?ScheduleAction $action): self
6161
{
6262
/** @see self::$action */
63-
return $this->with('action', $action);
63+
return $this->cloneWith('action', $action);
6464
}
6565

6666
public function withSpec(ScheduleSpec $spec): self
6767
{
6868
/** @see self::$spec */
69-
return $this->with('spec', $spec);
69+
return $this->cloneWith('spec', $spec);
7070
}
7171

7272
public function withPolicies(SchedulePolicies $policies): self
7373
{
7474
/** @see self::$policies */
75-
return $this->with('policies', $policies);
75+
return $this->cloneWith('policies', $policies);
7676
}
7777

7878
public function withState(ScheduleState $state): self
7979
{
8080
/** @see self::$state */
81-
return $this->with('state', $state);
81+
return $this->cloneWith('state', $state);
8282
}
8383
}

src/Client/Schedule/ScheduleOptions.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function new(): self
5151
public function withNamespace(string $namespace): self
5252
{
5353
/** @see self::$namespace */
54-
return $this->with('namespace', $namespace);
54+
return $this->cloneWith('namespace', $namespace);
5555
}
5656

5757
/**
@@ -60,7 +60,7 @@ public function withNamespace(string $namespace): self
6060
public function withTriggerImmediately(bool $value): self
6161
{
6262
/** @see self::$triggerImmediately */
63-
return $this->with('triggerImmediately', $value);
63+
return $this->cloneWith('triggerImmediately', $value);
6464
}
6565

6666
/**
@@ -72,7 +72,7 @@ public function withTriggerImmediately(bool $value): self
7272
public function withBackfills(BackfillPeriod ...$values): self
7373
{
7474
/** @see self::$backfills */
75-
return $this->with('backfills', $values);
75+
return $this->cloneWith('backfills', $values);
7676
}
7777

7878
/**
@@ -84,7 +84,7 @@ public function withBackfills(BackfillPeriod ...$values): self
8484
public function withAddedBackfill(BackfillPeriod $value): self
8585
{
8686
/** @see self::$backfills */
87-
return $this->with('backfills', [...$this->backfills, $value]);
87+
return $this->cloneWith('backfills', [...$this->backfills, $value]);
8888
}
8989

9090
/**
@@ -97,7 +97,7 @@ public function withMemo(iterable|EncodedCollection $values): self
9797
$values instanceof EncodedCollection or $values = EncodedCollection::fromValues($values);
9898

9999
/** @see self::$memo */
100-
return $this->with('memo', $values);
100+
return $this->cloneWith('memo', $values);
101101
}
102102

103103
/**
@@ -113,6 +113,6 @@ public function withSearchAttributes(iterable|EncodedCollection $values): self
113113
$values instanceof EncodedCollection or $values = EncodedCollection::fromValues($values);
114114

115115
/** @see self::$searchAttributes */
116-
return $this->with('searchAttributes', $values);
116+
return $this->cloneWith('searchAttributes', $values);
117117
}
118118
}

src/Client/Schedule/Spec/CalendarSpec.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,42 +88,42 @@ public static function new(
8888

8989
public function withSecond(string|int $second): self
9090
{
91-
return $this->with('second', (string) $second);
91+
return $this->cloneWith('second', (string) $second);
9292
}
9393

9494
public function withMinute(string|int $minute): self
9595
{
96-
return $this->with('minute', (string) $minute);
96+
return $this->cloneWith('minute', (string) $minute);
9797
}
9898

9999
public function withHour(string|int $hour): self
100100
{
101-
return $this->with('hour', (string) $hour);
101+
return $this->cloneWith('hour', (string) $hour);
102102
}
103103

104104
public function withDayOfMonth(string|int $dayOfMonth): self
105105
{
106-
return $this->with('dayOfMonth', (string) $dayOfMonth);
106+
return $this->cloneWith('dayOfMonth', (string) $dayOfMonth);
107107
}
108108

109109
public function withMonth(string|int $month): self
110110
{
111-
return $this->with('month', (string) $month);
111+
return $this->cloneWith('month', (string) $month);
112112
}
113113

114114
public function withYear(string|int $year): self
115115
{
116-
return $this->with('year', (string) $year);
116+
return $this->cloneWith('year', (string) $year);
117117
}
118118

119119
public function withDayOfWeek(string|int $dayOfWeek): self
120120
{
121-
return $this->with('dayOfWeek', (string) $dayOfWeek);
121+
return $this->cloneWith('dayOfWeek', (string) $dayOfWeek);
122122
}
123123

124124
public function withComment(string $comment): self
125125
{
126126
/** @see self::$comment */
127-
return $this->with('comment', $comment);
127+
return $this->cloneWith('comment', $comment);
128128
}
129129
}

src/Client/Schedule/Spec/IntervalSpec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public function withInterval(mixed $interval): self
5050
\assert(DateInterval::assert($interval));
5151
$interval = DateInterval::parse($interval, DateInterval::FORMAT_SECONDS);
5252

53-
return $this->with('interval', $interval);
53+
return $this->cloneWith('interval', $interval);
5454
}
5555

5656
public function withPhase(mixed $phase): self
5757
{
5858
\assert(DateInterval::assert($phase));
5959
$phase = DateInterval::parse($phase, DateInterval::FORMAT_SECONDS);
6060

61-
return $this->with('phase', $phase);
61+
return $this->cloneWith('phase', $phase);
6262
}
6363
}

src/Client/Schedule/Spec/Range.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function new(int $start, int $end, int $step = 1): self
5050
*/
5151
public function withStart(int $start): self
5252
{
53-
return $this->with('start', $start);
53+
return $this->cloneWith('start', $start);
5454
}
5555

5656
/**
@@ -59,7 +59,7 @@ public function withStart(int $start): self
5959
public function withEnd(int $end): self
6060
{
6161
\assert($end >= $this->start, 'End must be greater than or equal to start.');
62-
return $this->with('end', $end);
62+
return $this->cloneWith('end', $end);
6363
}
6464

6565
/**
@@ -68,6 +68,6 @@ public function withEnd(int $end): self
6868
public function withStep(int $step): self
6969
{
7070
\assert($step > 0, 'Step must be greater than 0.');
71-
return $this->with('step', $step);
71+
return $this->cloneWith('step', $step);
7272
}
7373
}

0 commit comments

Comments
 (0)