Skip to content

Commit 0857b4d

Browse files
committed
chore: Cleanup and strict types
1 parent 08eda61 commit 0857b4d

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

src/LaunchDarkly/Impl/Integrations/PHPRedisFeatureRequester.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaunchDarkly\Impl\Integrations;
46

57
use LaunchDarkly\Integrations;
@@ -35,7 +37,13 @@ protected function readItemString(string $namespace, string $key): ?string
3537

3638
protected function readItemStringList(string $namespace): ?array
3739
{
40+
/** @var ?array<string, string> */
3841
$raw = $this->client->hgetall("$this->prefix:$namespace");
39-
return $raw ? array_values($raw) : null;
42+
43+
if ($raw === null) {
44+
return null;
45+
}
46+
47+
return array_values($raw);
4048
}
4149
}

src/LaunchDarkly/Integrations/PHPRedis.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaunchDarkly\Integrations;
46

57
use LaunchDarkly\Impl\Integrations;
@@ -21,8 +23,8 @@ class PHPRedis
2123
* To use this method, you must have installed the `phpredis` extension. After calling this
2224
* method, store its return value in the `feature_requester` property of your client configuration:
2325
*
24-
* $fr = LaunchDarkly\Integrations\PHPRedis::featureRequester([ "redis_prefix" => "env1" ]);
25-
* $config = [ "feature_requester" => $fr ];
26+
* $fr = LaunchDarkly\Integrations\PHPRedis::featureRequester(["prefix" => "env1"]);
27+
* $config = ["feature_requester" => $fr];
2628
* $client = new LDClient("sdk_key", $config);
2729
*
2830
* For more about using LaunchDarkly with databases, see the

tests/Impl/Integrations/PHPRedisBigSegmentsStoreTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaunchDarkly\Impl\Integrations\Tests\Impl\Integrations;
46

57
use Exception;

tests/Impl/Integrations/PHPRedisFeatureRequesterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaunchDarkly\Impl\Integrations\Tests\Impl\Integrations;
46

57
use LaunchDarkly\Impl\Model\FeatureFlag;

0 commit comments

Comments
 (0)