Skip to content

Commit 2feafcd

Browse files
committed
improve type in driver and trait
1 parent 15cc97e commit 2feafcd

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Concerns/CacheObjectActions.php

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public function delete(): bool
4040
->delete($this);
4141
}
4242

43+
/**
44+
* @return Driver<TValue>
45+
*/
4346
protected function resolveDriver(): Driver
4447
{
4548
return app()->make('cache-driver');

src/Contracts/Driver.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,24 @@
44

55
namespace EriBloo\CacheObjects\Contracts;
66

7+
/**
8+
* @template TValue
9+
*/
710
interface Driver
811
{
912
/**
10-
* @template TValue
11-
*
1213
* @param TValue $value
1314
* @param CacheObject<TValue> $cacheObject
1415
*/
1516
public function set(mixed $value, CacheObject $cacheObject): string;
1617

1718
/**
18-
* @template TValue
19-
*
2019
* @param CacheObject<TValue> $cacheObject
2120
* @return TValue|null
2221
*/
2322
public function get(CacheObject $cacheObject): mixed;
2423

2524
/**
26-
* @template TValue
27-
*
2825
* @param CacheObject<TValue> $cacheObject
2926
*/
3027
public function delete(CacheObject $cacheObject): bool;

src/Drivers/CacheDriver.php

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
use EriBloo\CacheObjects\Events\CacheObjectStored;
1313
use Illuminate\Contracts\Cache\Store;
1414

15+
/**
16+
* @template TValue
17+
*
18+
* @implements Driver<TValue>
19+
*/
1520
final class CacheDriver implements Driver
1621
{
1722
public function __construct(

0 commit comments

Comments
 (0)