Skip to content

Commit f448d95

Browse files
committed
Merge remote-tracking branch 'origin/hash-key-generator' into hash-key-generator
2 parents 4169e05 + 974dd6d commit f448d95

15 files changed

+18
-29
lines changed

src/Contracts/ContextSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
interface ContextSerializer
1010
{
11-
public function serialize(Context $context = null): string;
11+
public function serialize(?Context $context = null): string;
1212
}

src/Contracts/KeyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
interface KeyGenerator
1010
{
11-
public function generate(string $key, Context $context = null): string;
11+
public function generate(string $key, ?Context $context = null): string;
1212

1313
public function removeContextFromKey(string $key): string;
1414

src/Drivers/DatabaseDriver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public function __construct(
1717
protected Connection $connection,
1818
protected string $table,
1919
protected ?string $teamForeignKey = null,
20-
) {
21-
}
20+
) {}
2221

2322
public function forget($key, $teamId = null): void
2423
{

src/Drivers/EloquentDriver.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
class EloquentDriver implements Driver
1212
{
13-
public function __construct(protected Setting $model)
14-
{
15-
}
13+
public function __construct(protected Setting $model) {}
1614

1715
public function forget($key, $teamId = null): void
1816
{

src/Drivers/Factory.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ class Factory
1717

1818
protected array $customCreators = [];
1919

20-
public function __construct(protected Application $app)
21-
{
22-
}
20+
public function __construct(protected Application $app) {}
2321

24-
public function driver(string $driver = null): Driver
22+
public function driver(?string $driver = null): Driver
2523
{
2624
return $this->resolveDriver($driver);
2725
}
@@ -64,7 +62,7 @@ protected function getDriverConfig(string $driver): ?array
6462
return $this->app['config']["settings.drivers.{$driver}"];
6563
}
6664

67-
protected function resolveDriver(string $driver = null): Driver
65+
protected function resolveDriver(?string $driver = null): Driver
6866
{
6967
$driver = $driver ?: $this->getDefaultDriver();
7068

src/Events/SettingWasDeleted.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ public function __construct(
1919
public string $cacheKey,
2020
public mixed $teamId,
2121
public bool|Context|null $context,
22-
) {
23-
}
22+
) {}
2423
}

src/Events/SettingWasStored.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ public function __construct(
2020
public mixed $value,
2121
public mixed $teamId,
2222
public bool|Context|null $context,
23-
) {
24-
}
23+
) {}
2524
}

src/Events/SettingsFlushed.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ public function __construct(
1818
public bool|Collection|string $keys,
1919
public mixed $teamId,
2020
public bool|Context|null $context,
21-
) {
22-
}
21+
) {}
2322
}

src/Settings.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public function __construct(
6666
protected Driver $driver,
6767
protected KeyGenerator $keyGenerator,
6868
protected ValueSerializer $valueSerializer,
69-
) {
70-
}
69+
) {}
7170

7271
// mainly for testing purposes
7372
public function getDriver(): Driver
@@ -79,7 +78,7 @@ public function getDriver(): Driver
7978
* Pass in `false` for context when calling `all()` to only return results
8079
* that do not have context.
8180
*/
82-
public function context(Context|bool $context = null): self
81+
public function context(Context|bool|null $context = null): self
8382
{
8483
$this->context = $context;
8584

src/Support/ContextSerializers/ContextSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class ContextSerializer implements ContextSerializerContract
1111
{
12-
public function serialize(Context $context = null): string
12+
public function serialize(?Context $context = null): string
1313
{
1414
return serialize($context);
1515
}

src/Support/ContextSerializers/DotNotationContextSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class DotNotationContextSerializer implements ContextSerializerContract
1111
{
12-
public function serialize(Context $context = null): string
12+
public function serialize(?Context $context = null): string
1313
{
1414
if (is_null($context)) {
1515
return '';

src/Support/KeyGenerators/HashKeyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class HashKeyGenerator implements KeyGeneratorContract
1313
{
1414
protected ContextSerializer $serializer;
1515

16-
public function generate(string $key, Context $context = null): string
16+
public function generate(string $key, ?Context $context = null): string
1717
{
1818
return hash(
1919
config('settings.hash_algorithm', 'xxh128'),

src/Support/KeyGenerators/Md5KeyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Md5KeyGenerator implements KeyGeneratorContract
1313
{
1414
protected ContextSerializer $serializer;
1515

16-
public function generate(string $key, Context $context = null): string
16+
public function generate(string $key, ?Context $context = null): string
1717
{
1818
return md5($key . $this->serializer->serialize($context));
1919
}

src/Support/KeyGenerators/ReadableKeyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ReadableKeyGenerator implements KeyGeneratorContract
1313
{
1414
protected ContextSerializer $serializer;
1515

16-
public function generate(string $key, Context $context = null): string
16+
public function generate(string $key, ?Context $context = null): string
1717
{
1818
$key = $this->normalizeKey($key);
1919

tests/Support/Drivers/CustomDriver.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@ public function all($teamId = null, $keys = null): array|Arrayable
3434
return [];
3535
}
3636

37-
public function flush($teamId = null, $keys = null): void
38-
{
39-
}
37+
public function flush($teamId = null, $keys = null): void {}
4038
}

0 commit comments

Comments
 (0)