@@ -80,20 +80,17 @@ final public function getNamespace(): string
80
80
81
81
/**
82
82
* Returns new nested cache object.
83
- * @return static
84
83
*/
85
- public function derive (string $ namespace )
84
+ public function derive (string $ namespace ): static
86
85
{
87
86
return new static ($ this ->storage , $ this ->namespace . $ namespace );
88
87
}
89
88
90
89
91
90
/**
92
91
* Reads the specified item from the cache or generate it.
93
- * @param mixed $key
94
- * @return mixed
95
92
*/
96
- public function load ($ key , ?callable $ generator = null )
93
+ public function load (mixed $ key , ?callable $ generator = null ): mixed
97
94
{
98
95
$ storageKey = $ this ->generateKey ($ key );
99
96
$ data = $ this ->storage ->read ($ storageKey );
@@ -170,12 +167,10 @@ public function bulkLoad(array $keys, ?callable $generator = null): array
170
167
* - Cache::Items => (array|string) cache items
171
168
* - Cache::Consts => (array|string) cache items
172
169
*
173
- * @param mixed $key
174
- * @param mixed $data
175
170
* @return mixed value itself
176
171
* @throws Nette\InvalidArgumentException
177
172
*/
178
- public function save ($ key , $ data , ?array $ dependencies = null )
173
+ public function save (mixed $ key , mixed $ data , ?array $ dependencies = null ): mixed
179
174
{
180
175
$ key = $ this ->generateKey ($ key );
181
176
@@ -191,6 +186,7 @@ public function save($key, $data, ?array $dependencies = null)
191
186
192
187
if ($ data === null ) {
193
188
$ this ->storage ->remove ($ key );
189
+ return null ;
194
190
} else {
195
191
$ dependencies = $ this ->completeDependencies ($ dependencies );
196
192
if (isset ($ dependencies [self ::Expire]) && $ dependencies [self ::Expire] <= 0 ) {
@@ -254,9 +250,8 @@ private function completeDependencies(?array $dp): array
254
250
255
251
/**
256
252
* Removes item from the cache.
257
- * @param mixed $key
258
253
*/
259
- public function remove ($ key ): void
254
+ public function remove (mixed $ key ): void
260
255
{
261
256
$ this ->save ($ key , null );
262
257
}
@@ -282,9 +277,8 @@ public function clean(?array $conditions = null): void
282
277
283
278
/**
284
279
* Caches results of function/method calls.
285
- * @return mixed
286
280
*/
287
- public function call (callable $ function )
281
+ public function call (callable $ function ): mixed
288
282
{
289
283
$ key = func_get_args ();
290
284
if (is_array ($ function ) && is_object ($ function [0 ])) {
@@ -316,9 +310,8 @@ public function wrap(callable $function, ?array $dependencies = null): \Closure
316
310
317
311
/**
318
312
* Starts the output cache.
319
- * @param mixed $key
320
313
*/
321
- public function capture ($ key ): ?OutputHelper
314
+ public function capture (mixed $ key ): ?OutputHelper
322
315
{
323
316
$ data = $ this ->load ($ key );
324
317
if ($ data === null ) {
0 commit comments