diff --git a/src/Illuminate/Contracts/Cache/Repository.php b/src/Illuminate/Contracts/Cache/Repository.php index 5b78af57e4b0..26b0d0fed0c7 100644 --- a/src/Illuminate/Contracts/Cache/Repository.php +++ b/src/Illuminate/Contracts/Cache/Repository.php @@ -10,9 +10,11 @@ interface Repository extends CacheInterface /** * Retrieve an item from the cache and delete it. * + * @template TCached of mixed + * * @param string $key - * @param mixed $default - * @return mixed + * @param null|TCached $default + * @return null|TCached */ public function pull($key, $default = null); @@ -66,28 +68,34 @@ public function forever($key, $value); /** * Get an item from the cache, or execute the given Closure and store the result. * + * @template TCached of mixed + * * @param string $key * @param \DateTimeInterface|\DateInterval|int|null $ttl - * @param \Closure $callback - * @return mixed + * @param \Closure(): TCached $callback + * @return TCached */ public function remember($key, $ttl, Closure $callback); /** * Get an item from the cache, or execute the given Closure and store the result forever. * + * @template TCached of mixed + * * @param string $key - * @param \Closure $callback - * @return mixed + * @param \Closure(): TCached $callback + * @return TCached */ public function sear($key, Closure $callback); /** * Get an item from the cache, or execute the given Closure and store the result forever. * + * @template TCached of mixed + * * @param string $key - * @param \Closure $callback - * @return mixed + * @param \Closure(): TCached $callback + * @return TCached */ public function rememberForever($key, Closure $callback); diff --git a/src/Illuminate/Support/Facades/Cache.php b/src/Illuminate/Support/Facades/Cache.php index 70aa1dc48395..7cc91f38088c 100755 --- a/src/Illuminate/Support/Facades/Cache.php +++ b/src/Illuminate/Support/Facades/Cache.php @@ -3,6 +3,8 @@ namespace Illuminate\Support\Facades; /** + * @template TCached of mixed + * * @method static \Illuminate\Cache\TaggedCache tags(array|mixed $names) * @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, mixed $owner = null) * @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner) @@ -17,11 +19,11 @@ * @method static bool put(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl = null) * @method static int|bool decrement(string $key, $value = 1) * @method static int|bool increment(string $key, $value = 1) - * @method static mixed get(string $key, mixed $default = null) - * @method static mixed pull(string $key, mixed $default = null) - * @method static mixed remember(string $key, \DateTimeInterface|\DateInterval|int $ttl, \Closure $callback) - * @method static mixed rememberForever(string $key, \Closure $callback) - * @method static mixed sear(string $key, \Closure $callback) + * @method static null|TCached get(string $key, TCached $default = null) + * @method static null|TCached pull(string $key, TCached $default = null) + * @method static TCached remember(string $key, \DateTimeInterface|\DateInterval|int $ttl, \Closure(): TCached $callback) + * @method static TCached rememberForever(string $key, \Closure(): TCached $callback) + * @method static TCached sear(string $key, \Closure(): TCached $callback) * * @see \Illuminate\Cache\CacheManager * @see \Illuminate\Cache\Repository