From 1919c7d3c8c4c518d3b7f6adffee750aa982b910 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Mon, 1 Jul 2019 04:02:42 +0200 Subject: [PATCH] [Cache] finish type-hints --- src/Symfony/Component/Cache/Adapter/AbstractAdapter.php | 6 ------ .../Component/Cache/Adapter/AbstractTagAwareAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/ApcuAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/ArrayAdapter.php | 1 - src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php | 2 +- .../Component/Cache/Adapter/FilesystemTagAwareAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/PdoAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/Psr16Adapter.php | 2 +- .../Component/Cache/Adapter/RedisTagAwareAdapter.php | 2 +- src/Symfony/Component/Cache/Traits/FilesystemTrait.php | 2 +- src/Symfony/Component/Cache/Traits/RedisTrait.php | 2 +- 14 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index b665aed4dc356..7d54922f39ce2 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -99,12 +99,6 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) { * * 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 */ public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) diff --git a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php index 97476a8a71845..4ee2c98a410a4 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php @@ -129,7 +129,7 @@ static function ($deferred, &$expiredIds) use ($getId, $tagPrefix) { * * @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. diff --git a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php index f7135aa148cf8..62ba4d9a82663 100644 --- a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php @@ -72,7 +72,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { return apcu_exists($id); } diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index e0fa91219f0f1..095b329f61da9 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -31,7 +31,6 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter private $createCacheItem; /** - * @param int $defaultLifetime * @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) diff --git a/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php b/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php index 7da759d4b7a12..55a36e17f86c6 100644 --- a/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/DoctrineAdapter.php @@ -65,7 +65,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { return $this->provider->contains($id); } diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php index 0dd81a99704ed..fa8c91953d1aa 100644 --- a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php @@ -53,7 +53,7 @@ public function __construct(string $namespace = '', int $defaultLifetime = 0, st /** * {@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); diff --git a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php index a625215529352..c0d8bba435f0f 100644 --- a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php @@ -276,7 +276,7 @@ protected function doFetch(array $ids) /** * {@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()); } diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index d1c0b75a42cf2..a96eb290c6da3 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -236,7 +236,7 @@ protected function doFetch(array $ids) /** * {@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)"; $stmt = $this->getConnection()->prepare($sql); diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index 080cc3cdd0bef..0f62f8380e862 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -69,7 +69,7 @@ function ($key, $value, $isHit) { * * @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 if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 57fb3b7311297..1c90b0972f519 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -165,7 +165,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { if ($this->appendOnly && isset($this->values[$id])) { return true; diff --git a/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php b/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php index 333c4af174d48..a13b20ebc21c6 100644 --- a/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php +++ b/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php @@ -55,7 +55,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { return $this->pool->has($id); } diff --git a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php index 382defcd2c8e7..512963ec65eb0 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php @@ -90,7 +90,7 @@ public function __construct($redisClient, string $namespace = '', int $defaultLi /** * {@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 if (!$serialized = $this->marshaller->marshall($values, $failed)) { diff --git a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php index 90c2f2e442b13..8418ee4481b32 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php @@ -81,7 +81,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { $file = $this->getFile($id); diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 46f3ddd7366c9..226ab6f172b05 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -324,7 +324,7 @@ protected function doFetch(array $ids) /** * {@inheritdoc} */ - protected function doHave($id) + protected function doHave(string $id) { return (bool) $this->redis->exists($id); }