diff --git a/README.md b/README.md
index 39a8a5f..7c181f0 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ $defaultTTL = 60; // 60 seconds as default TTL
$inMemoryCache = new InMemoryCache($maxCacheSize, $defaultTTL);
$redisCache = new MyAwesomeRedisCache();
-$decorator = CompositeCache($inMemoryCache, $redisCache);
+$decorator = new CompositeCache($inMemoryCache, $redisCache);
$decorator->get('test'); // this get will trigger a request to redis and save data to memory
$decorator->get('test'); // this get won't trigger any requests and just return data from memory
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile
index b7a08a2..e5f4d8e 100644
--- a/docker/php/Dockerfile
+++ b/docker/php/Dockerfile
@@ -25,7 +25,7 @@ RUN docker-php-ext-install zip opcache \
&& echo 'xdebug.mode=coverage' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
-RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.8 \
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.7.6 \
&& mkdir -p /.composer && chmod -Rf 777 /.composer
diff --git a/psalm.xml b/psalm.xml
index dc2babf..5ca8ad0 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -21,6 +21,7 @@
+
diff --git a/src/CompositeCache.php b/src/CompositeCache.php
index b0f51f9..d5d4a3a 100644
--- a/src/CompositeCache.php
+++ b/src/CompositeCache.php
@@ -42,7 +42,7 @@ public function get(string $key, mixed $default = null): mixed
/**
* {@inheritDoc}
*/
- public function set(string $key, mixed $value, int|\DateInterval $ttl = null): bool
+ public function set(string $key, mixed $value, int|\DateInterval|null $ttl = null): bool
{
return $this->heavyCache->set($key, $value, $ttl)
&& $this->lightCache->set($key, $value, $ttl);
@@ -82,7 +82,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
/**
* {@inheritDoc}
*/
- public function setMultiple(iterable $values, int|\DateInterval $ttl = null): bool
+ public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null): bool
{
return $this->heavyCache->setMultiple($values, $ttl)
&& $this->lightCache->setMultiple($values, $ttl);
diff --git a/src/InMemoryCache.php b/src/InMemoryCache.php
index a224b39..eff6d35 100644
--- a/src/InMemoryCache.php
+++ b/src/InMemoryCache.php
@@ -26,7 +26,7 @@ final class InMemoryCache implements CacheInterface
public function __construct(
private readonly int $stackSize = self::DEFAULT_STACK_SIZE,
private readonly int $defaultTTL = self::DEFAULT_TTL,
- Timer $timer = null
+ ?Timer $timer = null
) {
if ($this->stackSize < 1) {
throw new InvalidArgumentException('Stack size must be greater than 0');
@@ -52,7 +52,7 @@ public function get(string $key, mixed $default = null): mixed
/**
* {@inheritDoc}
*/
- public function set(string $key, mixed $value, int|\DateInterval $ttl = null): bool
+ public function set(string $key, mixed $value, int|\DateInterval|null $ttl = null): bool
{
if (\count($this->stack) >= $this->stackSize) {
$this->clearStack();
@@ -100,7 +100,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
/**
* {@inheritDoc}
*/
- public function setMultiple(iterable $values, int|\DateInterval $ttl = null): bool
+ public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null): bool
{
foreach ($values as $key => $value) {
$this->set((string) $key, $value, $ttl);
@@ -132,7 +132,7 @@ public function has(string $key): bool
/**
* Counts time till cached item is valid.
*/
- private function createValidTill(null|int|\DateInterval $ttl): int
+ private function createValidTill(int|\DateInterval|null $ttl): int
{
$validTill = $this->timer->getCurrentTimestamp();