Skip to content

Commit

Permalink
Remove NullTagAwareAdapter and update bindings
Browse files Browse the repository at this point in the history
Deleted the NullTagAwareAdapter class and changed references to it throughout the codebase. Adjusted the etagPool initialization and modified DI bindings to handle null instances properly. Ensured compatibility with TagAwareAdapterInterface.
  • Loading branch information
koriym committed Sep 10, 2024
1 parent fb214bf commit 23f475f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 97 deletions.
93 changes: 0 additions & 93 deletions src/NullTagAwareAdapter.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/QueryRepositoryModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function configure(): void
'tagsPool' => EtagPool::class,
],
)->in(Scope::SINGLETON);
$this->bind(TagAwareAdapterInterface::class)->annotatedWith(EtagPool::class)->to(NullTagAwareAdapter::class);
$this->bind(TagAwareAdapterInterface::class)->annotatedWith(EtagPool::class)->toInstance(null);
// core
$this->bind(QueryRepositoryInterface::class)->to(QueryRepository::class)->in(Scope::SINGLETON);
$this->bind(CacheDependencyInterface::class)->to(CacheDependency::class);
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function initializePools(ProviderInterface $roPoolProvider, ProviderInte
$this->etagPoolProvider = $etagPoolProvider;
$this->roPool = $roPoolProvider->get();
$etagPool = $this->etagPoolProvider->get();
$this->etagPool = $etagPool instanceof NullTagAwareAdapter ? $this->roPool : $etagPool;
$this->etagPool = $etagPool instanceof TagAwareAdapterInterface ? $etagPool : $this->roPool; // @phpstan-ignore-line
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/StorageRedisDsnModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace BEAR\QueryRepository;

use BEAR\RepositoryModule\Annotation\EtagPool;
use BEAR\RepositoryModule\Annotation\RedisDsn;
use BEAR\RepositoryModule\Annotation\RedisDsnOptions;
use BEAR\RepositoryModule\Annotation\ResourceObjectPool;
Expand Down Expand Up @@ -70,7 +69,6 @@ protected function configure(): void
]);
$this->bind(ProviderInterface::class)->annotatedWith('redis')->to(RedisDsnProvider::class);
$this->bind()->annotatedWith('redis')->toProvider(RedisDsnProvider::class);
$this->bind(TagAwareAdapterInterface::class)->annotatedWith(EtagPool::class)->to(NullTagAwareAdapter::class);
$this->bind(TagAwareAdapterInterface::class)->annotatedWith(ResourceObjectPool::class)->toConstructor(
RedisTagAwareAdapter::class,
[
Expand Down

0 comments on commit 23f475f

Please sign in to comment.