@@ -97,10 +97,8 @@ public function delete(string $key): bool
97
97
98
98
/**
99
99
* {@inheritdoc}
100
- *
101
- * @return bool
102
100
*/
103
- public function hasItem ($ key )
101
+ public function hasItem ($ key ): bool
104
102
{
105
103
if (\is_string ($ key ) && isset ($ this ->expiries [$ key ]) && $ this ->expiries [$ key ] > microtime (true )) {
106
104
if ($ this ->maxItems ) {
@@ -120,7 +118,7 @@ public function hasItem($key)
120
118
/**
121
119
* {@inheritdoc}
122
120
*/
123
- public function getItem ($ key )
121
+ public function getItem ($ key ): CacheItem
124
122
{
125
123
if (!$ isHit = $ this ->hasItem ($ key )) {
126
124
$ value = null ;
@@ -139,7 +137,7 @@ public function getItem($key)
139
137
/**
140
138
* {@inheritdoc}
141
139
*/
142
- public function getItems (array $ keys = [])
140
+ public function getItems (array $ keys = []): iterable
143
141
{
144
142
\assert (self ::validateKeys ($ keys ));
145
143
@@ -148,10 +146,8 @@ public function getItems(array $keys = [])
148
146
149
147
/**
150
148
* {@inheritdoc}
151
- *
152
- * @return bool
153
149
*/
154
- public function deleteItem ($ key )
150
+ public function deleteItem ($ key ): bool
155
151
{
156
152
\assert ('' !== CacheItem::validateKey ($ key ));
157
153
unset($ this ->values [$ key ], $ this ->expiries [$ key ]);
@@ -161,10 +157,8 @@ public function deleteItem($key)
161
157
162
158
/**
163
159
* {@inheritdoc}
164
- *
165
- * @return bool
166
160
*/
167
- public function deleteItems (array $ keys )
161
+ public function deleteItems (array $ keys ): bool
168
162
{
169
163
foreach ($ keys as $ key ) {
170
164
$ this ->deleteItem ($ key );
@@ -175,10 +169,8 @@ public function deleteItems(array $keys)
175
169
176
170
/**
177
171
* {@inheritdoc}
178
- *
179
- * @return bool
180
172
*/
181
- public function save (CacheItemInterface $ item )
173
+ public function save (CacheItemInterface $ item ): bool
182
174
{
183
175
if (!$ item instanceof CacheItem) {
184
176
return false ;
@@ -230,30 +222,24 @@ public function save(CacheItemInterface $item)
230
222
231
223
/**
232
224
* {@inheritdoc}
233
- *
234
- * @return bool
235
225
*/
236
- public function saveDeferred (CacheItemInterface $ item )
226
+ public function saveDeferred (CacheItemInterface $ item ): bool
237
227
{
238
228
return $ this ->save ($ item );
239
229
}
240
230
241
231
/**
242
232
* {@inheritdoc}
243
- *
244
- * @return bool
245
233
*/
246
- public function commit ()
234
+ public function commit (): bool
247
235
{
248
236
return true ;
249
237
}
250
238
251
239
/**
252
240
* {@inheritdoc}
253
- *
254
- * @return bool
255
241
*/
256
- public function clear (string $ prefix = '' )
242
+ public function clear (string $ prefix = '' ): bool
257
243
{
258
244
if ('' !== $ prefix ) {
259
245
$ now = microtime (true );
@@ -276,10 +262,8 @@ public function clear(string $prefix = '')
276
262
277
263
/**
278
264
* Returns all cached values, with cache miss as null.
279
- *
280
- * @return array
281
265
*/
282
- public function getValues ()
266
+ public function getValues (): array
283
267
{
284
268
if (!$ this ->storeSerialized ) {
285
269
return $ this ->values ;
@@ -306,7 +290,7 @@ public function reset()
306
290
$ this ->clear ();
307
291
}
308
292
309
- private function generateItems (array $ keys , $ now , $ f )
293
+ private function generateItems (array $ keys , $ now , $ f ): \ Generator
310
294
{
311
295
foreach ($ keys as $ i => $ key ) {
312
296
if (!$ isHit = isset ($ this ->expiries [$ key ]) && ($ this ->expiries [$ key ] > $ now || !$ this ->deleteItem ($ key ))) {
0 commit comments