@@ -31,8 +31,7 @@ class FeatureContext implements BehatContext
31
31
32
32
private string $ flagType ;
33
33
private string $ inputFlagKey ;
34
- /** @var mixed $inputFlagDefaultValue */
35
- private $ inputFlagDefaultValue ;
34
+ private mixed $ inputFlagDefaultValue ;
36
35
private ?EvaluationContext $ inputContext = null ;
37
36
private ?EvaluationOptions $ inputOptions = null ;
38
37
@@ -70,6 +69,14 @@ public function __construct()
70
69
$ this ->client = $ api ->getClient ('features ' , '1.0 ' );
71
70
}
72
71
72
+ /**
73
+ * @Given a provider is registered with cache disabled
74
+ */
75
+ public function aProviderIsRegisteredWithCacheDisabled ()
76
+ {
77
+ // TODO: we disable cache by default already. Will update once we implement caching.
78
+ }
79
+
73
80
/**
74
81
* @When a boolean flag with key :flagKey is evaluated with default value :defaultValue
75
82
*/
@@ -156,25 +163,19 @@ public function theResolvedFloatValueShouldBe(float $resolvedValue)
156
163
}
157
164
158
165
/**
159
- * @param mixed $defaultValue
160
- *
161
166
* @When an object flag with key :flagKey is evaluated with a :defaultValue default value
162
167
*/
163
- public function anObjectFlagWithKeyIsEvaluatedWithANullDefaultValue (string $ flagKey , $ defaultValue )
168
+ public function anObjectFlagWithKeyIsEvaluatedWithANullDefaultValue (string $ flagKey , mixed $ defaultValue )
164
169
{
165
170
$ this ->flagType = FlagValueType::OBJECT ;
166
171
$ this ->inputFlagKey = $ flagKey ;
167
172
$ this ->inputFlagDefaultValue = $ defaultValue ;
168
173
}
169
174
170
175
/**
171
- * @param mixed $value1
172
- * @param mixed $value2
173
- * @param mixed $value3
174
- *
175
176
* @Then the resolved object value should be contain fields :key1, :key2, and :key3, with values :value1, :value2 and :value3, respectively
176
177
*/
177
- public function theResolvedObjectValueShouldBeContainFieldsAndWithValuesAndRespectively (string $ key1 , string $ key2 , string $ key3 , $ value1 , $ value2 , $ value3 )
178
+ public function theResolvedObjectValueShouldBeContainFieldsAndWithValuesAndRespectively (string $ key1 , string $ key2 , string $ key3 , mixed $ value1 , mixed $ value2 , mixed $ value3 )
178
179
{
179
180
Assert::assertEquals (
180
181
[
@@ -275,25 +276,19 @@ public function theResolvedFloatDetailsValueShouldBeTheVariantShouldBeAndTheReas
275
276
}
276
277
277
278
/**
278
- * @param mixed $defaultValue
279
- *
280
279
* @When an object flag with key :flagKey is evaluated with details and a :defaultValue default value
281
280
*/
282
- public function anObjectFlagWithKeyIsEvaluatedWithDetailsAndANullDefaultValue (string $ flagKey , $ defaultValue )
281
+ public function anObjectFlagWithKeyIsEvaluatedWithDetailsAndANullDefaultValue (string $ flagKey , mixed $ defaultValue )
283
282
{
284
283
$ this ->flagType = FlagValueType::OBJECT ;
285
284
$ this ->inputFlagKey = $ flagKey ;
286
285
$ this ->inputFlagDefaultValue = $ defaultValue ;
287
286
}
288
287
289
288
/**
290
- * @param mixed $value1
291
- * @param mixed $value2
292
- * @param mixed $value3
293
- *
294
289
* @Then the resolved object details value should be contain fields :key1, :key2, and :key3, with values :value1, :value2 and :value3, respectively
295
290
*/
296
- public function theResolvedObjectDetailsValueShouldBeContainFieldsAndWithValuesAndRespectively (string $ key1 , string $ key2 , string $ key3 , $ value1 , $ value2 , $ value3 )
291
+ public function theResolvedObjectDetailsValueShouldBeContainFieldsAndWithValuesAndRespectively (string $ key1 , string $ key2 , string $ key3 , mixed $ value1 , mixed $ value2 , mixed $ value3 )
297
292
{
298
293
$ details = $ this ->calculateDetails ();
299
294
@@ -316,14 +311,9 @@ public function theVariantShouldBeAndTheReasonShouldBe(string $variant, string $
316
311
}
317
312
318
313
/**
319
- * @param mixed $value1
320
- * @param mixed $value2
321
- * @param mixed $value3
322
- * @param mixed $value4
323
- *
324
314
* @When context contains keys :key1, :key2, :key3, :key4 with values :value1, :value2, :value3, :value4
325
315
*/
326
- public function contextContainsKeysWithValues (string $ key1 , string $ key2 , string $ key3 , string $ key4 , $ value1 , $ value2 , $ value3 , $ value4 )
316
+ public function contextContainsKeysWithValues (string $ key1 , string $ key2 , string $ key3 , string $ key4 , mixed $ value1 , mixed $ value2 , mixed $ value3 , mixed $ value4 )
327
317
{
328
318
if ($ this ->isBooleanLikeString ($ value1 )) {
329
319
$ value1 = $ this ->stringAsBool ($ value1 );
@@ -350,11 +340,9 @@ public function contextContainsKeysWithValues(string $key1, string $key2, string
350
340
}
351
341
352
342
/**
353
- * @param mixed $defaultValue
354
- *
355
343
* @When a flag with key :flagKey is evaluated with default value :defaultValue
356
344
*/
357
- public function aFlagWithKeyIsEvaluatedWithDefaultValue (string $ flagKey , $ defaultValue )
345
+ public function aFlagWithKeyIsEvaluatedWithDefaultValue (string $ flagKey , mixed $ defaultValue )
358
346
{
359
347
$ this ->inputFlagKey = $ flagKey ;
360
348
$ this ->inputFlagDefaultValue = $ defaultValue ;
@@ -370,11 +358,9 @@ public function theResolvedStringResponseShouldBe(string $resolvedValue)
370
358
}
371
359
372
360
/**
373
- * @param mixed $value
374
- *
375
361
* @Then the resolved flag value is :value when the context is empty
376
362
*/
377
- public function theResolvedFlagValueIsWhenTheContextIsEmpty ($ value )
363
+ public function theResolvedFlagValueIsWhenTheContextIsEmpty (mixed $ value )
378
364
{
379
365
$ this ->inputContext = null ;
380
366
@@ -389,14 +375,13 @@ public function theResolvedFlagValueIsWhenTheContextIsEmpty($value)
389
375
*/
390
376
public function aNonExistentStringFlagWithKeyIsEvaluatedWithDetailsAndADefaultValue (string $ flagKey , string $ defaultValue )
391
377
{
392
- $ this ->flagExists = false ;
393
378
$ this ->inputFlagKey = $ flagKey ;
394
379
$ this ->inputFlagDefaultValue = $ defaultValue ;
395
380
$ this ->setFlagTypeIfNullByValue ($ defaultValue );
396
381
}
397
382
398
383
/**
399
- * @Then then the default string value should be returned
384
+ * @Then the default string value should be returned
400
385
*/
401
386
public function thenTheDefaultStringValueShouldBeReturned ()
402
387
{
@@ -430,7 +415,7 @@ public function aStringFlagWithKeyIsEvaluatedAsAnIntegerWithDetailsAndADefaultVa
430
415
}
431
416
432
417
/**
433
- * @Then then the default integer value should be returned
418
+ * @Then the default integer value should be returned
434
419
*/
435
420
public function thenTheDefaultIntegerValueShouldBeReturned ()
436
421
{
@@ -519,10 +504,7 @@ private function calculateDetails(): EvaluationDetails
519
504
return $ details ;
520
505
}
521
506
522
- /**
523
- * @param mixed $value
524
- */
525
- private function setFlagTypeIfNullByValue ($ value ): void
507
+ private function setFlagTypeIfNullByValue (mixed $ value ): void
526
508
{
527
509
if (!isset ($ this ->flagType )) {
528
510
$ flagType = $ this ->getFlagTypeOf ($ value );
@@ -533,10 +515,7 @@ private function setFlagTypeIfNullByValue($value): void
533
515
}
534
516
}
535
517
536
- /**
537
- * @param mixed $value
538
- */
539
- private function getFlagTypeOf ($ value ): ?string
518
+ private function getFlagTypeOf (mixed $ value ): ?string
540
519
{
541
520
if (is_string ($ value )) {
542
521
return FlagValueType::STRING ;
@@ -559,10 +538,7 @@ private function getFlagTypeOf($value): ?string
559
538
}
560
539
}
561
540
562
- /**
563
- * @param mixed $value
564
- */
565
- private function isBooleanLikeString ($ value ): bool
541
+ private function isBooleanLikeString (mixed $ value ): bool
566
542
{
567
543
return $ value === 'true ' || $ value === 'false ' ;
568
544
}
0 commit comments