From 0f27c7ca2632e830949f88938988dddd54a42d1e Mon Sep 17 00:00:00 2001 From: rawilk Date: Fri, 15 Dec 2023 22:55:11 +0000 Subject: [PATCH] PHP Linting (Pint) --- src/Contracts/ContextSerializer.php | 2 +- src/Contracts/KeyGenerator.php | 2 +- src/Drivers/Factory.php | 4 ++-- src/Settings.php | 2 +- src/Support/ContextSerializers/ContextSerializer.php | 2 +- .../ContextSerializers/DotNotationContextSerializer.php | 2 +- src/Support/KeyGenerators/Md5KeyGenerator.php | 2 +- src/Support/KeyGenerators/ReadableKeyGenerator.php | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Contracts/ContextSerializer.php b/src/Contracts/ContextSerializer.php index bb632c8..f0c8e2d 100644 --- a/src/Contracts/ContextSerializer.php +++ b/src/Contracts/ContextSerializer.php @@ -8,5 +8,5 @@ interface ContextSerializer { - public function serialize(Context $context = null): string; + public function serialize(?Context $context = null): string; } diff --git a/src/Contracts/KeyGenerator.php b/src/Contracts/KeyGenerator.php index 8a10994..cbd2742 100644 --- a/src/Contracts/KeyGenerator.php +++ b/src/Contracts/KeyGenerator.php @@ -8,7 +8,7 @@ interface KeyGenerator { - public function generate(string $key, Context $context = null): string; + public function generate(string $key, ?Context $context = null): string; public function removeContextFromKey(string $key): string; diff --git a/src/Drivers/Factory.php b/src/Drivers/Factory.php index 36e9d4a..5b7194c 100644 --- a/src/Drivers/Factory.php +++ b/src/Drivers/Factory.php @@ -21,7 +21,7 @@ public function __construct(protected Application $app) { } - public function driver(string $driver = null): Driver + public function driver(?string $driver = null): Driver { return $this->resolveDriver($driver); } @@ -64,7 +64,7 @@ protected function getDriverConfig(string $driver): ?array return $this->app['config']["settings.drivers.{$driver}"]; } - protected function resolveDriver(string $driver = null): Driver + protected function resolveDriver(?string $driver = null): Driver { $driver = $driver ?: $this->getDefaultDriver(); diff --git a/src/Settings.php b/src/Settings.php index 337349b..8f5a6f4 100755 --- a/src/Settings.php +++ b/src/Settings.php @@ -79,7 +79,7 @@ public function getDriver(): Driver * Pass in `false` for context when calling `all()` to only return results * that do not have context. */ - public function context(Context|bool $context = null): self + public function context(Context|bool|null $context = null): self { $this->context = $context; diff --git a/src/Support/ContextSerializers/ContextSerializer.php b/src/Support/ContextSerializers/ContextSerializer.php index fd8f0cd..601b3c7 100644 --- a/src/Support/ContextSerializers/ContextSerializer.php +++ b/src/Support/ContextSerializers/ContextSerializer.php @@ -9,7 +9,7 @@ class ContextSerializer implements ContextSerializerContract { - public function serialize(Context $context = null): string + public function serialize(?Context $context = null): string { return serialize($context); } diff --git a/src/Support/ContextSerializers/DotNotationContextSerializer.php b/src/Support/ContextSerializers/DotNotationContextSerializer.php index 5f36336..d271d98 100644 --- a/src/Support/ContextSerializers/DotNotationContextSerializer.php +++ b/src/Support/ContextSerializers/DotNotationContextSerializer.php @@ -9,7 +9,7 @@ class DotNotationContextSerializer implements ContextSerializerContract { - public function serialize(Context $context = null): string + public function serialize(?Context $context = null): string { if (is_null($context)) { return ''; diff --git a/src/Support/KeyGenerators/Md5KeyGenerator.php b/src/Support/KeyGenerators/Md5KeyGenerator.php index d827090..da417b3 100644 --- a/src/Support/KeyGenerators/Md5KeyGenerator.php +++ b/src/Support/KeyGenerators/Md5KeyGenerator.php @@ -13,7 +13,7 @@ class Md5KeyGenerator implements KeyGeneratorContract { protected ContextSerializer $serializer; - public function generate(string $key, Context $context = null): string + public function generate(string $key, ?Context $context = null): string { return md5($key . $this->serializer->serialize($context)); } diff --git a/src/Support/KeyGenerators/ReadableKeyGenerator.php b/src/Support/KeyGenerators/ReadableKeyGenerator.php index 9c73f73..de4ae74 100644 --- a/src/Support/KeyGenerators/ReadableKeyGenerator.php +++ b/src/Support/KeyGenerators/ReadableKeyGenerator.php @@ -13,7 +13,7 @@ class ReadableKeyGenerator implements KeyGeneratorContract { protected ContextSerializer $serializer; - public function generate(string $key, Context $context = null): string + public function generate(string $key, ?Context $context = null): string { $key = $this->normalizeKey($key);