Skip to content

Commit

Permalink
php82
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoroosevelt committed Sep 12, 2023
1 parent 630f51f commit e4efb99
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
# windows-latest, macOS-latest?
operating-system: [ubuntu-latest]
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php-versions: ['7.4', '8.0', '8.1', '8.2']

name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup PHP (with Xdebug)
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: xdebug

- name: Check PHP Version
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
}
],
"require": {
"php": ">=7.0",
"psr/simple-cache": "1.*"
"php": ">=7.4",
"psr/simple-cache": "3.*"
},
"require-dev": {
"phpunit/phpunit": "^6 || ^9",
Expand Down
29 changes: 20 additions & 9 deletions tests/Stubs/Psr16ArrayCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,69 @@

use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\InvalidArgumentException;
use function PHPUnit\Framework\exactly;

class Psr16ArrayCache implements CacheInterface
{
protected $cached = [];

public function get($key, $default = null)
public function get($key, $default = null): mixed
{
if (!$this->has($key)) {
throw new class implements InvalidArgumentException {
throw new class extends \Exception implements InvalidArgumentException {
};
}

return $this->cached[$key];
}

public function set($key, $value, $ttl = null)
public function set($key, $value, $ttl = null): bool
{
$this->cached[$key] = $value;

return true;
}

public function delete($key)
public function delete($key): bool
{
unset($this->cached[$key]);

return true;
}

public function clear()
public function clear(): bool
{
$this->cached = [];

return true;
}

public function getMultiple($keys, $default = null)
public function getMultiple($keys, $default = null): iterable
{
foreach ($keys as $key) {
yield $this->get($key);
}
}

public function setMultiple($values, $ttl = null)
public function setMultiple($values, $ttl = null): bool
{
foreach ($values as $key => $value) {
$this->set($key, $value, $ttl);
}

return true;
}

public function deleteMultiple($keys)
public function deleteMultiple($keys): bool
{
foreach ($keys as $key) {
$this->delete($key);
}

return true;
}

public function has($key)
public function has($key): bool
{
return array_key_exists($key, $this->cached);
}
Expand Down

0 comments on commit e4efb99

Please sign in to comment.