From 2cd2b2804e2315bacf1df6d373dd6ac3adcd8856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:28:05 +0200 Subject: [PATCH] bugfix: add missing template param for `StorageInterface` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- src/Storage/Adapter/AbstractAdapter.php | 1 + src/Storage/StorageInterface.php | 11 ++++++++--- .../TestAsset/FlushableStorageAdapterInterface.php | 5 +++++ .../TestAsset/FlushableNamespaceStorageInterface.php | 5 +++++ test/Psr/TestAsset/FlushableStorageInterface.php | 5 +++++ .../AdapterWithStorageAndEventsCapableInterface.php | 5 +++++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/Storage/Adapter/AbstractAdapter.php b/src/Storage/Adapter/AbstractAdapter.php index 086c9890..aebeba05 100644 --- a/src/Storage/Adapter/AbstractAdapter.php +++ b/src/Storage/Adapter/AbstractAdapter.php @@ -31,6 +31,7 @@ /** * @template TOptions of AdapterOptions + * @template-implements StorageInterface */ abstract class AbstractAdapter implements StorageInterface, PluginAwareInterface { diff --git a/src/Storage/StorageInterface.php b/src/Storage/StorageInterface.php index b3bb5ec2..114bf9c1 100644 --- a/src/Storage/StorageInterface.php +++ b/src/Storage/StorageInterface.php @@ -3,18 +3,23 @@ namespace Laminas\Cache\Storage; use Laminas\Cache\Exception\ExceptionInterface; +use Laminas\Cache\Storage\Adapter\AdapterOptions; /** - * NOTE: when providing integrish cache keys in iterables, internal array conversion might convert these to int, even + * NOTE: when providing integerish cache keys in iterables, internal array conversion might convert these to int, even * tho they were non-empty-string beforehand. See https://3v4l.org/GsiBl for more details. * * @psalm-type CacheKeyInIterableType = non-empty-string|int + * @template TOptions of AdapterOptions */ interface StorageInterface { - public function setOptions(iterable|Adapter\AdapterOptions $options): self; + public function setOptions(iterable|AdapterOptions $options): self; - public function getOptions(): Adapter\AdapterOptions; + /** + * @return TOptions + */ + public function getOptions(): AdapterOptions; /* reading */ /** diff --git a/test/Psr/CacheItemPool/TestAsset/FlushableStorageAdapterInterface.php b/test/Psr/CacheItemPool/TestAsset/FlushableStorageAdapterInterface.php index f93dba45..188bc335 100644 --- a/test/Psr/CacheItemPool/TestAsset/FlushableStorageAdapterInterface.php +++ b/test/Psr/CacheItemPool/TestAsset/FlushableStorageAdapterInterface.php @@ -4,9 +4,14 @@ namespace LaminasTest\Cache\Psr\CacheItemPool\TestAsset; +use Laminas\Cache\Storage\Adapter\AdapterOptions; use Laminas\Cache\Storage\FlushableInterface; use Laminas\Cache\Storage\StorageInterface; +/** + * @template TOptions of AdapterOptions + * @template-extends StorageInterface + */ interface FlushableStorageAdapterInterface extends StorageInterface, FlushableInterface { } diff --git a/test/Psr/TestAsset/FlushableNamespaceStorageInterface.php b/test/Psr/TestAsset/FlushableNamespaceStorageInterface.php index 5b1f518a..48f4aacc 100644 --- a/test/Psr/TestAsset/FlushableNamespaceStorageInterface.php +++ b/test/Psr/TestAsset/FlushableNamespaceStorageInterface.php @@ -4,8 +4,13 @@ namespace LaminasTest\Cache\Psr\TestAsset; +use Laminas\Cache\Storage\Adapter\AdapterOptions; use Laminas\Cache\Storage\ClearByNamespaceInterface; +/** + * @template TOptions of AdapterOptions + * @template-extends FlushableStorageInterface + */ interface FlushableNamespaceStorageInterface extends FlushableStorageInterface, ClearByNamespaceInterface { } diff --git a/test/Psr/TestAsset/FlushableStorageInterface.php b/test/Psr/TestAsset/FlushableStorageInterface.php index f2005537..b5d87364 100644 --- a/test/Psr/TestAsset/FlushableStorageInterface.php +++ b/test/Psr/TestAsset/FlushableStorageInterface.php @@ -4,10 +4,15 @@ namespace LaminasTest\Cache\Psr\TestAsset; +use Laminas\Cache\Storage\Adapter\AdapterOptions; use Laminas\Cache\Storage\FlushableInterface; use Laminas\Cache\Storage\PluginAwareInterface; use Laminas\Cache\Storage\StorageInterface; +/** + * @template TOptions of AdapterOptions + * @template-extends StorageInterface + */ interface FlushableStorageInterface extends StorageInterface, FlushableInterface, PluginAwareInterface { } diff --git a/test/Storage/Adapter/TestAsset/AdapterWithStorageAndEventsCapableInterface.php b/test/Storage/Adapter/TestAsset/AdapterWithStorageAndEventsCapableInterface.php index 5a16fd65..48cfe4e9 100644 --- a/test/Storage/Adapter/TestAsset/AdapterWithStorageAndEventsCapableInterface.php +++ b/test/Storage/Adapter/TestAsset/AdapterWithStorageAndEventsCapableInterface.php @@ -4,10 +4,15 @@ namespace LaminasTest\Cache\Storage\Adapter\TestAsset; +use Laminas\Cache\Storage\Adapter\AdapterOptions; use Laminas\Cache\Storage\Plugin\PluginInterface; use Laminas\Cache\Storage\StorageInterface; use Laminas\EventManager\EventsCapableInterface; +/** + * @template TOptions of AdapterOptions + * @template-extends StorageInterface + */ interface AdapterWithStorageAndEventsCapableInterface extends StorageInterface, EventsCapableInterface { public function hasPlugin(PluginInterface $plugin): bool;