Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
name: Check code styles
command: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v --dry-run

# Run tests with phpunit
# Run tests with phpunit
#
# If the PR is open by an Algolia, we run all the tests
# with the keys in the env variables
Expand Down Expand Up @@ -110,6 +110,10 @@ jobs:
workflows:
workflow:
jobs:
- test:
name: 'Guzzle 7 - PHP 8.4'
version: "8.4"
http_client: guzzlehttp/guzzle:"^7.0"
- test:
name: 'Guzzle 7 - PHP 8.1'
version: "8.1"
Expand Down
18 changes: 9 additions & 9 deletions src/Cache/FileCacheDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct($directory)
/**
* {@inheritdoc}
*/
public function get($key, $default = null)
public function get($key, $default = null): mixed
{
if (!$this->has($key)) {
return $default;
Expand All @@ -30,23 +30,23 @@ public function get($key, $default = null)
/**
* {@inheritdoc}
*/
public function set($key, $value, $ttl = null)
public function set($key, $value, $ttl = null): bool
{
return file_put_contents($this->getFilenameFromKey($key), $value);
return file_put_contents($this->getFilenameFromKey($key), $value) !== false;
}

/**
* {@inheritdoc}
*/
public function delete($key)
public function delete($key): bool
{
return @unlink($this->getFilenameFromKey($key));
}

/**
* {@inheritdoc}
*/
public function clear()
public function clear(): bool
{
$result = true;
foreach (glob($this->directory.self::PREFIX.'*') as $file) {
Expand All @@ -59,7 +59,7 @@ public function clear()
/**
* {@inheritdoc}
*/
public function getMultiple($keys, $default = null)
public function getMultiple($keys, $default = null): iterable
{
$result = [];
foreach ($keys as $key) {
Expand All @@ -72,7 +72,7 @@ public function getMultiple($keys, $default = null)
/**
* {@inheritdoc}
*/
public function setMultiple($values, $ttl = null)
public function setMultiple($values, $ttl = null): bool
{
$result = true;
foreach ($values as $key => $value) {
Expand All @@ -85,7 +85,7 @@ public function setMultiple($values, $ttl = null)
/**
* {@inheritdoc}
*/
public function deleteMultiple($keys)
public function deleteMultiple($keys): bool
{
$result = true;
foreach ($keys as $key) {
Expand All @@ -98,7 +98,7 @@ public function deleteMultiple($keys)
/**
* {@inheritdoc}
*/
public function has($key)
public function has($key): bool
{
return file_exists($this->getFilenameFromKey($key));
}
Expand Down
16 changes: 8 additions & 8 deletions src/Cache/NullCacheDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ final class NullCacheDriver implements CacheInterface
/**
* {@inheritdoc}
*/
public function get($key, $default = null)
public function get($key, $default = null): mixed
{
return $default;
}

/**
* {@inheritdoc}
*/
public function set($key, $value, $ttl = null)
public function set($key, $value, $ttl = null): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function delete($key)
public function delete($key): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function clear()
public function clear(): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function getMultiple($keys, $default = null)
public function getMultiple($keys, $default = null): iterable
{
$return = [];

Expand All @@ -55,23 +55,23 @@ public function getMultiple($keys, $default = null)
/**
* {@inheritdoc}
*/
public function setMultiple($values, $ttl = null)
public function setMultiple($values, $ttl = null): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function deleteMultiple($keys)
public function deleteMultiple($keys): bool
{
return true;
}

/**
* {@inheritdoc}
*/
public function has($key)
public function has($key): bool
{
return false;
}
Expand Down