Skip to content

Commit 00eb15c

Browse files
FarhanAnjum-optiBenjamin Schoch
and
Benjamin Schoch
authored
[FSSDK-10015] Fix: Explicitly define class properties (#288)
* explicitly define properties * unit test fixes --------- Co-authored-by: Benjamin Schoch <[email protected]>
1 parent 363cb85 commit 00eb15c

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Diff for: src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class OptimizelyConfigService
8383
*/
8484
private readonly LoggerInterface $logger;
8585

86+
private ProjectConfigInterface $projectConfig;
87+
8688
public function __construct(ProjectConfigInterface $projectConfig, LoggerInterface $logger = null)
8789
{
8890
$this->experiments = $projectConfig->getAllExperiments();

Diff for: src/Optimizely/Utils/CustomAttributeConditionEvaluator.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
use Monolog\Logger;
2121
use Optimizely\Enums\CommonAudienceEvaluationLogs as logs;
22+
use Optimizely\Logger\LoggerInterface;
2223
use Optimizely\Utils\SemVersionConditionEvaluator;
2324
use Optimizely\Utils\Validator;
2425

@@ -44,13 +45,15 @@ class CustomAttributeConditionEvaluator
4445
*/
4546
protected $userAttributes;
4647

48+
private LoggerInterface $logger;
49+
4750
/**
4851
* CustomAttributeConditionEvaluator constructor
4952
*
5053
* @param array $userAttributes Associative array of user attributes to values.
5154
* @param $logger LoggerInterface.
5255
*/
53-
public function __construct(array $userAttributes, $logger)
56+
public function __construct(array $userAttributes, LoggerInterface $logger)
5457
{
5558
$this->userAttributes = $userAttributes;
5659
$this->logger = $logger;

Diff for: tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
use Monolog\Logger;
2121
use Optimizely\Utils\CustomAttributeConditionEvaluator;
2222
use PHPUnit\Framework\TestCase;
23+
use Optimizely\Logger\LoggerInterface;
2324

2425
class CustomAttributeConditionEvaluatorLoggingTest extends TestCase
2526
{
2627
protected function setUp() :void
2728
{
28-
$this->loggerMock = $this->getMockBuilder(NoOpLogger::class)
29+
$this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
2930
->setMethods(array('log'))
3031
->getMock();
3132
}

Diff for: tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919

2020
use Optimizely\Utils\CustomAttributeConditionEvaluator;
2121
use PHPUnit\Framework\TestCase;
22+
use Optimizely\Logger\LoggerInterface;
2223

2324
class CustomAttributeConditionEvaluatorTest extends TestCase
2425
{
2526
protected function setUp() : void
2627
{
27-
$this->loggerMock = $this->getMockBuilder(NoOpLogger::class)
28+
$this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
2829
->setMethods(array('log'))
2930
->getMock();
3031

0 commit comments

Comments
 (0)