@@ -178,11 +178,13 @@ public function setAttributes(array $attributes): static
178178 /**
179179 * @param array<string,mixed> $attributes
180180 * @return static
181- * @deprecated Use setAttributes() instead. withAttributes() will become immutable in 2.0.0.
182181 */
183182 public function withAttributes (array $ attributes ): static
184183 {
185- return $ this ->setAttributes ($ attributes );
184+ $ self = clone $ this ;
185+ $ self ->setAttributes ($ attributes );
186+
187+ return $ self ;
186188 }
187189
188190 /**
@@ -199,11 +201,13 @@ public function setSavedGroups(array $savedGroups): static
199201 /**
200202 * @param array<string,mixed> $savedGroups
201203 * @return static
202- * @deprecated Use setSavedGroups() instead. withSavedGroups() will become immutable in 2.0.0.
203204 */
204205 public function withSavedGroups (array $ savedGroups ): static
205206 {
206- return $ this ->setSavedGroups ($ savedGroups );
207+ $ self = clone $ this ;
208+ $ self ->setSavedGroups ($ savedGroups );
209+
210+ return $ self ;
207211 }
208212
209213 /**
@@ -220,11 +224,13 @@ public function setTrackingCallback($trackingCallback): static
220224 /**
221225 * @param callable|null $trackingCallback
222226 * @return static
223- * @deprecated Use setTrackingCallback() instead. withTrackingCallback() will become immutable in 2.0.0.
224227 */
225228 public function withTrackingCallback ($ trackingCallback ): static
226229 {
227- return $ this ->setTrackingCallback ($ trackingCallback );
230+ $ self = clone $ this ;
231+ $ self ->setTrackingCallback ($ trackingCallback );
232+
233+ return $ self ;
228234 }
229235
230236 /**
@@ -249,11 +255,13 @@ public function setFeatures(array $features): static
249255 /**
250256 * @param array<string,Feature<mixed>|mixed> $features
251257 * @return static
252- * @deprecated Use setFeatures() instead. withFeatures() will become immutable in 2.0.0.
253258 */
254259 public function withFeatures (array $ features ): static
255260 {
256- return $ this ->setFeatures ($ features );
261+ $ self = clone $ this ;
262+ $ self ->setFeatures ($ features );
263+
264+ return $ self ;
257265 }
258266
259267 /**
@@ -269,11 +277,13 @@ public function setForcedVariations(array $forcedVariations): static
269277 /**
270278 * @param array<string,int> $forcedVariations
271279 * @return static
272- * @deprecated Use setForcedVariations() instead. withForcedVariations() will become immutable in 2.0.0.
273280 */
274281 public function withForcedVariations (array $ forcedVariations ): static
275282 {
276- return $ this ->setForcedVariations ($ forcedVariations );
283+ $ self = clone $ this ;
284+ $ self ->setForcedVariations ($ forcedVariations );
285+
286+ return $ self ;
277287 }
278288
279289 /**
@@ -289,11 +299,13 @@ public function setForcedFeatures(array $forcedFeatures): static
289299 /**
290300 * @param array<string, FeatureResult<mixed>> $forcedFeatures
291301 * @return static
292- * @deprecated Use setForcedFeatures() instead. withForcedFeatures() will become immutable in 2.0.0.
293302 */
294303 public function withForcedFeatures (array $ forcedFeatures ): static
295304 {
296- return $ this ->setForcedFeatures ($ forcedFeatures );
305+ $ self = clone $ this ;
306+ $ self ->setForcedFeatures ($ forcedFeatures );
307+
308+ return $ self ;
297309 }
298310
299311 /**
@@ -309,11 +321,13 @@ public function setUrl(string $url): static
309321 /**
310322 * @param string $url
311323 * @return static
312- * @deprecated Use setUrl() instead. withUrl() will become immutable in 2.0.0.
313324 */
314325 public function withUrl (string $ url ): static
315326 {
316- return $ this ->setUrl ($ url );
327+ $ self = clone $ this ;
328+ $ self ->setUrl ($ url );
329+
330+ return $ self ;
317331 }
318332
319333 /**
@@ -327,12 +341,13 @@ public function setLogger(?LoggerInterface $logger = null): void
327341 /**
328342 * @param LoggerInterface|null $logger
329343 * @return static
330- * @deprecated Use setLogger() instead. withLogger() will become immutable in 2.0.0.
331344 */
332345 public function withLogger (?LoggerInterface $ logger = null ): static
333346 {
334- $ this ->setLogger ($ logger );
335- return $ this ;
347+ $ self = clone $ this ;
348+ $ self ->setLogger ($ logger );
349+
350+ return $ self ;
336351 }
337352
338353 /**
@@ -353,11 +368,13 @@ public function setHttpClient(\Psr\Http\Client\ClientInterface $client, \Psr\Htt
353368 * @param \Psr\Http\Client\ClientInterface $client
354369 * @param \Psr\Http\Message\RequestFactoryInterface $requestFactory
355370 * @return static
356- * @deprecated Use setHttpClient() instead. withHttpClient() will become immutable in 2.0.0.
357371 */
358372 public function withHttpClient (\Psr \Http \Client \ClientInterface $ client , \Psr \Http \Message \RequestFactoryInterface $ requestFactory ): static
359373 {
360- return $ this ->setHttpClient ($ client , $ requestFactory );
374+ $ self = clone $ this ;
375+ $ self ->setHttpClient ($ client , $ requestFactory );
376+
377+ return $ self ;
361378 }
362379
363380 /**
@@ -377,11 +394,13 @@ public function setApiTimeout(int $seconds): static
377394 *
378395 * @param int $seconds Timeout in seconds (default: 2)
379396 * @return static
380- * @deprecated Use setApiTimeout() instead. withApiTimeout() will become immutable in 2.0.0.
381397 */
382398 public function withApiTimeout (int $ seconds ): static
383399 {
384- return $ this ->setApiTimeout ($ seconds );
400+ $ self = clone $ this ;
401+ $ self ->setApiTimeout ($ seconds );
402+
403+ return $ self ;
385404 }
386405
387406 /**
@@ -401,11 +420,13 @@ public function setApiConnectTimeout(int $seconds): static
401420 *
402421 * @param int $seconds Connection timeout in seconds (default: 2)
403422 * @return static
404- * @deprecated Use setApiConnectTimeout() instead. withApiConnectTimeout() will become immutable in 2.0.0.
405423 */
406424 public function withApiConnectTimeout (int $ seconds ): static
407425 {
408- return $ this ->setApiConnectTimeout ($ seconds );
426+ $ self = clone $ this ;
427+ $ self ->setApiConnectTimeout ($ seconds );
428+
429+ return $ self ;
409430 }
410431
411432 /**
@@ -427,11 +448,13 @@ public function setCache(\Psr\SimpleCache\CacheInterface $cache, ?int $ttl = nul
427448 * @param \Psr\SimpleCache\CacheInterface $cache
428449 * @param int|null $ttl
429450 * @return static
430- * @deprecated Use setCache() instead. withCache() will become immutable in 2.0.0.
431451 */
432452 public function withCache (\Psr \SimpleCache \CacheInterface $ cache , ?int $ ttl = null ): static
433453 {
434- return $ this ->setCache ($ cache , $ ttl );
454+ $ self = clone $ this ;
455+ $ self ->setCache ($ cache , $ ttl );
456+
457+ return $ self ;
435458 }
436459
437460 /**
@@ -451,11 +474,13 @@ public function setStickyBucketing(StickyBucketService $stickyBucketService, ?ar
451474 * @param StickyBucketService $stickyBucketService
452475 * @param array<string>|null $stickyBucketIdentifierAttributes
453476 * @return static
454- * @deprecated Use setStickyBucketing() instead. withStickyBucketing() will become immutable in 2.0.0.
455477 */
456478 public function withStickyBucketing (StickyBucketService $ stickyBucketService , ?array $ stickyBucketIdentifierAttributes ): static
457479 {
458- return $ this ->setStickyBucketing ($ stickyBucketService , $ stickyBucketIdentifierAttributes );
480+ $ self = clone $ this ;
481+ $ self ->setStickyBucketing ($ stickyBucketService , $ stickyBucketIdentifierAttributes );
482+
483+ return $ self ;
459484 }
460485
461486 /**
0 commit comments