@@ -68,20 +68,17 @@ final public function getNamespace(): string
6868
6969 /**
7070 * Returns new nested cache object.
71- * @return static
7271 */
73- public function derive (string $ namespace )
72+ public function derive (string $ namespace ): static
7473 {
7574 return new static ($ this ->storage , $ this ->namespace . $ namespace );
7675 }
7776
7877
7978 /**
8079 * Reads the specified item from the cache or generate it.
81- * @param mixed $key
82- * @return mixed
8380 */
84- public function load ($ key , callable $ generator = null )
81+ public function load (mixed $ key , callable $ generator = null ): mixed
8582 {
8683 $ storageKey = $ this ->generateKey ($ key );
8784 $ data = $ this ->storage ->read ($ storageKey );
@@ -153,12 +150,10 @@ public function bulkLoad(array $keys, callable $generator = null): array
153150 * - Cache::ITEMS => (array|string) cache items
154151 * - Cache::CONSTS => (array|string) cache items
155152 *
156- * @param mixed $key
157- * @param mixed $data
158153 * @return mixed value itself
159154 * @throws Nette\InvalidArgumentException
160155 */
161- public function save ($ key , $ data , array $ dependencies = null )
156+ public function save (mixed $ key , mixed $ data , array $ dependencies = null ): mixed
162157 {
163158 $ key = $ this ->generateKey ($ key );
164159
@@ -174,6 +169,7 @@ public function save($key, $data, array $dependencies = null)
174169
175170 if ($ data === null ) {
176171 $ this ->storage ->remove ($ key );
172+ return null ;
177173 } else {
178174 $ dependencies = $ this ->completeDependencies ($ dependencies );
179175 if (isset ($ dependencies [self ::EXPIRATION ]) && $ dependencies [self ::EXPIRATION ] <= 0 ) {
@@ -233,9 +229,8 @@ private function completeDependencies(?array $dp): array
233229
234230 /**
235231 * Removes item from the cache.
236- * @param mixed $key
237232 */
238- public function remove ($ key ): void
233+ public function remove (mixed $ key ): void
239234 {
240235 $ this ->save ($ key , null );
241236 }
@@ -260,9 +255,8 @@ public function clean(array $conditions = null): void
260255
261256 /**
262257 * Caches results of function/method calls.
263- * @return mixed
264258 */
265- public function call (callable $ function )
259+ public function call (callable $ function ): mixed
266260 {
267261 $ key = func_get_args ();
268262 if (is_array ($ function ) && is_object ($ function [0 ])) {
@@ -292,9 +286,8 @@ public function wrap(callable $function, array $dependencies = null): \Closure
292286
293287 /**
294288 * Starts the output cache.
295- * @param mixed $key
296289 */
297- public function capture ($ key ): ?OutputHelper
290+ public function capture (mixed $ key ): ?OutputHelper
298291 {
299292 $ data = $ this ->load ($ key );
300293 if ($ data === null ) {
0 commit comments