Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sertxudev authored and github-actions[bot] committed Feb 13, 2024
1 parent 9b9a438 commit d9f0045
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions src/Cards/MetricCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract public function calculate(Request $request): array;
*
* @return float[]
*/
public function count(Request $request, Builder|string $model, string $column = null, string $dateColumn = null): array {
public function count(Request $request, Builder|string $model, ?string $column = null, ?string $dateColumn = null): array {
return $this->query($request, $model, 'count', $column, $dateColumn);
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public function difference(float $current, float $previous): float|int {
*
* @return float[]
*/
public function max(Request $request, Builder|string $model, string $column, string $dateColumn = null): array {
public function max(Request $request, Builder|string $model, string $column, ?string $dateColumn = null): array {
return $this->query($request, $model, 'max', $column, $dateColumn);
}

Expand All @@ -71,7 +71,7 @@ public function max(Request $request, Builder|string $model, string $column, str
*
* @return float[]
*/
public function min(Request $request, Builder|string $model, string $column, string $dateColumn = null): array {
public function min(Request $request, Builder|string $model, string $column, ?string $dateColumn = null): array {
return $this->query($request, $model, 'min', $column, $dateColumn);
}

Expand All @@ -89,7 +89,7 @@ public function previousRange(Request $request): array {
*
* @return float[]
*/
public function query(Request $request, Builder|string $model, string $method, string $column = null, string $dateColumn = null): array {
public function query(Request $request, Builder|string $model, string $method, ?string $column = null, ?string $dateColumn = null): array {
$query = $model instanceof Builder ? $model : $model::query();
$column = $column ?? $query->getModel()->getQualifiedKeyName();
$createdAt = $query->getModel()->getCreatedAtColumn();
Expand Down Expand Up @@ -122,7 +122,7 @@ public function ranges(): array {
*
* @return float[]
*/
public function sum(Request $request, Builder|string $model, string $column, string $dateColumn = null): array {
public function sum(Request $request, Builder|string $model, string $column, ?string $dateColumn = null): array {
return $this->query($request, $model, 'sum', $column, $dateColumn);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cards/PartitionCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function colors(): array {
*
* @return array[]
*/
public function count(Request $request, Builder|string $model, string $groupBy, string $column = null): array {
public function count(Request $request, Builder|string $model, string $groupBy, ?string $column = null): array {
return $this->query($request, $model, 'count', $column, $groupBy);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Cards/SimpleCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract public function calculate(Request $request): float;
/**
* Count instances of the model
*/
public function count(Request $request, Builder|string $model, string $column = null): float {
public function count(Request $request, Builder|string $model, ?string $column = null): float {
return $this->query($request, $model, 'count', $column);
}

Expand All @@ -54,7 +54,7 @@ public function min(Request $request, Builder|string $model, string $column): fl
/**
* Return the result of the query
*/
public function query(Request $request, Builder|string $model, string $method, string $column = null): float {
public function query(Request $request, Builder|string $model, string $method, ?string $column = null): float {
$query = $model instanceof Builder ? $model : $model::query();
$column = $column ?? $query->getModel()->getQualifiedKeyName();

Expand Down
4 changes: 2 additions & 2 deletions src/Console/ResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ protected function getStub(): string {
/**
* Replace the class name for the given stub.
*
* @param string $stub The stub to replace the class name in
* @param string $name The name of the class
* @param string $stub The stub to replace the class name in
* @param string $name The name of the class
*/
protected function replaceModel(string $stub, string $name): string {
$namespace = is_dir(app_path('Models')) ? $this->rootNamespace()."Models\\$name" : $this->rootNamespace().$name;
Expand Down
4 changes: 2 additions & 2 deletions src/Fields/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function falseValue(mixed $value): self {
/**
* Update the field value using the given data
*
* @param Model $model The model to be updated
* @param array $data The new validated data
* @param Model $model The model to be updated
* @param array $data The new validated data
*/
public function save(Model $model, array $data): void {
$model->{$this->getKey()} = $data[$this->getKey()] == true ? $this->trueValue : $this->falseValue;
Expand Down
6 changes: 3 additions & 3 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class Field
*
* @return $this
*/
public static function make(string $name, object|string $column = null): self {
public static function make(string $name, object|string|null $column = null): self {
$field = new static;
$field->name = $name;
$field->column = $column ?? Str::snake(Str::lower($name));
Expand Down Expand Up @@ -139,8 +139,8 @@ public function rules(string ...$rules): self {
/**
* Update the field value using the given data
*
* @param Model $model The model to be updated
* @param array $data The new validated data
* @param Model $model The model to be updated
* @param array $data The new validated data
*/
public function save(Model $model, array $data): void {
if (is_callable($this->column)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Image extends Field
*
* @return $this
*/
public static function make(string $name, object|string $column = null): Field {
public static function make(string $name, object|string|null $column = null): Field {
$field = parent::make($name, $column);

$field->folder = $field->getKey();
Expand Down
6 changes: 3 additions & 3 deletions src/Fields/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Password extends Field
*
* @return $this
*/
public static function make(string $name, object|string $column = null): Field {
public static function make(string $name, object|string|null $column = null): Field {
$field = parent::make($name, $column);

$field->placeholder(Str::repeat('*', 12));
Expand All @@ -39,8 +39,8 @@ public function additional(Model $model): array {
/**
* Update the field value using the given data
*
* @param Model $model The model to be updated
* @param array $data The new validated data
* @param Model $model The model to be updated
* @param array $data The new validated data
*/
public function save(Model $model, array $data): void {
if ($data[$this->getKey()]) {
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class AssetsController extends Controller
/**
* Get the requested asset from the internal vendor folder.
*
* @param $any string|null Asset path
* @param $any string|null Asset path
*/
public function show(Request $request, string $any = null): Response {
public function show(Request $request, ?string $any = null): Response {
abort_if(!$any, Response::HTTP_NOT_FOUND);

$file = Lyra::asset($any);
Expand Down
10 changes: 5 additions & 5 deletions src/Lyra.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Lyra
/**
* Generate a URL of the given asset
*
* @param string $file The asset file name
* @param string $file The asset file name
* @return string The URL of the asset
*/
public static function asset(string $file): string {
Expand All @@ -53,7 +53,7 @@ public static function getRouteName(Request $request): string {
/**
* Get the resource class from the given slug
*
* @param string $slug Slug of the wanted resource
* @param string $slug Slug of the wanted resource
* @return string Class name of the resource
*
* @throws ResourceNotFoundException
Expand All @@ -71,7 +71,7 @@ public static function resourceBySlug(string $slug): string {
/**
* Register given resources
*
* @param string ...$resource The resources to register
* @param string ...$resource The resources to register
*/
public static function resources(string ...$resource): void {
static::$resources = array_unique(array_merge(static::$resources, $resource));
Expand All @@ -80,7 +80,7 @@ public static function resources(string ...$resource): void {
/**
* Register resources in a directory
*
* @param string $directory Directory to scan for resources
* @param string $directory Directory to scan for resources
*/
public static function resourcesIn(string $directory): void {
$namespace = app()->getNamespace();
Expand Down Expand Up @@ -111,7 +111,7 @@ public static function resourcesIn(string $directory): void {
/**
* Register Lyra routes
*
* @param bool $auth Whether to register authentication routes
* @param bool $auth Whether to register authentication routes
*/
public static function routes(bool $auth = false): void {
require __DIR__.'/../routes/api.php';
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setUp(): void {
);
}

protected function authenticate(Authenticatable $user = null): Authenticatable {
protected function authenticate(?Authenticatable $user = null): Authenticatable {
$this->actingAs($user ??= User::factory()->create());

return $user;
Expand Down

0 comments on commit d9f0045

Please sign in to comment.