File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ class ConfigurationOption extends ArrayObject
7070 protected $ preventCacheSlams = false ;
7171
7272 /**
73- * @var bool
73+ * @var int
7474 */
7575 protected $ cacheSlamsTimeout = 15 ;
7676
@@ -359,18 +359,18 @@ public function setPreventCacheSlams(bool $preventCacheSlams): self
359359 }
360360
361361 /**
362- * @return bool
362+ * @return int
363363 */
364- public function isCacheSlamsTimeout (): bool
364+ public function getCacheSlamsTimeout (): int
365365 {
366366 return $ this ->cacheSlamsTimeout ;
367367 }
368368
369369 /**
370- * @param bool $cacheSlamsTimeout
370+ * @param int $cacheSlamsTimeout
371371 * @return ConfigurationOption
372372 */
373- public function setCacheSlamsTimeout (bool $ cacheSlamsTimeout ): self
373+ public function setCacheSlamsTimeout (int $ cacheSlamsTimeout ): self
374374 {
375375 $ this ->cacheSlamsTimeout = $ cacheSlamsTimeout ;
376376 return $ this ;
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ public function expiresAfter($time)
197197
198198 $ this ->expirationDate = (new \DateTime ())->add ($ time );
199199 } else {
200- throw new phpFastCacheInvalidArgumentException ('Invalid date format ' );
200+ throw new phpFastCacheInvalidArgumentException (sprintf ( 'Invalid date format, got "%s" ' , gettype ( $ time )) );
201201 }
202202
203203 return $ this ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ public function getItem($key)
9797
9898 if ($ this ->getConfig ()[ 'preventCacheSlams ' ]) {
9999 while ($ driverData instanceof ItemBatch) {
100- if ($ driverData ->getItemDate ()->getTimestamp () + $ this ->getConfig ()[ 'cacheSlamsTimeout ' ] < time ()) {
100+ if ($ driverData ->getItemDate ()->getTimestamp () + $ this ->getConfigOption ( 'cacheSlamsTimeout ' ) < time ()) {
101101 /**
102102 * The timeout has been reached
103103 * Consider that the batch has
@@ -343,7 +343,7 @@ public function save(CacheItemInterface $item)
343343 $ itemBatch = $ class ->newInstanceArgs ([$ this , $ item ->getKey ()]);
344344 $ itemBatch ->setEventManager ($ this ->eventManager )
345345 ->set (new ItemBatch ($ item ->getKey (), new \DateTime ()))
346- ->expiresAfter ($ this ->getConfig ()[ 'cacheSlamsTimeout ' ] );
346+ ->expiresAfter ($ this ->getConfigOption ( 'cacheSlamsTimeout ' ) );
347347
348348 /**
349349 * To avoid SPL mismatches
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ class Config extends ConfigurationOption
2828 protected $ password = '' ;
2929
3030 /**
31- * @var null
31+ * @var int
3232 */
33- protected $ database ;
33+ protected $ database = 0 ;
3434
3535 /**
3636 * @return string
@@ -87,18 +87,18 @@ public function setPassword(string $password): self
8787 }
8888
8989 /**
90- * @return null
90+ * @return int
9191 */
92- public function getDatabase ()
92+ public function getDatabase (): int
9393 {
9494 return $ this ->database ;
9595 }
9696
9797 /**
98- * @param null $database
98+ * @param int $database
9999 * @return Config
100100 */
101- public function setDatabase ($ database ): self
101+ public function setDatabase (int $ database ): self
102102 {
103103 $ this ->database = $ database ;
104104 return $ this ;
You can’t perform that action at this time.
0 commit comments