Skip to content

Commit

Permalink
Make linters happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mbmjertan committed Nov 8, 2024
1 parent c3a497d commit f5548a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Cache/AbstractManifestCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,18 @@ public function getDuration(): int

/**
* Get an (abstract) cache item.
*
* @param string $key Cache array key.
* @param string $cacheType Cache type to get.
* @param callable|null $fallback Fallback function for getting a result when not set. Optional.
* @param bool $isJson Determines whether we should try to decode the cached value as JSON.
* @return array|mixed[] An array of cached values.
*
* @throws InvalidManifest If cache item is missing.
*
* @return array<string, mixed> An array of cached values.
*/
public function getCacheTopItem(string $key, string $cacheType = self::TYPE_BLOCKS, callable $fallback = null, bool $isJson = true): array {
public function getCacheTopItem(string $key, string $cacheType = self::TYPE_BLOCKS, callable $fallback = null, bool $isJson = true): array
{
$output = [];

if ((\defined('WP_ENVIRONMENT_TYPE') && \WP_ENVIRONMENT_TYPE !== 'development') && !\defined('WP_CLI')) {
Expand Down Expand Up @@ -312,8 +317,9 @@ protected function setCache(string $cacheType = self::TYPE_BLOCKS): void

/**
* Set a custom (abstract) cache value.
*
* @param string $cacheType Cache type.
* @param array $data Data to set. Does not get encoded, is set directly to a transient.
* @param array<string, mixed> $data Data to set. Does not get encoded, is set directly to a transient.
* @return void
*/
public function setCustomCache(string $cacheType = self::TYPE_BLOCKS, array $data = []): void
Expand Down Expand Up @@ -343,7 +349,7 @@ protected function getCache(string $cacheType = self::TYPE_BLOCKS, bool $isJson
$this->setCache($cacheType);
}

return ($isJson ? \json_decode($cache, true) : $cache ?? []) ?? [];
return ($isJson ? \json_decode($cache, true) : $cache) ?? [];
}

/**
Expand Down

0 comments on commit f5548a1

Please sign in to comment.