Skip to content

Commit 764e0b3

Browse files
authored
Merge pull request #24 from navarr/return-types
Add Parameter & Return Types (versions 3 of the library)
2 parents 8707bf3 + 19a4d7c commit 764e0b3

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"extra": {
2121
"branch-alias": {
22-
"dev-master": "2.0.x-dev"
22+
"dev-master": "3.0.x-dev"
2323
}
2424
}
2525
}

src/CacheInterface.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface CacheInterface
1515
* @throws \Psr\SimpleCache\InvalidArgumentException
1616
* MUST be thrown if the $key string is not a legal value.
1717
*/
18-
public function get(string $key, mixed $default = null);
18+
public function get(string $key, mixed $default = null): mixed;
1919

2020
/**
2121
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
@@ -31,7 +31,7 @@ public function get(string $key, mixed $default = null);
3131
* @throws \Psr\SimpleCache\InvalidArgumentException
3232
* MUST be thrown if the $key string is not a legal value.
3333
*/
34-
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null);
34+
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
3535

3636
/**
3737
* Delete an item from the cache by its unique key.
@@ -43,14 +43,14 @@ public function set(string $key, mixed $value, null|int|\DateInterval $ttl = nul
4343
* @throws \Psr\SimpleCache\InvalidArgumentException
4444
* MUST be thrown if the $key string is not a legal value.
4545
*/
46-
public function delete(string $key);
46+
public function delete(string $key): bool;
4747

4848
/**
4949
* Wipes clean the entire cache's keys.
5050
*
5151
* @return bool True on success and false on failure.
5252
*/
53-
public function clear();
53+
public function clear(): bool;
5454

5555
/**
5656
* Obtains multiple cache items by their unique keys.
@@ -64,7 +64,7 @@ public function clear();
6464
* MUST be thrown if $keys is neither an array nor a Traversable,
6565
* or if any of the $keys are not a legal value.
6666
*/
67-
public function getMultiple(iterable $keys, mixed $default = null);
67+
public function getMultiple(iterable $keys, mixed $default = null): iterable;
6868

6969
/**
7070
* Persists a set of key => value pairs in the cache, with an optional TTL.
@@ -80,7 +80,7 @@ public function getMultiple(iterable $keys, mixed $default = null);
8080
* MUST be thrown if $values is neither an array nor a Traversable,
8181
* or if any of the $values are not a legal value.
8282
*/
83-
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null);
83+
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool;
8484

8585
/**
8686
* Deletes multiple cache items in a single operation.
@@ -93,7 +93,7 @@ public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null
9393
* MUST be thrown if $keys is neither an array nor a Traversable,
9494
* or if any of the $keys are not a legal value.
9595
*/
96-
public function deleteMultiple(iterable $keys);
96+
public function deleteMultiple(iterable $keys): bool;
9797

9898
/**
9999
* Determines whether an item is present in the cache.
@@ -110,5 +110,5 @@ public function deleteMultiple(iterable $keys);
110110
* @throws \Psr\SimpleCache\InvalidArgumentException
111111
* MUST be thrown if the $key string is not a legal value.
112112
*/
113-
public function has(string $key);
113+
public function has(string $key): bool;
114114
}

0 commit comments

Comments
 (0)