From 4395dea2d2ebb50da42b06c57db37de918530ef2 Mon Sep 17 00:00:00 2001 From: Tamara Date: Wed, 20 May 2026 09:20:09 -0500 Subject: [PATCH 1/3] [FSSDK-12610] Fix: PHP 8.4 implicit nullable parameter deprecation warnings Use explicit nullable types (?Type) instead of implicit nullable (Type $param = null) to resolve deprecation warnings on PHP 8.4. Co-Authored-By: Claude Opus 4.6 --- src/Optimizely/DecisionService/DecisionService.php | 2 +- src/Optimizely/Optimizely.php | 12 ++++++------ .../HTTPProjectConfigManager.php | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Optimizely/DecisionService/DecisionService.php b/src/Optimizely/DecisionService/DecisionService.php index cb8f6bd6..182cd679 100644 --- a/src/Optimizely/DecisionService/DecisionService.php +++ b/src/Optimizely/DecisionService/DecisionService.php @@ -83,7 +83,7 @@ class DecisionService * @param LoggerInterface $logger * @param UserProfileServiceInterface $userProfileService */ - public function __construct(LoggerInterface $logger, UserProfileServiceInterface $userProfileService = null) + public function __construct(LoggerInterface $logger, ?UserProfileServiceInterface $userProfileService = null) { $this->_logger = $logger; $this->_bucketer = new Bucketer($logger); diff --git a/src/Optimizely/Optimizely.php b/src/Optimizely/Optimizely.php index 69833f56..8a6c166a 100644 --- a/src/Optimizely/Optimizely.php +++ b/src/Optimizely/Optimizely.php @@ -130,13 +130,13 @@ class Optimizely */ public function __construct( $datafile, - EventDispatcherInterface $eventDispatcher = null, - LoggerInterface $logger = null, - ErrorHandlerInterface $errorHandler = null, + ?EventDispatcherInterface $eventDispatcher = null, + ?LoggerInterface $logger = null, + ?ErrorHandlerInterface $errorHandler = null, $skipJsonValidation = false, - UserProfileServiceInterface $userProfileService = null, - ProjectConfigManagerInterface $configManager = null, - NotificationCenter $notificationCenter = null, + ?UserProfileServiceInterface $userProfileService = null, + ?ProjectConfigManagerInterface $configManager = null, + ?NotificationCenter $notificationCenter = null, $sdkKey = null, array $defaultDecideOptions = [] ) { diff --git a/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php b/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php index 83e5f839..5e56935e 100644 --- a/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php +++ b/src/Optimizely/ProjectConfigManager/HTTPProjectConfigManager.php @@ -89,9 +89,9 @@ public function __construct( $fetchOnInit = true, $datafile = null, $skipJsonValidation = false, - LoggerInterface $logger = null, - ErrorHandlerInterface $errorHandler = null, - NotificationCenter $notificationCenter = null, + ?LoggerInterface $logger = null, + ?ErrorHandlerInterface $errorHandler = null, + ?NotificationCenter $notificationCenter = null, $datafileAccessToken = null ) { $this->_skipJsonValidation = $skipJsonValidation; From c2b6fef8db3236ef9d36485c7493f416d9b31ed2 Mon Sep 17 00:00:00 2001 From: Tamara Date: Wed, 20 May 2026 09:39:06 -0500 Subject: [PATCH 2/3] [FSSDK-12610] Fix remaining implicit nullable parameters in Validator, VariableTypeUtils, DefaultEventDispatcher, OptimizelyConfigService Co-Authored-By: Claude Opus 4.6 --- src/Optimizely/Event/Dispatcher/DefaultEventDispatcher.php | 2 +- src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php | 2 +- src/Optimizely/Utils/Validator.php | 2 +- src/Optimizely/Utils/VariableTypeUtils.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Optimizely/Event/Dispatcher/DefaultEventDispatcher.php b/src/Optimizely/Event/Dispatcher/DefaultEventDispatcher.php index b5b4b7c3..a45a1074 100644 --- a/src/Optimizely/Event/Dispatcher/DefaultEventDispatcher.php +++ b/src/Optimizely/Event/Dispatcher/DefaultEventDispatcher.php @@ -36,7 +36,7 @@ class DefaultEventDispatcher implements EventDispatcherInterface */ private $httpClient; - public function __construct(HttpClient $httpClient = null) + public function __construct(?HttpClient $httpClient = null) { $this->httpClient = $httpClient ?: new HttpClient(); } diff --git a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php index c8d22c36..d6463ee2 100644 --- a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php +++ b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php @@ -85,7 +85,7 @@ class OptimizelyConfigService private ProjectConfigInterface $projectConfig; - public function __construct(ProjectConfigInterface $projectConfig, LoggerInterface $logger = null) + public function __construct(ProjectConfigInterface $projectConfig, ?LoggerInterface $logger = null) { $this->experiments = $projectConfig->getAllExperiments(); $this->featureFlags = $projectConfig->getFeatureFlags(); diff --git a/src/Optimizely/Utils/Validator.php b/src/Optimizely/Utils/Validator.php index ff2f1c5b..803bc25b 100644 --- a/src/Optimizely/Utils/Validator.php +++ b/src/Optimizely/Utils/Validator.php @@ -31,7 +31,7 @@ class Validator * * @return boolean Representing whether schema is valid or not. */ - public static function validateJsonSchema($datafile, LoggerInterface $logger = null) + public static function validateJsonSchema($datafile, ?LoggerInterface $logger = null) { $data = json_decode($datafile); diff --git a/src/Optimizely/Utils/VariableTypeUtils.php b/src/Optimizely/Utils/VariableTypeUtils.php index a6e534ef..faa9a1ea 100644 --- a/src/Optimizely/Utils/VariableTypeUtils.php +++ b/src/Optimizely/Utils/VariableTypeUtils.php @@ -24,7 +24,7 @@ class VariableTypeUtils { - public static function castStringToType($value, $variableType, LoggerInterface $logger = null) + public static function castStringToType($value, $variableType, ?LoggerInterface $logger = null) { if ($variableType == FeatureVariable::STRING_TYPE) { return $value; From a68bd24b03ee5e79a5a6f44d710f68efb8f8e85d Mon Sep 17 00:00:00 2001 From: Tamara Date: Wed, 20 May 2026 09:40:10 -0500 Subject: [PATCH 3/3] [FSSDK-12610] Update PHPDoc to reflect explicit nullable parameter types Co-Authored-By: Claude Opus 4.6 --- src/Optimizely/DecisionService/DecisionService.php | 2 +- src/Optimizely/Optimizely.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Optimizely/DecisionService/DecisionService.php b/src/Optimizely/DecisionService/DecisionService.php index 182cd679..6b7d9259 100644 --- a/src/Optimizely/DecisionService/DecisionService.php +++ b/src/Optimizely/DecisionService/DecisionService.php @@ -81,7 +81,7 @@ class DecisionService * DecisionService constructor. * * @param LoggerInterface $logger - * @param UserProfileServiceInterface $userProfileService + * @param ?UserProfileServiceInterface $userProfileService */ public function __construct(LoggerInterface $logger, ?UserProfileServiceInterface $userProfileService = null) { diff --git a/src/Optimizely/Optimizely.php b/src/Optimizely/Optimizely.php index 8a6c166a..968e1a0a 100644 --- a/src/Optimizely/Optimizely.php +++ b/src/Optimizely/Optimizely.php @@ -119,13 +119,13 @@ class Optimizely * Optimizely constructor for managing Feature Experimentation PHP projects. * * @param $datafile string JSON string representing the project. - * @param $eventDispatcher EventDispatcherInterface - * @param $logger LoggerInterface - * @param $errorHandler ErrorHandlerInterface + * @param $eventDispatcher ?EventDispatcherInterface + * @param $logger ?LoggerInterface + * @param $errorHandler ?ErrorHandlerInterface * @param $skipJsonValidation boolean representing whether JSON schema validation needs to be performed. - * @param $userProfileService UserProfileServiceInterface - * @param $configManager ProjectConfigManagerInterface provides ProjectConfig through getConfig method. - * @param $notificationCenter NotificationCenter + * @param $userProfileService ?UserProfileServiceInterface + * @param $configManager ?ProjectConfigManagerInterface provides ProjectConfig through getConfig method. + * @param $notificationCenter ?NotificationCenter * @param $sdkKey string uniquely identifying the datafile corresponding to project and environment combination. Must provide at least one of datafile or sdkKey. */ public function __construct(