Skip to content

Commit

Permalink
bugfix: add missing template param for StorageInterface
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Bösing <[email protected]>
  • Loading branch information
boesing committed Jun 21, 2024
1 parent 512dc92 commit 2cd2b28
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Storage/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

/**
* @template TOptions of AdapterOptions
* @template-implements StorageInterface<TOptions>
*/
abstract class AbstractAdapter implements StorageInterface, PluginAwareInterface
{
Expand Down
11 changes: 8 additions & 3 deletions src/Storage/StorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TOptions>
*/
interface FlushableStorageAdapterInterface extends StorageInterface, FlushableInterface
{
}
5 changes: 5 additions & 0 deletions test/Psr/TestAsset/FlushableNamespaceStorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<TOptions>
*/
interface FlushableNamespaceStorageInterface extends FlushableStorageInterface, ClearByNamespaceInterface
{
}
5 changes: 5 additions & 0 deletions test/Psr/TestAsset/FlushableStorageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<TOptions>
*/
interface FlushableStorageInterface extends StorageInterface, FlushableInterface, PluginAwareInterface
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<TOptions>
*/
interface AdapterWithStorageAndEventsCapableInterface extends StorageInterface, EventsCapableInterface
{
public function hasPlugin(PluginInterface $plugin): bool;
Expand Down

0 comments on commit 2cd2b28

Please sign in to comment.