Skip to content

Commit 2727927

Browse files
Fix nullable parameter (#88)
1 parent 4cc896a commit 2727927

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/Engine/Engine.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static function getEnvironmentFeatureState(
6363
public static function getIdentityFeatureStates(
6464
EnvironmentModel $environment,
6565
IdentityModel $identity,
66-
array $overrideTraits = null
66+
?array $overrideTraits = null
6767
): array {
6868
$featureStates = self::_getIdentityFeatureStatesDict(
6969
$environment,
@@ -96,7 +96,7 @@ public static function getIdentityFeatureState(
9696
EnvironmentModel $environment,
9797
IdentityModel $identity,
9898
string $featureName,
99-
array $overrideTraits = null
99+
?array $overrideTraits = null
100100
): FeatureStateModel {
101101
$featureStates = self::_getIdentityFeatureStatesDict(
102102
$environment,
@@ -128,7 +128,7 @@ public static function getIdentityFeatureState(
128128
private static function _getIdentityFeatureStatesDict(
129129
EnvironmentModel $environment,
130130
IdentityModel $identity,
131-
array $overrideTraits = null
131+
?array $overrideTraits = null
132132
): array {
133133
$featureStates = [];
134134
foreach ($environment->getFeatureStates() as $fs) {

src/Engine/Segments/SegmentEvaluator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SegmentEvaluator
2020
public static function getIdentitySegments(
2121
EnvironmentModel $environment,
2222
IdentityModel $identity,
23-
array $overrideTraits = null
23+
?array $overrideTraits = null
2424
): array {
2525
return array_filter(
2626
$environment->getProject()->getSegments()->getArrayCopy(),
@@ -42,7 +42,7 @@ public static function getIdentitySegments(
4242
public static function evaluateIdentityInSegment(
4343
IdentityModel $identity,
4444
SegmentModel $segment,
45-
array $overrideTraits = null
45+
?array $overrideTraits = null
4646
): bool {
4747
$rulesCount = count($segment->getRules());
4848
$identityId = ($identity->getDjangoId() != null) ? $identity->getDjangoId() : $identity->compositeKey();

src/Flagsmith.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ class Flagsmith
6060
* @throws ValueError
6161
*/
6262
public function __construct(
63-
string $apiKey = null,
64-
string $host = null,
65-
object $customHeaders = null,
66-
int $environmentTtl = null,
67-
Retry $retries = null,
63+
?string $apiKey = null,
64+
?string $host = null,
65+
?object $customHeaders = null,
66+
?int $environmentTtl = null,
67+
?Retry $retries = null,
6868
bool $enableAnalytics = false,
69-
\Closure $defaultFlagHandler = null,
69+
?\Closure $defaultFlagHandler = null,
7070
bool $offlineMode = false,
71-
IOfflineHandler $offlineHandler = null
71+
?IOfflineHandler $offlineHandler = null
7272
) {
7373
if ($offlineMode and is_null($offlineHandler)) {
7474
throw new ValueError('offlineHandler must be provided to use offline mode.');

src/Utils/AnalyticsProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public function __construct(
3131
string $environmentKey,
3232
string $baseApiUrl,
3333
int $timeout = 5,
34-
ClientInterface $client = null,
35-
RequestFactoryInterface $requestFactory = null,
36-
StreamFactoryInterface $streamFactory = null
34+
?ClientInterface $client = null,
35+
?RequestFactoryInterface $requestFactory = null,
36+
?StreamFactoryInterface $streamFactory = null
3737
) {
3838
$this->analytics_endpoint = rtrim($baseApiUrl, '/') . self::ANALYTICS_ENDPOINT;
3939
$this->environment_key = $environmentKey;

0 commit comments

Comments
 (0)