@@ -81,20 +81,17 @@ final public function getNamespace(): string
8181
8282 /**
8383 * Returns new nested cache object.
84- * @return static
8584 */
86- public function derive (string $ namespace )
85+ public function derive (string $ namespace ): static
8786 {
8887 return new static ($ this ->storage , $ this ->namespace . $ namespace );
8988 }
9089
9190
9291 /**
9392 * Reads the specified item from the cache or generate it.
94- * @param mixed $key
95- * @return mixed
9693 */
97- public function load ($ key , ?callable $ generator = null )
94+ public function load (mixed $ key , ?callable $ generator = null ): mixed
9895 {
9996 $ storageKey = $ this ->generateKey ($ key );
10097 $ data = $ this ->storage ->read ($ storageKey );
@@ -170,12 +167,10 @@ public function bulkLoad(array $keys, ?callable $generator = null): array
170167 * - Cache::Files => (array|string) file names
171168 * - Cache::Items => (array|string) cache items
172169 * - Cache::Constants => (array|string) cache items
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