Skip to content

Commit

Permalink
PHP Linting (Pint)
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk authored and github-actions[bot] committed Oct 16, 2024
1 parent 11dfc86 commit 974dd6d
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Contracts/ContextSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

interface ContextSerializer
{
public function serialize(Context $context = null): string;
public function serialize(?Context $context = null): string;
}
2 changes: 1 addition & 1 deletion src/Contracts/KeyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/Drivers/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public function __construct(
protected Connection $connection,
protected string $table,
protected ?string $teamForeignKey = null,
) {
}
) {}

public function forget($key, $teamId = null): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Drivers/EloquentDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 3 additions & 5 deletions src/Drivers/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();

Expand Down
3 changes: 1 addition & 2 deletions src/Events/SettingWasDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public function __construct(
public string $cacheKey,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/SettingWasStored.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ public function __construct(
public mixed $value,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Events/SettingsFlushed.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ public function __construct(
public bool|Collection|string $keys,
public mixed $teamId,
public bool|Context|null $context,
) {
}
) {}
}
5 changes: 2 additions & 3 deletions src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public function __construct(
protected Driver $driver,
protected KeyGenerator $keyGenerator,
protected ValueSerializer $valueSerializer,
) {
}
) {}

// mainly for testing purposes
public function getDriver(): Driver
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Support/ContextSerializers/ContextSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down
2 changes: 1 addition & 1 deletion src/Support/KeyGenerators/HashKeyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion src/Support/KeyGenerators/Md5KeyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/KeyGenerators/ReadableKeyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 1 addition & 3 deletions tests/Support/Drivers/CustomDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}

0 comments on commit 974dd6d

Please sign in to comment.