diff --git a/src/AggregateRoot.php b/src/AggregateRoot.php index 4fc766b..91ffcb3 100644 --- a/src/AggregateRoot.php +++ b/src/AggregateRoot.php @@ -8,6 +8,12 @@ class AggregateRoot implements AggregateRootEventsEmitterInterface { protected array $events = []; + + public function getEvents(): array + { + return $this->events; + } + public function emitEvents(): array { $events = $this->events; diff --git a/src/Bitrix24Accounts/Entity/Bitrix24Account.php b/src/Bitrix24Accounts/Entity/Bitrix24Account.php index 6e31484..9934d7c 100644 --- a/src/Bitrix24Accounts/Entity/Bitrix24Account.php +++ b/src/Bitrix24Accounts/Entity/Bitrix24Account.php @@ -33,7 +33,7 @@ class Bitrix24Account extends AggregateRoot implements Bitrix24AccountInterface { - private array|Scope $applicationScope; + private Scope $applicationScope; private ?string $applicationToken = null; @@ -57,8 +57,7 @@ public function __construct( bool $isEmitBitrix24AccountCreatedEvent = false ) { $this->authToken = $authToken; - $array = $applicationScope->getScopeCodes(); - $this->applicationScope = $array; + $this->applicationScope = $applicationScope->getScopeCodes(); $this->addAccountCreatedEventIfNeeded($isEmitBitrix24AccountCreatedEvent); } @@ -148,8 +147,7 @@ public function getApplicationVersion(): int #[\Override] public function getApplicationScope(): Scope { - return new Scope($this->applicationScope); - // return $this->applicationScope; + return $this->applicationScope; } /** @@ -346,10 +344,6 @@ public function getComment(): ?string return $this->comment; } - public function getEvents(): array - { - return $this->events; - } private function addAccountCreatedEventIfNeeded(bool $isEmitCreatedEvent): void { diff --git a/tests/Functional/Bitrix24Accounts/FetcherTest.php b/tests/Functional/Bitrix24Accounts/FetcherTest.php index fa1012c..8982d55 100644 --- a/tests/Functional/Bitrix24Accounts/FetcherTest.php +++ b/tests/Functional/Bitrix24Accounts/FetcherTest.php @@ -52,9 +52,7 @@ protected function setUp(): void public function testListReturnsPaginatedResults(): void { - $bitrix24Account = (new Bitrix24AccountBuilder()) - ->build() - ; + $bitrix24Account = (new Bitrix24AccountBuilder())->build(); $this->repository->save($bitrix24Account); $this->flusher->flush();