diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 02e30b23..97313876 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -19,14 +19,18 @@ jobs: path: 'home/runner/travisci-tools' ref: 'master' - name: set SDK Branch if PR + env: + HEAD_REF: ${{ github.head_ref }} if: ${{ github.event_name == 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "SDK_BRANCH=$HEAD_REF" >> $GITHUB_ENV - name: set SDK Branch if not pull request + env: + REF_NAME: ${{github.ref_name}} if: ${{ github.event_name != 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "SDK_BRANCH=$REF_NAME" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=$REF_NAME}" >> $GITHUB_ENV - name: Trigger build env: SDK: php diff --git a/CHANGELOG.md b/CHANGELOG.md index 34678e01..c71b807f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Optimizely PHP SDK Changelog +## 4.0.2 +March 14, 2025 + +* Fix: Explicitly define class properties #288 + ## 4.0.1 December 4, 2023 diff --git a/src/Optimizely/Event/Builder/EventBuilder.php b/src/Optimizely/Event/Builder/EventBuilder.php index cc1e2e4c..5b7b5061 100644 --- a/src/Optimizely/Event/Builder/EventBuilder.php +++ b/src/Optimizely/Event/Builder/EventBuilder.php @@ -39,7 +39,7 @@ class EventBuilder /** * @const string Version of the Optimizely PHP SDK. */ - const SDK_VERSION = '4.0.1'; + const SDK_VERSION = '4.0.2'; /** * @var string URL to send event to. diff --git a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php index 2d29698a..c8d22c36 100644 --- a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php +++ b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php @@ -83,6 +83,8 @@ class OptimizelyConfigService */ private readonly LoggerInterface $logger; + private ProjectConfigInterface $projectConfig; + public function __construct(ProjectConfigInterface $projectConfig, LoggerInterface $logger = null) { $this->experiments = $projectConfig->getAllExperiments(); diff --git a/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php b/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php index c3b885f8..cdb5315e 100644 --- a/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php +++ b/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php @@ -19,6 +19,7 @@ use Monolog\Logger; use Optimizely\Enums\CommonAudienceEvaluationLogs as logs; +use Optimizely\Logger\LoggerInterface; use Optimizely\Utils\SemVersionConditionEvaluator; use Optimizely\Utils\Validator; @@ -44,13 +45,15 @@ class CustomAttributeConditionEvaluator */ protected $userAttributes; + private LoggerInterface $logger; + /** * CustomAttributeConditionEvaluator constructor * * @param array $userAttributes Associative array of user attributes to values. * @param $logger LoggerInterface. */ - public function __construct(array $userAttributes, $logger) + public function __construct(array $userAttributes, LoggerInterface $logger) { $this->userAttributes = $userAttributes; $this->logger = $logger; diff --git a/tests/EventTests/EventBuilderTest.php b/tests/EventTests/EventBuilderTest.php index 967c5893..87f7e100 100644 --- a/tests/EventTests/EventBuilderTest.php +++ b/tests/EventTests/EventBuilderTest.php @@ -69,7 +69,7 @@ protected function setUp() : void ]], 'revision' => '15', 'client_name' => 'php-sdk', - 'client_version' => '4.0.1', + 'client_version' => '4.0.2', 'anonymize_ip'=> false, 'enrich_decisions' => true, ]; diff --git a/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php b/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php index cdf0ee89..f9c6ad86 100644 --- a/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php +++ b/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php @@ -20,12 +20,13 @@ use Monolog\Logger; use Optimizely\Utils\CustomAttributeConditionEvaluator; use PHPUnit\Framework\TestCase; +use Optimizely\Logger\LoggerInterface; class CustomAttributeConditionEvaluatorLoggingTest extends TestCase { protected function setUp() :void { - $this->loggerMock = $this->getMockBuilder(NoOpLogger::class) + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) ->setMethods(array('log')) ->getMock(); } diff --git a/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php b/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php index fabf6828..3900f082 100644 --- a/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php +++ b/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php @@ -19,12 +19,13 @@ use Optimizely\Utils\CustomAttributeConditionEvaluator; use PHPUnit\Framework\TestCase; +use Optimizely\Logger\LoggerInterface; class CustomAttributeConditionEvaluatorTest extends TestCase { protected function setUp() : void { - $this->loggerMock = $this->getMockBuilder(NoOpLogger::class) + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) ->setMethods(array('log')) ->getMock();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: