@@ -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 );
@@ -158,12 +155,10 @@ public function bulkLoad(array $keys, ?callable $generator = null): array
158155 * - Cache::ITEMS => (array|string) cache items
159156 * - Cache::CONSTS => (array|string) cache items
160157 *
161- * @param mixed $key
162- * @param mixed $data
163158 * @return mixed value itself
164159 * @throws Nette\InvalidArgumentException
165160 */
166- public function save ($ key , $ data , ?array $ dependencies = null )
161+ public function save (mixed $ key , mixed $ data , ?array $ dependencies = null ): mixed
167162 {
168163 $ key = $ this ->generateKey ($ key );
169164
@@ -179,6 +174,7 @@ public function save($key, $data, ?array $dependencies = null)
179174
180175 if ($ data === null ) {
181176 $ this ->storage ->remove ($ key );
177+ return null ;
182178 } else {
183179 $ dependencies = $ this ->completeDependencies ($ dependencies );
184180 if (isset ($ dependencies [self ::EXPIRATION ]) && $ dependencies [self ::EXPIRATION ] <= 0 ) {
@@ -242,9 +238,8 @@ private function completeDependencies(?array $dp): array
242238
243239 /**
244240 * Removes item from the cache.
245- * @param mixed $key
246241 */
247- public function remove ($ key ): void
242+ public function remove (mixed $ key ): void
248243 {
249244 $ this ->save ($ key , null );
250245 }
@@ -270,9 +265,8 @@ public function clean(?array $conditions = null): void
270265
271266 /**
272267 * Caches results of function/method calls.
273- * @return mixed
274268 */
275- public function call (callable $ function )
269+ public function call (callable $ function ): mixed
276270 {
277271 $ key = func_get_args ();
278272 if (is_array ($ function ) && is_object ($ function [0 ])) {
@@ -304,9 +298,8 @@ public function wrap(callable $function, ?array $dependencies = null): \Closure
304298
305299 /**
306300 * Starts the output cache.
307- * @param mixed $key
308301 */
309- public function capture ($ key ): ?OutputHelper
302+ public function capture (mixed $ key ): ?OutputHelper
310303 {
311304 $ data = $ this ->load ($ key );
312305 if ($ data === null ) {
0 commit comments