1 | <?php |
||
8 | class CacheStorage implements Storage |
||
9 | { |
||
10 | /** |
||
11 | * @var \Illuminate\Contracts\Cache\Repository|\Illuminate\Contracts\Cache\Store |
||
12 | */ |
||
13 | protected $cache; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $tag; |
||
19 | |||
20 | /** |
||
21 | * @param \Illuminate\Cache\CacheManager $cache |
||
22 | * @param string $tag |
||
23 | */ |
||
24 | public function __construct(Repository $cache, $tag = 'jwt') |
||
29 | |||
30 | /** |
||
31 | * Add a new item into storage. |
||
32 | * |
||
33 | * @param string $key |
||
34 | * @param mixed $value |
||
35 | * @param int $minutes |
||
36 | * @return void |
||
37 | */ |
||
38 | public function add($key, $value, $minutes) |
||
42 | |||
43 | /** |
||
44 | * @param string $key |
||
45 | * @param mixed $value |
||
46 | * @return void |
||
47 | */ |
||
48 | public function forever($key, $value) |
||
52 | |||
53 | /** |
||
54 | * Check whether a key exists in storage. |
||
55 | * |
||
56 | * @param string $key |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function has($key) |
||
63 | |||
64 | /** |
||
65 | * Remove an item from storage. |
||
66 | * |
||
67 | * @param string $key |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function destroy($key) |
||
74 | |||
75 | /** |
||
76 | * Remove all items associated with the tag. |
||
77 | * |
||
78 | * @return void |
||
79 | */ |
||
80 | public function flush() |
||
84 | |||
85 | /** |
||
86 | * Return the cache instance with tags attached. |
||
87 | * |
||
88 | * @return \Illuminate\Contracts\Cache\Repository|\Illuminate\Contracts\Cache\Store |
||
89 | */ |
||
90 | protected function cache() |
||
98 | } |
||
99 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: