Skip to content

[FSSDK-10015] Fix: Explicitly define class properties #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion src/Optimizely/Utils/CustomAttributeConditionEvaluator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down