Skip to content

Commit c7b15ef

Browse files
committed
refactor: get all typings to a better spot
1 parent 7079345 commit c7b15ef

19 files changed

+57
-36
lines changed

src/implementation/flags/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function keys(): array
3636
/**
3737
* @return bool|string|int|float|DateTime|mixed[]|null
3838
*/
39-
public function get(string $key)
39+
public function get(string $key): bool | string | int | float | DateTime | array | null
4040
{
4141
if (isset($this->attributesMap[$key])) {
4242
return $this->attributesMap[$key];

src/implementation/flags/EvaluationDetails.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class EvaluationDetails implements EvaluationDetailsInterface
1212
{
1313
private string $flagKey = '';
14+
1415
/** @var bool|string|int|float|DateTime|mixed[]|null $value */
1516
private bool | string | int | float | DateTime | array | null $value = null;
1617
private ?ResolutionError $error = null;
@@ -40,7 +41,7 @@ public function setFlagKey(string $flagKey): void
4041
*
4142
* @return bool|string|int|float|DateTime|mixed[]|null
4243
*/
43-
public function getValue()
44+
public function getValue(): bool | string | int | float | DateTime | array | null
4445
{
4546
return $this->value;
4647
}

src/implementation/flags/EvaluationDetailsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class EvaluationDetailsFactory
1212
{
1313
/**
14-
* Provides a simple method for building EvaluationDetails from a given value
14+
* Provides a simple method for building EvaluationDetails from a given value\
1515
*
1616
* @param bool|string|int|float|DateTime|mixed[]|null $value
1717
*/

src/implementation/flags/MutableAttributes.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ function (array $map, string $key) use ($attributes) {
3232
return new MutableAttributes($attributeMap);
3333
}
3434

35-
/**
36-
* @param bool|string|int|float|DateTime|mixed[]|null $value
37-
*/
3835
public function add(string $key, bool | string | int | float | DateTime | array | null $value): void
3936
{
4037
$this->attributesMap[$key] = $value;

src/implementation/flags/NoOpClient.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ public function getFloatDetails(string $flagKey, float $defaultValue, ?Evaluatio
6060
*
6161
* @return mixed[]
6262
*/
63-
public function getObjectValue(string $flagKey, array $defaultValue, ?EvaluationContextInterface $context = null, ?EvaluationOptions $options = null): array
64-
{
63+
public function getObjectValue(
64+
string $flagKey,
65+
array $defaultValue,
66+
?EvaluationContextInterface $context = null,
67+
?EvaluationOptions $options = null
68+
): array {
6569
return $defaultValue;
6670
}
6771

68-
/**
69-
* @param bool|string|int|float|DateTime|mixed[]|null $defaultValue
70-
*/
7172
public function getObjectDetails(string $flagKey, bool | string | int | float | DateTime | array | null $defaultValue, ?EvaluationContextInterface $context = null, ?EvaluationOptions $options = null): EvaluationDetails
7273
{
7374
return EvaluationDetailsFactory::from($flagKey, $defaultValue);
@@ -88,17 +89,17 @@ public function setEvaluationContext(EvaluationContextInterface $context): void
8889
// no-op
8990
}
9091

91-
/**
92-
* @inheritdoc
93-
*/
92+
/**
93+
* @inheritdoc
94+
*/
9495
public function getHooks(): array
9596
{
9697
return [];
9798
}
9899

99-
/**
100-
* @inheritdoc
101-
*/
100+
/**
101+
* @inheritdoc
102+
*/
102103
public function setHooks(array $hooks): void
103104
{
104105
// no-op

src/implementation/hooks/HookHints.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class HookHints implements HookHintsInterface
1616
private array $hints = [];
1717

1818
/**
19-
* @return bool | string | float | int | DateTime | mixed[] | null
19+
* @return bool|string|int|float|DateTime|mixed[]|null
2020
*/
21-
public function get(string $key)
21+
public function get(string $key): bool | string | int | float | DateTime | array | null
2222
{
2323
if (key_exists($key, $this->hints)) {
2424
return $this->hints[$key];

src/implementation/hooks/ImmutableHookContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function getType(): string
2424
/**
2525
* @return bool|string|int|float|DateTime|mixed[]|null
2626
*/
27-
public function getDefaultValue()
27+
public function getDefaultValue(): bool | string | int | float | DateTime | array | null
2828
{
2929
return $this->defaultValue;
3030
}

src/implementation/hooks/MutableHookContext.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ public function setType(string $type): void
2222
$this->type = $type;
2323
}
2424

25-
/**
26-
* @param bool|string|int|float|DateTime|mixed[]|null $defaultValue
27-
*/
2825
public function setDefaultValue(bool | string | int | float | DateTime | array | null $defaultValue): void
2926
{
3027
$this->defaultValue = $defaultValue;

src/implementation/provider/AbstractProvider.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace OpenFeature\implementation\provider;
66

7+
use DateTime;
78
use OpenFeature\implementation\common\Metadata;
89
use OpenFeature\interfaces\common\Metadata as MetadataInterface;
910
use OpenFeature\interfaces\flags\EvaluationContext;
@@ -34,7 +35,11 @@ abstract public function resolveIntegerValue(string $flagKey, int $defaultValue,
3435

3536
abstract public function resolveFloatValue(string $flagKey, float $defaultValue, ?EvaluationContext $context = null): ResolutionDetailsInterface;
3637

37-
abstract public function resolveObjectValue(string $flagKey, mixed $defaultValue, ?EvaluationContext $context = null): ResolutionDetailsInterface;
38+
abstract public function resolveObjectValue(
39+
string $flagKey,
40+
bool | string | int | float | DateTime | array | null $defaultValue,
41+
?EvaluationContext $context = null
42+
): ResolutionDetailsInterface;
3843

3944
/**
4045
* @return Hook[]

src/implementation/provider/NoOpProvider.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace OpenFeature\implementation\provider;
66

7+
use DateTime;
78
use OpenFeature\interfaces\flags\EvaluationContext;
89
use OpenFeature\interfaces\provider\Provider;
910
use OpenFeature\interfaces\provider\ResolutionDetails as ResolutionDetailsInterface;
@@ -32,8 +33,14 @@ public function resolveFloatValue(string $flagKey, float $defaultValue, ?Evaluat
3233
return ResolutionDetailsFactory::fromSuccess($defaultValue);
3334
}
3435

35-
public function resolveObjectValue(string $flagKey, mixed $defaultValue, ?EvaluationContext $context = null): ResolutionDetailsInterface
36-
{
36+
/**
37+
* @param bool|string|int|float|DateTime|mixed[]|null $defaultValue
38+
*/
39+
public function resolveObjectValue(
40+
string $flagKey,
41+
bool | string | int | float | DateTime | array | null $defaultValue,
42+
?EvaluationContext $context = null
43+
): ResolutionDetailsInterface {
3744
return ResolutionDetailsFactory::fromSuccess($defaultValue);
3845
}
3946
}

0 commit comments

Comments
 (0)