@@ -149,13 +149,13 @@ interface CacheInterface
149149 * @throws \Psr\SimpleCache\InvalidArgumentException
150150 * MUST be thrown if the $key string is not a legal value.
151151 */
152- public function get($key, $default = null);
152+ public function get(string $key, mixed $default = null): mixed ;
153153
154154 /**
155155 * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
156156 *
157157 * @param string $key The key of the item to store.
158- * @param mixed $value The value of the item to store. Must be serializable.
158+ * @param mixed $value The value of the item to store, must be serializable.
159159 * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
160160 * the driver supports TTL then the library may set a default value
161161 * for it or let the driver take care of that.
@@ -165,7 +165,7 @@ interface CacheInterface
165165 * @throws \Psr\SimpleCache\InvalidArgumentException
166166 * MUST be thrown if the $key string is not a legal value.
167167 */
168- public function set($key, $value, $ttl = null);
168+ public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool ;
169169
170170 /**
171171 * Delete an item from the cache by its unique key.
@@ -177,28 +177,28 @@ interface CacheInterface
177177 * @throws \Psr\SimpleCache\InvalidArgumentException
178178 * MUST be thrown if the $key string is not a legal value.
179179 */
180- public function delete($key);
180+ public function delete(string $key): bool ;
181181
182182 /**
183183 * Wipes clean the entire cache's keys.
184184 *
185185 * @return bool True on success and false on failure.
186186 */
187- public function clear();
187+ public function clear(): bool ;
188188
189189 /**
190190 * Obtains multiple cache items by their unique keys.
191191 *
192- * @param iterable $keys A list of keys that can obtained in a single operation.
193- * @param mixed $default Default value to return for keys that do not exist.
192+ * @param iterable< string > $keys A list of keys that can be obtained in a single operation.
193+ * @param mixed $default Default value to return for keys that do not exist.
194194 *
195- * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
195+ * @return iterable< string , mixed > A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
196196 *
197197 * @throws \Psr\SimpleCache\InvalidArgumentException
198198 * MUST be thrown if $keys is neither an array nor a Traversable,
199199 * or if any of the $keys are not a legal value.
200200 */
201- public function getMultiple($keys, $default = null);
201+ public function getMultiple(iterable $keys, mixed $default = null): iterable ;
202202
203203 /**
204204 * Persists a set of key => value pairs in the cache, with an optional TTL.
@@ -214,28 +214,28 @@ interface CacheInterface
214214 * MUST be thrown if $values is neither an array nor a Traversable,
215215 * or if any of the $values are not a legal value.
216216 */
217- public function setMultiple($values, $ttl = null);
217+ public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool ;
218218
219219 /**
220220 * Deletes multiple cache items in a single operation.
221221 *
222- * @param iterable $keys A list of string-based keys to be deleted.
222+ * @param iterable< string > $keys A list of string-based keys to be deleted.
223223 *
224224 * @return bool True if the items were successfully removed. False if there was an error.
225225 *
226226 * @throws \Psr\SimpleCache\InvalidArgumentException
227227 * MUST be thrown if $keys is neither an array nor a Traversable,
228228 * or if any of the $keys are not a legal value.
229229 */
230- public function deleteMultiple($keys);
230+ public function deleteMultiple(iterable $keys): bool ;
231231
232232 /**
233233 * Determines whether an item is present in the cache.
234234 *
235235 * NOTE: It is recommended that has() is only to be used for cache warming type purposes
236236 * and not to be used within your live applications operations for get/set, as this method
237237 * is subject to a race condition where your has() will return true and immediately after,
238- * another script can remove it, making the state of your app out of date.
238+ * another script can remove it making the state of your app out of date.
239239 *
240240 * @param string $key The cache item key.
241241 *
@@ -244,7 +244,7 @@ interface CacheInterface
244244 * @throws \Psr\SimpleCache\InvalidArgumentException
245245 * MUST be thrown if the $key string is not a legal value.
246246 */
247- public function has($key);
247+ public function has(string $key): bool ;
248248}
249249~~~
250250
0 commit comments