Skip to content

Commit

Permalink
- updates and chore
Browse files Browse the repository at this point in the history
  • Loading branch information
kodeart committed May 3, 2021
1 parent 985e998 commit 73b3ad1
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cache:
- $HOME/.composer/cache

php:
- 8.0
- 8.0.1
- nightly

jobs:
Expand Down
6 changes: 1 addition & 5 deletions Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ interface Cache extends CacheInterface
/**
* Returns the underlying cache client.
*
* @return \Memcached | \Redis
* | \Predis\Client
* | \Koded\Caching\Client\FileClient
* | \Koded\Caching\Client\MemoryClient
* | \Koded\Caching\Client\ShmopClient
* @return \Memcached | \Redis | \Predis\Client | \Koded\Caching\Client\FileClient | \Koded\Caching\Client\MemoryClient | \Koded\Caching\Client\ShmopClient
*/
public function client();

Expand Down
2 changes: 1 addition & 1 deletion CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CacheException extends KodedException implements InvalidArgumentException

public static function forInvalidKey($key): static
{
return new static(Cache::E_INVALID_KEY, [':key' => var_export($key, true), ':type' => gettype($key)]);
return new static(Cache::E_INVALID_KEY, [':key' => \var_export($key, true), ':type' => \gettype($key)]);
}

public static function forUnsupportedLogger(string $supported, string $given): static
Expand Down
4 changes: 2 additions & 2 deletions Client/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private function newRedisClient(RedisConfiguration $conf): \Redis
} /** @noinspection PhpRedundantCatchClauseInspection */
catch (\RedisException $e) {
if (!\strpos($e->getMessage(), ' AUTH ')) {
\error_log(sprintf(PHP_EOL . '[Redis] %s: %s', \get_class($e), $e->getMessage()));
\error_log(\sprintf(PHP_EOL . '[Redis] %s: %s', \get_class($e), $e->getMessage()));
\error_log('[Redis] with conf: ' . $conf->toJSON());
throw CacheException::withConnectionErrorFor('Redis');
}
Expand All @@ -141,7 +141,7 @@ private function newPredisClient(PredisConfiguration $conf): \Predis\Client
} /** @noinspection PhpRedundantCatchClauseInspection */
catch (\Predis\Connection\ConnectionException $e) {
if (!\strpos($e->getMessage(), ' AUTH ')) {
\error_log(sprintf(PHP_EOL . '[Predis] %s: %s', \get_class($e), $e->getMessage()));
\error_log(\sprintf(PHP_EOL . '[Predis] %s: %s', \get_class($e), $e->getMessage()));
\error_log('[Predis] with conf: ' . $conf->toJSON());
throw CacheException::withConnectionErrorFor('Predis');
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/CacheConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ abstract class CacheConfiguration extends Config
/** @noinspection PhpMissingParentConstructorInspection */
public function __construct(array $parameters = [])
{
$parameters and $this->import($parameters);
$parameters && $this->import($parameters);
}
}
4 changes: 2 additions & 2 deletions Configuration/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ConfigFactory extends Config
/** @noinspection PhpMissingParentConstructorInspection */
public function __construct(array $parameters = [])
{
$parameters and $this->import($parameters);
$parameters && $this->import($parameters);
}

public function build(string $context): Configuration
Expand All @@ -37,7 +37,7 @@ public function build(string $context): Configuration
} catch (CacheException $e) {
throw $e;
// @codeCoverageIgnoreEnd
} catch (Throwable $e) {
} catch (Throwable) {
return new class($this->toArray()) extends CacheConfiguration {};
}
}
Expand Down
4 changes: 1 addition & 3 deletions Configuration/MemcachedConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public function getServers(): array
*/
public function getOptions(): array
{
return \array_filter($this->toArray()['options'], function($value) {
return null !== $value;
});
return \array_filter($this->toArray()['options'], fn($value) => null !== $value);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Koded - Simple Caching Library
[![Code Coverage](https://scrutinizer-ci.com/g/kodedphp/cache-simple/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/kodedphp/cache-simple/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/kodedphp/cache-simple/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/kodedphp/cache-simple/?branch=master)
[![Packagist Downloads](https://img.shields.io/packagist/dt/koded/cache-simple.svg)](https://packagist.org/packages/koded/cache-simple)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.3-8892BF.svg)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://php.net/)

A [PSR-16][10] caching library for PHP7 using several caching technologies.
A [PSR-16][10] caching library for PHP 8 using several caching technologies.
It supports JSON caching for Redis.


Expand Down
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function normalize_ttl(mixed $value): ?int
if ($value instanceof DateInterval) {
return \date_create('@0', \timezone_open('UTC'))->add($value)->getTimestamp();
}
throw CacheException::generic('Invalid TTL, given ' . var_export($value, true));
throw CacheException::generic('Invalid TTL, given ' . \var_export($value, true));
}

/**
Expand Down

0 comments on commit 73b3ad1

Please sign in to comment.