[Cache] finish type-hints

This commit is contained in:
Tobias Schultze 2019-07-01 04:02:42 +02:00
parent 63f4d13be1
commit 1919c7d3c8
14 changed files with 12 additions and 19 deletions

View File

@ -99,12 +99,6 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
* *
* Using ApcuAdapter makes system caches compatible with read-only filesystems. * Using ApcuAdapter makes system caches compatible with read-only filesystems.
* *
* @param string $namespace
* @param int $defaultLifetime
* @param string $version
* @param string $directory
* @param LoggerInterface|null $logger
*
* @return AdapterInterface * @return AdapterInterface
*/ */
public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null)

View File

@ -129,7 +129,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
* *
* @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not * @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not
*/ */
abstract protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array; abstract protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array;
/** /**
* Removes multiple items from the pool and their corresponding tags. * Removes multiple items from the pool and their corresponding tags.

View File

@ -72,7 +72,7 @@ class ApcuAdapter extends AbstractAdapter
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
return apcu_exists($id); return apcu_exists($id);
} }

View File

@ -31,7 +31,6 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
private $createCacheItem; private $createCacheItem;
/** /**
* @param int $defaultLifetime
* @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise
*/ */
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true) public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true)

View File

@ -65,7 +65,7 @@ class DoctrineAdapter extends AbstractAdapter
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
return $this->provider->contains($id); return $this->provider->contains($id);
} }

View File

@ -53,7 +53,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array
{ {
$failed = $this->doSaveCache($values, $lifetime); $failed = $this->doSaveCache($values, $lifetime);

View File

@ -276,7 +276,7 @@ class MemcachedAdapter extends AbstractAdapter
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
return false !== $this->getClient()->get(rawurlencode($id)) || $this->checkResultCode(\Memcached::RES_SUCCESS === $this->client->getResultCode()); return false !== $this->getClient()->get(rawurlencode($id)) || $this->checkResultCode(\Memcached::RES_SUCCESS === $this->client->getResultCode());
} }

View File

@ -236,7 +236,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
$sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)"; $sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)";
$stmt = $this->getConnection()->prepare($sql); $stmt = $this->getConnection()->prepare($sql);

View File

@ -69,7 +69,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
* *
* @return CacheItemPoolInterface * @return CacheItemPoolInterface
*/ */
public static function create($file, CacheItemPoolInterface $fallbackPool) public static function create(string $file, CacheItemPoolInterface $fallbackPool)
{ {
// Shared memory is available in PHP 7.0+ with OPCache enabled // Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {

View File

@ -165,7 +165,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
if ($this->appendOnly && isset($this->values[$id])) { if ($this->appendOnly && isset($this->values[$id])) {
return true; return true;

View File

@ -55,7 +55,7 @@ class Psr16Adapter extends AbstractAdapter implements PruneableInterface, Resett
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
return $this->pool->has($id); return $this->pool->has($id);
} }

View File

@ -90,7 +90,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $delTagData = []): array protected function doSave(array $values, int $lifetime, array $addTagData = [], array $delTagData = []): array
{ {
// serialize values // serialize values
if (!$serialized = $this->marshaller->marshall($values, $failed)) { if (!$serialized = $this->marshaller->marshall($values, $failed)) {

View File

@ -81,7 +81,7 @@ trait FilesystemTrait
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
$file = $this->getFile($id); $file = $this->getFile($id);

View File

@ -324,7 +324,7 @@ trait RedisTrait
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doHave($id) protected function doHave(string $id)
{ {
return (bool) $this->redis->exists($id); return (bool) $this->redis->exists($id);
} }