Skip to content

Commit 750be79

Browse files
committed
fixing warnings
AI-Session-Id: f799218e-6e1b-4a2c-8b4c-10c142b00681 AI-Tool: claude-code AI-Model: unknown
1 parent 3e1d3fa commit 750be79

9 files changed

Lines changed: 40 additions & 38 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
- '8.1'
3232
- '8.2'
3333
- '8.3'
34+
- '8.4'
35+
- '8.5'
3436
steps:
3537
- name: Checkout code
3638
uses: actions/checkout@v3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.
99

1010
## Compatibility
11-
This SDK is compatible with PHP 7.3 and above.
11+
This SDK is compatible with PHP 7.3 and above, including PHP 8.4 and 8.5.
1212

1313
## Getting started
1414
Below is a simple example that describes the instantiation and most basic usage of our SDK.

src/SplitIO/Component/Log/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Logger extends LoggerTrait
3838
* Logger constructor
3939
* @param LogHandlerInterface|null $handler
4040
*/
41-
public function __construct(LogHandlerInterface $handler = null, $level = LogLevel::WARNING)
41+
public function __construct(LogHandlerInterface|null $handler = null, $level = LogLevel::WARNING)
4242
{
4343
$this->logLevel = $this->logLevels[$level];
4444

src/SplitIO/Engine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Engine
2121
* @param array|null $attributes
2222
* @return array
2323
*/
24-
public static function getTreatment($matchingKey, $bucketingKey, SplitGrammar $split, array $attributes = null)
24+
public static function getTreatment($matchingKey, $bucketingKey, SplitGrammar $split, ?array $attributes = null)
2525
{
2626
if ($bucketingKey === null) {
2727
$bucketingKey = $matchingKey;

src/SplitIO/Grammar/Condition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(array $condition)
6868
* @param array|null $attributes
6969
* @return bool
7070
*/
71-
public function match($key, array $attributes = null, $bucketingKey = null)
71+
public function match($key, ?array $attributes = null, $bucketingKey = null)
7272
{
7373
$eval = array();
7474
foreach ($this->matcherGroup as $matcher) {

src/SplitIO/Sdk/Client.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function createImpression($key, $featureFlag, $treatment, $changeNumber,
7474
*
7575
* @return null|mixed
7676
*/
77-
private function doInputValidationForTreatment($key, $featureFlagName, array $attributes = null, $operation)
77+
private function doInputValidationForTreatment($key, $featureFlagName, $operation, ?array $attributes = null)
7878
{
7979
$key = InputValidator::validateKey($key, $operation);
8080
if (is_null($key)) {
@@ -112,7 +112,7 @@ private function doEvaluation($operation, $key, $featureFlagName, $attributes)
112112
{
113113
$default = array('treatment' => TreatmentEnum::CONTROL, 'config' => null);
114114

115-
$inputValidation = $this->doInputValidationForTreatment($key, $featureFlagName, $attributes, $operation);
115+
$inputValidation = $this->doInputValidationForTreatment($key, $featureFlagName, $operation, $attributes);
116116
if (is_null($inputValidation)) {
117117
return $default;
118118
}
@@ -169,7 +169,7 @@ private function doEvaluation($operation, $key, $featureFlagName, $attributes)
169169
/**
170170
* @inheritdoc
171171
*/
172-
public function getTreatment($key, $featureName, array $attributes = null)
172+
public function getTreatment($key, $featureName, ?array $attributes = null)
173173
{
174174
try {
175175
$result = $this->doEvaluation(
@@ -188,7 +188,7 @@ public function getTreatment($key, $featureName, array $attributes = null)
188188
/**
189189
* @inheritdoc
190190
*/
191-
public function getTreatmentWithConfig($key, $featureFlagName, array $attributes = null)
191+
public function getTreatmentWithConfig($key, $featureFlagName, ?array $attributes = null)
192192
{
193193
try {
194194
return $this->doEvaluation(
@@ -213,7 +213,7 @@ public function getTreatmentWithConfig($key, $featureFlagName, array $attributes
213213
*
214214
* @return null|mixed
215215
*/
216-
private function doInputValidationForTreatments($key, $featureFlagNames, array $attributes = null, $operation)
216+
private function doInputValidationForTreatments($key, $featureFlagNames, $operation, ?array $attributes = null)
217217
{
218218
$featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, $operation);
219219
if (is_null($featureFlags)) {
@@ -264,7 +264,7 @@ private function registerData($impressions, $attributes)
264264
*/
265265
private function doEvaluationForTreatments($operation, $key, $featureFlagNames, $attributes)
266266
{
267-
$inputValidation = $this->doInputValidationForTreatments($key, $featureFlagNames, $attributes, $operation);
267+
$inputValidation = $this->doInputValidationForTreatments($key, $featureFlagNames, $operation, $attributes);
268268
if (is_null($inputValidation)) {
269269
return array();
270270
}
@@ -301,7 +301,7 @@ private function doEvaluationForTreatments($operation, $key, $featureFlagNames,
301301
/**
302302
* @inheritdoc
303303
*/
304-
public function getTreatments($key, $featureFlagNames, array $attributes = null)
304+
public function getTreatments($key, $featureFlagNames, ?array $attributes = null)
305305
{
306306
try {
307307
return array_map(
@@ -325,7 +325,7 @@ function ($feature) {
325325
/**
326326
* @inheritdoc
327327
*/
328-
public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null)
328+
public function getTreatmentsWithConfig($key, $featureFlagNames, ?array $attributes = null)
329329
{
330330
try {
331331
return $this->doEvaluationForTreatments(
@@ -396,7 +396,7 @@ public function track($key, $trafficType, $eventType, $value = null, $properties
396396
return false;
397397
}
398398

399-
public function getTreatmentsByFlagSets($key, $flagSets, array $attributes = null)
399+
public function getTreatmentsByFlagSets($key, $flagSets, ?array $attributes = null)
400400
{
401401
try {
402402
return array_map(
@@ -416,7 +416,7 @@ function ($feature) {
416416
}
417417
}
418418

419-
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, array $attributes = null)
419+
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, ?array $attributes = null)
420420
{
421421
try {
422422
return $this->doEvaluationByFlagSets(
@@ -431,7 +431,7 @@ public function getTreatmentsWithConfigByFlagSets($key, $flagSets, array $attrib
431431
}
432432
}
433433

434-
public function getTreatmentsByFlagSet($key, $flagSet, array $attributes = null)
434+
public function getTreatmentsByFlagSet($key, $flagSet, ?array $attributes = null)
435435
{
436436
try {
437437
return array_map(
@@ -451,7 +451,7 @@ function ($feature) {
451451
}
452452
}
453453

454-
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, array $attributes = null)
454+
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, ?array $attributes = null)
455455
{
456456
try {
457457
return $this->doEvaluationByFlagSets(
@@ -466,7 +466,7 @@ public function getTreatmentsWithConfigByFlagSet($key, $flagSet, array $attribut
466466
}
467467
}
468468

469-
private function doInputValidationByFlagSets($key, $flagSets, array $attributes = null, $operation)
469+
private function doInputValidationByFlagSets($key, $flagSets, $operation, ?array $attributes = null)
470470
{
471471
$key = InputValidator::validateKey($key, $operation);
472472
if (is_null($key) || !InputValidator::validAttributes($attributes, $operation)) {
@@ -487,7 +487,7 @@ private function doInputValidationByFlagSets($key, $flagSets, array $attributes
487487

488488
private function doEvaluationByFlagSets($operation, $key, $flagSets, $attributes)
489489
{
490-
$inputValidation = $this->doInputValidationByFlagSets($key, $flagSets, $attributes, $operation);
490+
$inputValidation = $this->doInputValidationByFlagSets($key, $flagSets, $operation, $attributes);
491491
if (is_null($inputValidation)) {
492492
return array();
493493
}

src/SplitIO/Sdk/ClientInterface.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface ClientInterface
3636
* @param $attributes
3737
* @return string
3838
*/
39-
public function getTreatment($key, $featureFlagName, array $attributes = null);
39+
public function getTreatment($key, $featureFlagName, ?array $attributes = null);
4040

4141
/**
4242
* Returns an object with the treatment to show this id for this feature
@@ -76,7 +76,7 @@ public function getTreatment($key, $featureFlagName, array $attributes = null);
7676
* @param $attributes
7777
* @return array
7878
*/
79-
public function getTreatmentWithConfig($key, $featureFlagName, array $attributes = null);
79+
public function getTreatmentWithConfig($key, $featureFlagName, ?array $attributes = null);
8080

8181
/**
8282
* Returns an associative array which each key will be
@@ -109,7 +109,7 @@ public function getTreatmentWithConfig($key, $featureFlagName, array $attributes
109109
* @param $attributes
110110
* @return array
111111
*/
112-
public function getTreatments($key, $featureFlagNames, array $attributes = null);
112+
public function getTreatments($key, $featureFlagNames, ?array $attributes = null);
113113

114114
/**
115115
* Returns an associative array which each key will be
@@ -144,7 +144,7 @@ public function getTreatments($key, $featureFlagNames, array $attributes = null)
144144
* @param $attributes
145145
* @return array
146146
*/
147-
public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null);
147+
public function getTreatmentsWithConfig($key, $featureFlagNames, ?array $attributes = null);
148148

149149
/**
150150
* Returns an associative array which each key will be
@@ -172,7 +172,7 @@ public function getTreatmentsWithConfig($key, $featureFlagNames, array $attribut
172172
* @param $attributes
173173
* @return array
174174
*/
175-
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, array $attributes = null);
175+
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, ?array $attributes = null);
176176

177177
/**
178178
* Returns an associative array which each key will be
@@ -200,7 +200,7 @@ public function getTreatmentsWithConfigByFlagSets($key, $flagSets, array $attrib
200200
* @param $attributes
201201
* @return array
202202
*/
203-
public function getTreatmentsByFlagSets($key, $flagSets, array $attributes = null);
203+
public function getTreatmentsByFlagSets($key, $flagSets, ?array $attributes = null);
204204

205205
/**
206206
* Returns an associative array which each key will be
@@ -234,7 +234,7 @@ public function getTreatmentsByFlagSets($key, $flagSets, array $attributes = nul
234234
* @param $attributes
235235
* @return array
236236
*/
237-
public function getTreatmentsByFlagSet($key, $flagSet, array $attributes = null);
237+
public function getTreatmentsByFlagSet($key, $flagSet, ?array $attributes = null);
238238

239239
/**
240240
* Returns an associative array which each key will be
@@ -262,7 +262,7 @@ public function getTreatmentsByFlagSet($key, $flagSet, array $attributes = null)
262262
* @param $attributes
263263
* @return array
264264
*/
265-
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, array $attributes = null);
265+
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, ?array $attributes = null);
266266

267267
/**
268268
* A short-hand for

src/SplitIO/Sdk/Evaluator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private function fetchFeatureFlagNamesByFlagSets($flagSets)
6363
return array_values(array_unique($toReturn));
6464
}
6565

66-
public function evaluateFeature($matchingKey, $bucketingKey, $featureName, array $attributes = null)
66+
public function evaluateFeature($matchingKey, $bucketingKey, $featureName, ?array $attributes = null)
6767
{
6868
$timeStart = Metrics::startMeasuringLatency();
6969
$split = $this->fetchSplit($featureName);
@@ -72,7 +72,7 @@ public function evaluateFeature($matchingKey, $bucketingKey, $featureName, array
7272
return $toReturn;
7373
}
7474

75-
public function evaluateFeatures($matchingKey, $bucketingKey, array $featureNames, array $attributes = null)
75+
public function evaluateFeatures($matchingKey, $bucketingKey, array $featureNames, ?array $attributes = null)
7676
{
7777
$toReturn = array(
7878
'evaluations' => array(),
@@ -86,7 +86,7 @@ public function evaluateFeatures($matchingKey, $bucketingKey, array $featureName
8686
return $toReturn;
8787
}
8888

89-
public function evaluateFeaturesByFlagSets($matchingKey, $bucketingKey, array $flagSets, array $attributes = null)
89+
public function evaluateFeaturesByFlagSets($matchingKey, $bucketingKey, array $flagSets, ?array $attributes = null)
9090
{
9191
$timeStart = Metrics::startMeasuringLatency();
9292
$featureFlagNames = $this->fetchFeatureFlagNamesByFlagSets($flagSets);
@@ -95,7 +95,7 @@ public function evaluateFeaturesByFlagSets($matchingKey, $bucketingKey, array $f
9595
return $toReturn;
9696
}
9797

98-
private function evalTreatment($key, $bucketingKey, $split, array $attributes = null)
98+
private function evalTreatment($key, $bucketingKey, $split, ?array $attributes = null)
9999
{
100100
$result = array(
101101
'treatment' => TreatmentEnum::CONTROL,

src/SplitIO/Sdk/LocalhostClient.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function doValidation($key, $featureFlagName, $operation)
136136
/**
137137
* @inheritdoc
138138
*/
139-
public function getTreatment($key, $featureFlagName, array $attributes = null)
139+
public function getTreatment($key, $featureFlagName, ?array $attributes = null)
140140
{
141141
$key = $this->doValidation($key, $featureFlagName, "getTreatment");
142142
if (is_null($key)) {
@@ -157,7 +157,7 @@ public function getTreatment($key, $featureFlagName, array $attributes = null)
157157
/**
158158
* @inheritdoc
159159
*/
160-
public function getTreatmentWithConfig($key, $featureFlagName, array $attributes = null)
160+
public function getTreatmentWithConfig($key, $featureFlagName, ?array $attributes = null)
161161
{
162162
$treatmentResult = array(
163163
"treatment" => TreatmentEnum::CONTROL,
@@ -189,7 +189,7 @@ public function getTreatmentWithConfig($key, $featureFlagName, array $attributes
189189
/**
190190
* @inheritdoc
191191
*/
192-
public function getTreatments($key, $featureFlagNames, array $attributes = null)
192+
public function getTreatments($key, $featureFlagNames, ?array $attributes = null)
193193
{
194194
$result = array();
195195

@@ -213,7 +213,7 @@ public function getTreatments($key, $featureFlagNames, array $attributes = null)
213213
/**
214214
* @inheritdoc
215215
*/
216-
public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null)
216+
public function getTreatmentsWithConfig($key, $featureFlagNames, ?array $attributes = null)
217217
{
218218
$result = array();
219219

@@ -258,25 +258,25 @@ public function track($key, $trafficType, $eventType, $value = null)
258258
return true;
259259
}
260260

261-
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, array $attributes = null)
261+
public function getTreatmentsWithConfigByFlagSets($key, $flagSets, ?array $attributes = null)
262262
{
263263
// no-op
264264
return array();
265265
}
266266

267-
public function getTreatmentsByFlagSets($key, $flagSets, array $attributes = null)
267+
public function getTreatmentsByFlagSets($key, $flagSets, ?array $attributes = null)
268268
{
269269
// no-op
270270
return array();
271271
}
272272

273-
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, array $attributes = null)
273+
public function getTreatmentsWithConfigByFlagSet($key, $flagSet, ?array $attributes = null)
274274
{
275275
// no-op
276276
return array();
277277
}
278278

279-
public function getTreatmentsByFlagSet($key, $flagSet, array $attributes = null)
279+
public function getTreatmentsByFlagSet($key, $flagSet, ?array $attributes = null)
280280
{
281281
// no-op
282282
return array();

0 commit comments

Comments
 (0)