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/DatabaseDriver.php b/src/Drivers/DatabaseDriver.php index ab8da3d..cebe2a9 100644 --- a/src/Drivers/DatabaseDriver.php +++ b/src/Drivers/DatabaseDriver.php @@ -17,8 +17,7 @@ public function __construct( protected Connection $connection, protected string $table, protected ?string $teamForeignKey = null, - ) { - } + ) {} public function forget($key, $teamId = null): void { diff --git a/src/Drivers/EloquentDriver.php b/src/Drivers/EloquentDriver.php index b0143bf..b6bd9cd 100644 --- a/src/Drivers/EloquentDriver.php +++ b/src/Drivers/EloquentDriver.php @@ -10,9 +10,7 @@ class EloquentDriver implements Driver { - public function __construct(protected Setting $model) - { - } + public function __construct(protected Setting $model) {} public function forget($key, $teamId = null): void { diff --git a/src/Drivers/Factory.php b/src/Drivers/Factory.php index 36e9d4a..4ccd09f 100644 --- a/src/Drivers/Factory.php +++ b/src/Drivers/Factory.php @@ -17,11 +17,9 @@ class Factory protected array $customCreators = []; - public function __construct(protected Application $app) - { - } + 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 +62,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/Events/SettingWasDeleted.php b/src/Events/SettingWasDeleted.php index d622771..267f301 100644 --- a/src/Events/SettingWasDeleted.php +++ b/src/Events/SettingWasDeleted.php @@ -19,6 +19,5 @@ public function __construct( public string $cacheKey, public mixed $teamId, public bool|Context|null $context, - ) { - } + ) {} } diff --git a/src/Events/SettingWasStored.php b/src/Events/SettingWasStored.php index 2cdef65..71cbcb7 100644 --- a/src/Events/SettingWasStored.php +++ b/src/Events/SettingWasStored.php @@ -20,6 +20,5 @@ public function __construct( public mixed $value, public mixed $teamId, public bool|Context|null $context, - ) { - } + ) {} } diff --git a/src/Events/SettingsFlushed.php b/src/Events/SettingsFlushed.php index 5283e16..f40d394 100644 --- a/src/Events/SettingsFlushed.php +++ b/src/Events/SettingsFlushed.php @@ -18,6 +18,5 @@ public function __construct( public bool|Collection|string $keys, public mixed $teamId, public bool|Context|null $context, - ) { - } + ) {} } diff --git a/src/Settings.php b/src/Settings.php index 337349b..f45598e 100755 --- a/src/Settings.php +++ b/src/Settings.php @@ -66,8 +66,7 @@ public function __construct( protected Driver $driver, protected KeyGenerator $keyGenerator, protected ValueSerializer $valueSerializer, - ) { - } + ) {} // mainly for testing purposes public function getDriver(): Driver @@ -79,7 +78,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/HashKeyGenerator.php b/src/Support/KeyGenerators/HashKeyGenerator.php index 815ba89..9c6a8f1 100644 --- a/src/Support/KeyGenerators/HashKeyGenerator.php +++ b/src/Support/KeyGenerators/HashKeyGenerator.php @@ -13,7 +13,7 @@ class HashKeyGenerator implements KeyGeneratorContract { protected ContextSerializer $serializer; - public function generate(string $key, Context $context = null): string + public function generate(string $key, ?Context $context = null): string { return hash( config('settings.hash_algorithm', 'xxh128'), 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); diff --git a/tests/Support/Drivers/CustomDriver.php b/tests/Support/Drivers/CustomDriver.php index 944b99b..07536b2 100644 --- a/tests/Support/Drivers/CustomDriver.php +++ b/tests/Support/Drivers/CustomDriver.php @@ -34,7 +34,5 @@ public function all($teamId = null, $keys = null): array|Arrayable return []; } - public function flush($teamId = null, $keys = null): void - { - } + public function flush($teamId = null, $keys = null): void {} }