Skip to content

Commit

Permalink
resolve: phpstan error and composer
Browse files Browse the repository at this point in the history
  • Loading branch information
SonyPradana committed Sep 9, 2024
1 parent b80944d commit 3fe21cf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion split-repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
return [
'tag_version' => "0.35.6",
'split_repositorys' => [
'sonypradana/Cache' => '/src/System/Cache/',
'sonypradana/cache' => '/src/System/Cache/',
'sonypradana/collection' => '/src/System/Collection/',
'sonypradana/console' => '/src/System/Console/',
'sonypradana/container' => '/src/System/Container/',
Expand Down
4 changes: 3 additions & 1 deletion src/System/Cache/CacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable;

/**
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
* @param iterable<string, mixed> $values
*/
public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null);
public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null): bool;

/**
* Deletes multiple cache items in a single operation.
Expand Down
4 changes: 2 additions & 2 deletions src/System/Cache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public function driver(?string $driver = null): CacheInterface
}

/**
* @param array<int, mixed> $parameters
* @param mixed[] $parameters
*/
public function __call(string $method, array $parameters): mixed
{
return $this->driver()->{$method}($parameters);
return $this->driver()->{$method}(...$parameters);
}

// ---
Expand Down
2 changes: 1 addition & 1 deletion src/System/Cache/Storage/ArrayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ArrayStorage implements CacheInterface
{
/**
* @var array<string, array{value: mixed, timestamp: int}>
* @var array<string, array{value: mixed, timestamp?: int}>
*/
protected array $storage = [];

Expand Down
28 changes: 28 additions & 0 deletions src/System/Support/Facades/Cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace System\Support\Facades;

use System\Cache\CacheManager;

/**
* @method static self setDefaultDriver(\System\Cache\CacheInterface $driver)
* @method static self setDriver(string $driver_name, \System\Cache\CacheInterface $driver)
* @method static \System\Cache\CacheInterface driver(?string $driver = null)
* @method static mixed get(string $key, mixed $default = null)
* @method static bool set(string $key, mixed $value, int|\DateInterval|null $ttl = null)
* @method static bool delete(string $key)
* @method static bool clear()
* @method static iterable getMultiple(iterable $keys, mixed $default = null)
* @method static bool setMultiple(iterable $values, int|\DateInterval|null $ttl = null)
* @method static bool deleteMultiple(iterable $keys)
* @method static bool has(string $key)
*/
final class Cache extends Facade
{
protected static function getAccessor()
{
return CacheManager::class;
}
}

0 comments on commit 3fe21cf

Please sign in to comment.