diff --git a/src/Traits/Cacheable.php b/src/Traits/Cacheable.php index a0c232bd1e63ccb7ad0f4676000b0bf2ac3937f1..bf1058eef94bc82c5762d61664ad6958a8145f38 100644 --- a/src/Traits/Cacheable.php +++ b/src/Traits/Cacheable.php @@ -35,7 +35,7 @@ trait Cacheable * @param int|null $ttl * @return mixed */ - public function fetch(int $ttl = null) + public function fetch(?int $ttl = null) { return Cache::remember($this->cacheKey(), $this->getTTL($ttl), function () { return $this->execute(); @@ -51,7 +51,7 @@ trait Cacheable * @param int|null $ttl * @return int */ - private function getTTL(int $ttl = null): int + private function getTTL(?int $ttl = null): int { return intval($ttl ?? $this->ttl ?? config('redis-helpers.ttl')); } diff --git a/tests/Assets/DateHash.php b/tests/Assets/DateHash.php index 01f5a6d64eebeb19ff45fe9d2ebf5e8fa2397f25..fd297db1016a8f0c9a8afba8ad457c7fae5491c3 100644 --- a/tests/Assets/DateHash.php +++ b/tests/Assets/DateHash.php @@ -24,7 +24,7 @@ class DateHash * @param string|null $datetime * @param string $format */ - public function __construct(string $datetime = null, string $format = 'Y-m-d') + public function __construct(?string $datetime = null, string $format = 'Y-m-d') { $this->format = $format; $this->date = date($this->format, strtotime($datetime ?? now()));