Skip to content

Commit c0940a7

Browse files
committed
style: apply linting updates for providers
1 parent 4488703 commit c0940a7

File tree

7 files changed

+48
-48
lines changed

7 files changed

+48
-48
lines changed

providers/CloudBees/src/CloudBeesProvider.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function resolveFloatValue(string $flagKey, float $defaultValue, ?Evaluat
9696
/**
9797
* @param mixed[] $defaultValue
9898
*/
99-
public function resolveObjectValue(string $flagKey, $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
99+
public function resolveObjectValue(string $flagKey, array $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
100100
{
101101
return $this->resolve(
102102
$defaultValue,
@@ -108,22 +108,26 @@ public function resolveObjectValue(string $flagKey, $defaultValue, ?EvaluationCo
108108
/**
109109
* @param bool|string|int|float|mixed[] $defaultValue
110110
*/
111-
private function resolve($defaultValue, callable $fn, ?callable $transformer = null): ResolutionDetails
111+
private function resolve(mixed $defaultValue, callable $fn, ?callable $transformer = null): ResolutionDetails
112112
{
113113
if (is_null($transformer)) {
114114
$transformer = new IdentityTransformer();
115115
}
116116

117117
try {
118-
/** @var bool|string|int|float $value */
118+
/**
119+
* @var bool|string|int|float $value
120+
*/
119121
$value = call_user_func($fn);
120122

121-
/** @var bool|string|int|float|mixed[] $transformed */
123+
/**
124+
* @var bool|string|int|float|mixed[] $transformed
125+
*/
122126
$transformed = call_user_func($transformer, $value);
123127

124128
return (new ResolutionDetailsBuilder())
125-
->withValue($transformed)
126-
->build();
129+
->withValue($transformed)
130+
->build();
127131
} catch (Throwable $err) {
128132
$detailsBuilder = new ResolutionDetailsBuilder();
129133

providers/CloudBees/src/transformers/IdentityTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class IdentityTransformer
1111
*
1212
* @return bool|string|int|float|mixed[]
1313
*/
14-
public function __invoke($x)
14+
public function __invoke(mixed $x): mixed
1515
{
1616
return $x;
1717
}

providers/Flagd/src/FlagdProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FlagdProvider extends AbstractProvider implements Provider
2525
/**
2626
* @param mixed|IConfig|mixed[] $config
2727
*/
28-
public function __construct($config = null)
28+
public function __construct(mixed $config = null)
2929
{
3030
$this->config = Validator::validate($config);
3131

@@ -55,7 +55,7 @@ public function resolveFloatValue(string $flagKey, float $defaultValue, ?Evaluat
5555
/**
5656
* @param mixed[] $defaultValue
5757
*/
58-
public function resolveObjectValue(string $flagKey, $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
58+
public function resolveObjectValue(string $flagKey, array $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
5959
{
6060
return $this->service->resolveValue($flagKey, FlagValueType::OBJECT, $defaultValue, $context);
6161
}

providers/Flagd/src/config/Validator.php

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Validator
2525
/**
2626
* @param mixed $config
2727
*/
28-
public static function validate($config = null): IConfig
28+
public static function validate(mixed $config = null): IConfig
2929
{
3030
if ($config instanceof IConfig) {
3131
return self::validateConfig($config);
@@ -63,10 +63,7 @@ private static function validateConfig(IConfig $config): IConfig
6363
return new Config($host, $port, $protocol, $secure, $httpConfig);
6464
}
6565

66-
/**
67-
* @param mixed $secure
68-
*/
69-
private static function validateSecure($secure): bool
66+
private static function validateSecure(mixed $secure): bool
7067
{
7168
if (is_bool($secure)) {
7269
return $secure;
@@ -75,10 +72,7 @@ private static function validateSecure($secure): bool
7572
return Defaults::DEFAULT_SECURE;
7673
}
7774

78-
/**
79-
* @param mixed $host
80-
*/
81-
private static function validateHost($host): string
75+
private static function validateHost(mixed $host): string
8276
{
8377
if (is_string($host) && preg_match(self::VALID_HOST_REGEXP, $host)) {
8478
return $host;
@@ -87,10 +81,7 @@ private static function validateHost($host): string
8781
return Defaults::DEFAULT_HOST;
8882
}
8983

90-
/**
91-
* @param mixed $port
92-
*/
93-
private static function validatePort($port): int
84+
private static function validatePort(mixed $port): int
9485
{
9586
[$minPort, $maxPort] = self::VALID_PORT_RANGE;
9687

@@ -101,10 +92,7 @@ private static function validatePort($port): int
10192
return Defaults::DEFAULT_PORT;
10293
}
10394

104-
/**
105-
* @param mixed $protocol
106-
*/
107-
private static function validateProtocol($protocol): string
95+
private static function validateProtocol(mixed $protocol): string
10896
{
10997
if (is_string($protocol) && in_array($protocol, self::VALID_PROTOCOLS)) {
11098
return $protocol;
@@ -113,27 +101,29 @@ private static function validateProtocol($protocol): string
113101
return Defaults::DEFAULT_PROTOCOL;
114102
}
115103

116-
/**
117-
* @param mixed $httpConfig
118-
*/
119-
private static function validateHttpConfig($httpConfig): ?IHttpConfig
104+
private static function validateHttpConfig(mixed $httpConfig): ?IHttpConfig
120105
{
121106
if (is_null($httpConfig)) {
122107
return null;
123108
}
124109

125110
if (is_array($httpConfig)) {
126-
/** @var ClientInterface|mixed $client */
111+
/**
112+
* @var ClientInterface|mixed $client
113+
*/
127114
$client = $httpConfig['client'];
128-
/** @var RequestFactoryInterface|mixed $requestFactory */
115+
/**
116+
* @var RequestFactoryInterface|mixed $requestFactory
117+
*/
129118
$requestFactory = $httpConfig['requestFactory'];
130-
/** @var StreamFactoryInterface|mixed $streamFactory */
119+
/**
120+
* @var StreamFactoryInterface|mixed $streamFactory
121+
*/
131122
$streamFactory = $httpConfig['streamFactory'];
132123

133-
if (
134-
$client instanceof ClientInterface &&
135-
$requestFactory instanceof RequestFactoryInterface &&
136-
$streamFactory instanceof StreamFactoryInterface
124+
if ($client instanceof ClientInterface
125+
&& $requestFactory instanceof RequestFactoryInterface
126+
&& $streamFactory instanceof StreamFactoryInterface
137127
) {
138128
return new HttpConfig($client, $requestFactory, $streamFactory);
139129
}

providers/Flagd/src/http/FlagdResponseResolutionDetailsAdapter.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FlagdResponseResolutionDetailsAdapter
1616
/**
1717
* @param mixed[]|bool|DateTime|float|int|string|null $defaultValue
1818
*/
19-
public static function forTypeMismatch($defaultValue): ResolutionDetails
19+
public static function forTypeMismatch(mixed $defaultValue): ResolutionDetails
2020
{
2121
return (new ResolutionDetailsBuilder())
2222
->withValue($defaultValue)
@@ -25,14 +25,16 @@ public static function forTypeMismatch($defaultValue): ResolutionDetails
2525
}
2626

2727
/**
28-
* @param string[] $response
28+
* @param string[] $response
2929
* @param mixed[]|bool|DateTime|float|int|string|null $defaultValue
3030
*/
31-
public static function forError(array $response, $defaultValue): ResolutionDetails
31+
public static function forError(array $response, mixed $defaultValue): ResolutionDetails
3232
{
3333
$responseCode = $response['code'];
3434
if ($responseCode && ResponseCodeErrorCodeMap::has($responseCode)) {
35-
/** @var ErrorCode $responseErrorCode */
35+
/**
36+
* @var ErrorCode $responseErrorCode
37+
*/
3638
$responseErrorCode = ResponseCodeErrorCodeMap::get($responseCode);
3739

3840
$resolutionError = new ResolutionError(

providers/Flagd/src/service/ServiceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ interface ServiceInterface
1313
/**
1414
* @param mixed[]|bool|DateTime|float|int|string|null $defaultValue
1515
*/
16-
public function resolveValue(string $flagKey, string $flagType, $defaultValue, ?EvaluationContext $context): ResolutionDetails;
16+
public function resolveValue(string $flagKey, string $flagType, mixed $defaultValue, ?EvaluationContext $context): ResolutionDetails;
1717
}

providers/Split/src/SplitProvider.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class SplitProvider extends AbstractProvider implements Provider
3333
{
3434
protected const NAME = 'SplitProvider';
3535

36-
/** The Split factory will only be created one time */
36+
/**
37+
* The Split factory will only be created one time
38+
*/
3739
private static SplitFactoryInterface $factory;
3840

3941
private ClientInterface $client;
@@ -47,17 +49,19 @@ class SplitProvider extends AbstractProvider implements Provider
4749
*
4850
* @see https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK#configuration
4951
*
50-
* @param string $apiKey The API key for Split
52+
* @param string $apiKey The API key for Split
5153
* @param mixed[] $options The configuration options for the client
5254
*
5355
* @throws SplitFactoryCreationException
5456
*/
55-
public function __construct(?string $apiKey = '', $options = [])
57+
public function __construct(?string $apiKey = '', mixed $options = [])
5658
{
5759
if (isset(self::$factory)) {
5860
$factory = self::$factory;
5961
} else {
60-
/** @var SplitFactoryInterface|null $factory */
62+
/**
63+
* @var SplitFactoryInterface|null $factory
64+
*/
6165
$factory = Sdk::factory($apiKey, $options);
6266
if (is_null($factory)) {
6367
throw new SplitFactoryCreationException();
@@ -104,15 +108,15 @@ public function resolveFloatValue(string $flagKey, float $defaultValue, ?Evaluat
104108
/**
105109
* @param mixed[] $defaultValue
106110
*/
107-
public function resolveObjectValue(string $flagKey, $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
111+
public function resolveObjectValue(string $flagKey, array $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
108112
{
109113
return $this->resolveValue($flagKey, FlagValueType::OBJECT, $defaultValue, $context);
110114
}
111115

112116
/**
113117
* @param bool|string|int|float|mixed[] $defaultValue
114118
*/
115-
private function resolveValue(string $flagKey, string $flagType, $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
119+
private function resolveValue(string $flagKey, string $flagType, mixed $defaultValue, ?EvaluationContext $context = null): ResolutionDetails
116120
{
117121
try {
118122
if (is_null($context)) {

0 commit comments

Comments
 (0)