Skip to content

Commit

Permalink
Code: add php 8 types
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jul 27, 2023
1 parent 49a826a commit e3cbb4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/CacheItem.php
Expand Up @@ -11,14 +11,14 @@
class CacheItem implements CacheItemInterface
{

private string $key;
/** @var mixed[] */
protected array $dependencies = [];

private mixed $value;
protected string $key;

private bool $hit;
protected mixed $value;

/** @var mixed[] */
protected $dependencies = [];
protected bool $hit;

public function getKey(): string
{
Expand All @@ -43,7 +43,6 @@ public function set(mixed $value): static
}

/**
* @param DateTimeInterface|null $expiration
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*/
public function expiresAt(?DateTimeInterface $expiration): static
Expand All @@ -60,10 +59,9 @@ public function expiresAt(?DateTimeInterface $expiration): static
}

/**
* @param int|DateInterval|null $time
* @return static
*/
public function expiresAfter(int|DateInterval |null $time): static
public function expiresAfter(int|DateInterval|null $time): static
{
if ($time === null) {
$this->dependencies[Cache::Expire] = null;
Expand Down
2 changes: 1 addition & 1 deletion src/CachePool.php
Expand Up @@ -115,7 +115,7 @@ public function save(CacheItemInterface $item): bool
{
if (!($item instanceof CacheItem)) {
throw new InvalidArgumentException(
sprintf('Invalid type "%s" for $item', get_class($item))
sprintf('Invalid type "%s" for $item', $item::class)
);
}

Expand Down

0 comments on commit e3cbb4d

Please sign in to comment.