@@ -70,6 +70,7 @@ public function psr(): \Psr\SimpleCache\CacheInterface
7070 public function getOrSet ($ key , callable $ callable , $ ttl = null , Dependency $ dependency = null , float $ beta = 1.0 )
7171 {
7272 $ key = $ this ->keyNormalizer ->normalize ($ key );
73+ /** @var mixed */
7374 $ value = $ this ->getValue ($ key , $ beta );
7475
7576 return $ value ?? $ this ->setAndGet ($ key , $ callable , $ ttl , $ dependency );
@@ -100,6 +101,7 @@ private function getValue(string $key, float $beta)
100101 return null ;
101102 }
102103
104+ /** @var mixed */
103105 $ value = $ this ->psr ->getRaw ($ key );
104106
105107 if (is_array ($ value ) && isset ($ value [1 ]) && $ value [1 ] instanceof CacheItem) {
@@ -120,6 +122,8 @@ private function getValue(string $key, float $beta)
120122 *
121123 * @param string $key The unique key of this item in the cache.
122124 * @param callable $callable The callable or closure that will be used to generate a value to be cached.
125+ * @psalm-param callable(\Psr\SimpleCache\CacheInterface): mixed $callable
126+ *
123127 * @param DateInterval|int|null $ttl The TTL of this value. If not set, default value is used.
124128 * @param Dependency|null $dependency The dependency of the cache value.
125129 *
@@ -132,6 +136,7 @@ private function setAndGet(string $key, callable $callable, $ttl, ?Dependency $d
132136 {
133137 $ ttl = $ this ->normalizeTtl ($ ttl );
134138 $ ttl ??= $ this ->defaultTtl ;
139+ /** @var mixed */
135140 $ value = $ callable ($ this ->psr );
136141
137142 if ($ dependency !== null ) {
0 commit comments