@@ -80,20 +80,17 @@ final public function getNamespace(): string
8080
8181 /**
8282 * Returns new nested cache object.
83- * @return static
8483 */
85- public function derive (string $ namespace )
84+ public function derive (string $ namespace ): static
8685 {
8786 return new static ($ this ->storage , $ this ->namespace . $ namespace );
8887 }
8988
9089
9190 /**
9291 * Reads the specified item from the cache or generate it.
93- * @param mixed $key
94- * @return mixed
9592 */
96- public function load ($ key , ?callable $ generator = null )
93+ public function load (mixed $ key , ?callable $ generator = null ): mixed
9794 {
9895 $ storageKey = $ this ->generateKey ($ key );
9996 $ data = $ this ->storage ->read ($ storageKey );
@@ -170,12 +167,10 @@ public function bulkLoad(array $keys, ?callable $generator = null): array
170167 * - Cache::Items => (array|string) cache items
171168 * - Cache::Consts => (array|string) cache items
172169 *
173- * @param mixed $key
174- * @param mixed $data
175170 * @return mixed value itself
176171 * @throws Nette\InvalidArgumentException
177172 */
178- public function save ($ key , $ data , ?array $ dependencies = null )
173+ public function save (mixed $ key , mixed $ data , ?array $ dependencies = null ): mixed
179174 {
180175 $ key = $ this ->generateKey ($ key );
181176
@@ -191,6 +186,7 @@ public function save($key, $data, ?array $dependencies = null)
191186
192187 if ($ data === null ) {
193188 $ this ->storage ->remove ($ key );
189+ return null ;
194190 } else {
195191 $ dependencies = $ this ->completeDependencies ($ dependencies );
196192 if (isset ($ dependencies [self ::Expire]) && $ dependencies [self ::Expire] <= 0 ) {
@@ -254,9 +250,8 @@ private function completeDependencies(?array $dp): array
254250
255251 /**
256252 * Removes item from the cache.
257- * @param mixed $key
258253 */
259- public function remove ($ key ): void
254+ public function remove (mixed $ key ): void
260255 {
261256 $ this ->save ($ key , null );
262257 }
@@ -282,9 +277,8 @@ public function clean(?array $conditions = null): void
282277
283278 /**
284279 * Caches results of function/method calls.
285- * @return mixed
286280 */
287- public function call (callable $ function )
281+ public function call (callable $ function ): mixed
288282 {
289283 $ key = func_get_args ();
290284 if (is_array ($ function ) && is_object ($ function [0 ])) {
@@ -316,9 +310,8 @@ public function wrap(callable $function, ?array $dependencies = null): \Closure
316310
317311 /**
318312 * Starts the output cache.
319- * @param mixed $key
320313 */
321- public function capture ($ key ): ?OutputHelper
314+ public function capture (mixed $ key ): ?OutputHelper
322315 {
323316 $ data = $ this ->load ($ key );
324317 if ($ data === null ) {
0 commit comments