Skip to content

Commit

Permalink
Fixed code style
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna authored and github-actions[bot] committed Dec 11, 2023
1 parent da2f736 commit 7421825
Show file tree
Hide file tree
Showing 48 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion src/Attachment/Attachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait Attachable
*
* @return MorphToMany
*/
public function attachment(string $group = null): MorphToMany
public function attachment(?string $group = null): MorphToMany
{
$query = $this->morphToMany(
Dashboard::model(Attachment::class),
Expand Down
2 changes: 1 addition & 1 deletion src/Attachment/Engines/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function path(): string
*
* @return Generator
*/
public function setPath(string $path = null)
public function setPath(?string $path = null)
{
$this->path = $path;

Expand Down
4 changes: 2 additions & 2 deletions src/Attachment/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class File
* @param string $disk - the disk to use for storage (defaults to the 'public' disk from the config)
* @param string $group - the group to associate the file with
*/
public function __construct(UploadedFile $file, string $disk = null, string $group = null)
public function __construct(UploadedFile $file, ?string $disk = null, ?string $group = null)
{
// Abort the process if the file does not have an observable size
abort_if($file->getSize() === false, 415, 'File failed to load.');
Expand Down Expand Up @@ -172,7 +172,7 @@ private function save(): Model
*
* @return File
*/
public function path(string $path = null)
public function path(?string $path = null)
{
$this->engine->setPath($path);

Expand Down
4 changes: 2 additions & 2 deletions src/Attachment/MimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct()
*
* @return string|null The file extension, or the default value if no extension is found.
*/
public function getExtension(string $mimeType, string $default = null): ?string
public function getExtension(string $mimeType, ?string $default = null): ?string
{
return Arr::first($this->mime->getExtensions($mimeType), null, $default);
}
Expand All @@ -45,7 +45,7 @@ public function getExtension(string $mimeType, string $default = null): ?string
*
* @return string|null The MIME type, or the default value if no MIME type is found.
*/
public function getMimeType(string $ext, string $default = null): ?string
public function getMimeType(string $ext, ?string $default = null): ?string
{
return Arr::first($this->mime->getMimeTypes($ext), null, $default);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attachment/Models/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function user(): BelongsTo
/**
* Return the address by which you can access the file.
*/
public function url(string $default = null): ?string
public function url(?string $default = null): ?string
{
/** @var Filesystem|Cloud $disk */
$disk = Storage::disk($this->getAttribute('disk'));
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/Filterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function scopeFiltersApplySelection(Builder $query, $class): Builder
/**
* @param iterable|string|Selection $kit
*/
public function scopeFilters(Builder $builder, mixed $kit = null, HttpFilter $httpFilter = null): Builder
public function scopeFilters(Builder $builder, mixed $kit = null, ?HttpFilter $httpFilter = null): Builder
{
$filter = $httpFilter ?? new HttpFilter();
$filter->build($builder);
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/HttpFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class HttpFilter
*
* @param Request|null $request The request object to use. If null, use the default request object.
*/
public function __construct(Request $request = null)
public function __construct(?Request $request = null)
{
$this->request = $request ?? request();

Expand Down Expand Up @@ -147,7 +147,7 @@ protected function addSortsToQuery(Builder $builder)
return $this;
}

public function isSort(string $property = null): bool
public function isSort(?string $property = null): bool
{
if ($property === null) {
return $this->sorts->isEmpty();
Expand Down
12 changes: 6 additions & 6 deletions src/Metrics/Chartable.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function scopeCountForGroup(Builder $builder, string $groupColumn): Group
* @param mixed|null $stopDate
* @param string $dateColumn
*/
private function groupByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
private function groupByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
$dateColumn = $dateColumn ?? $builder->getModel()->getCreatedAtColumn();

Expand Down Expand Up @@ -77,7 +77,7 @@ private function groupByDays(Builder $builder, string $value, $startDate = null,
* @param string|DateTimeInterface|null $stopDate
* @param string $dateColumn
*/
public function scopeCountByDays(Builder $builder, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
public function scopeCountByDays(Builder $builder, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
return $this->groupByDays($builder, 'count(*)', $startDate, $stopDate, $dateColumn);
}
Expand All @@ -88,7 +88,7 @@ public function scopeCountByDays(Builder $builder, $startDate = null, $stopDate
* @param string|DateTimeInterface|null $startDate
* @param string|DateTimeInterface|null $stopDate
*/
public function scopeAverageByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
public function scopeAverageByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
return $this->groupByDays($builder, "avg($value)", $startDate, $stopDate, $dateColumn);
}
Expand All @@ -99,7 +99,7 @@ public function scopeAverageByDays(Builder $builder, string $value, $startDate =
* @param string|DateTimeInterface|null $startDate
* @param string|DateTimeInterface|null $stopDate
*/
public function scopeSumByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
public function scopeSumByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
return $this->groupByDays($builder, "sum($value)", $startDate, $stopDate, $dateColumn);
}
Expand All @@ -110,7 +110,7 @@ public function scopeSumByDays(Builder $builder, string $value, $startDate = nul
* @param string|DateTimeInterface|null $startDate
* @param string|DateTimeInterface|null $stopDate
*/
public function scopeMaxByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
public function scopeMaxByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
return $this->groupByDays($builder, "max($value)", $startDate, $stopDate, $dateColumn);
}
Expand All @@ -121,7 +121,7 @@ public function scopeMaxByDays(Builder $builder, string $value, $startDate = nul
* @param string|DateTimeInterface|null $startDate
* @param string|DateTimeInterface|null $stopDate
*/
public function scopeMinByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, string $dateColumn = null): TimeCollection
public function scopeMinByDays(Builder $builder, string $value, $startDate = null, $stopDate = null, ?string $dateColumn = null): TimeCollection
{
return $this->groupByDays($builder, "min($value)", $startDate, $stopDate, $dateColumn);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/GroupCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GroupCollection extends Collection
*
* @return array A multidimensional array ready to be used in a chart.
*/
public function toChart(\Closure $closure = null): array
public function toChart(?\Closure $closure = null): array
{
// If the closure is not set, we define a default one that returns the original label.
$closure = $closure ?? static fn ($label) => $label;
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/TimeCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function makeFromKeyValue($values, string $format = 'Y-m-d'): TimeCollect
*
* @return array
*/
public function toChart(string $name, \Closure $closure = null): array
public function toChart(string $name, ?\Closure $closure = null): array
{
$closure = $closure ?? static fn ($label) => $label;

Expand Down
4 changes: 2 additions & 2 deletions src/Platform/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static function option(string $key, $default = null)
/**
* @return mixed
*/
public static function modelClass(string $key, string $default = null)
public static function modelClass(string $key, ?string $default = null)
{
$model = static::model($key, $default);

Expand All @@ -155,7 +155,7 @@ public static function modelClass(string $key, string $default = null)
/**
* Get the class name for a given Dashboard model.
*/
public static function model(string $key, string $default = null): string
public static function model(string $key, ?string $default = null): string
{
return Arr::get(static::$options, 'models.'.$key, $default ?? $key);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Platform/Http/Controllers/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ private function buildersItems(
Model $model,
string $name,
string $key,
string $search = null,
?string $search = null,
?array $scope = [],
string $append = null,
array $searchColumns = null,
?string $append = null,
?array $searchColumns = null,
?int $chunk = 10
) {
if ($scope !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Platform/Http/Screens/SearchScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function changeSearchType(Request $request)
/**
* @return Factory|View
*/
public function compact(string $query = null)
public function compact(?string $query = null)
{
$total = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/Screen/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Action extends Field implements Actionable
'name',
];

public function name(string $name = null): self
public function name(?string $name = null): self
{
return $this->set('name', $name ?? '');
}
Expand All @@ -62,7 +62,7 @@ public function type(Color $visual): self
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
*/
public function build(Repository $repository = null)
public function build(?Repository $repository = null)
{
return $this->render();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Actions/DropDown.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function list(array $list): self
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
*/
public function build(Repository $repository = null)
public function build(?Repository $repository = null)
{
$this->set('source', $repository);

Expand Down
4 changes: 2 additions & 2 deletions src/Screen/Actions/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function list(array $list): self
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
*/
public function build(Repository $repository = null)
public function build(?Repository $repository = null)
{
$this->set('source', $repository);

Expand Down Expand Up @@ -197,7 +197,7 @@ public function isSee(): bool
/**
* @return $this
*/
public function title(string $title = null): self
public function title(?string $title = null): self
{
return $this->set('title', $title);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Screen/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Builder
*
* @param Fieldable[] $fields
*/
public function __construct(iterable $fields, Repository $data = null)
public function __construct(iterable $fields, ?Repository $data = null)
{
$this->fields = collect($fields)->all();
$this->data = $data ?? new Repository();
Expand All @@ -61,7 +61,7 @@ public function __construct(iterable $fields, Repository $data = null)
/**
* @return $this
*/
public function setLanguage(string $language = null): self
public function setLanguage(?string $language = null): self
{
$this->language = $language;

Expand All @@ -71,7 +71,7 @@ public function setLanguage(string $language = null): self
/**
* @return $this
*/
public function setPrefix(string $prefix = null): self
public function setPrefix(?string $prefix = null): self
{
$this->prefix = $prefix;

Expand Down
4 changes: 2 additions & 2 deletions src/Screen/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(string $name)
/**
* @return static
*/
public static function make(string $name = '', string $title = null): static
public static function make(string $name = '', ?string $title = null): static
{
$td = new static($name);
$td->column = $name;
Expand Down Expand Up @@ -159,7 +159,7 @@ public function usingComponent(string $component, ...$params): static
*
* @return mixed
*/
protected function handler($source, object $loop = null)
protected function handler($source, ?object $loop = null)
{
$callback = $this->render;

Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Components/Cells/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Boolean extends Component
* @param string|null $true
* @param string|null $falseLabel
*/
public function __construct(?bool $value, string $true = null, string $false = null)
public function __construct(?bool $value, ?string $true = null, ?string $false = null)
{
$this->value = $value;
$this->true = $true;
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Components/Popover.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Popover extends Component
/**
* Create a new component instance.
*/
public function __construct(string $content = null, string $placement = 'auto')
public function __construct(?string $content = null, string $placement = 'auto')
{
$this->content = $content;
$this->placement = $placement;
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Concerns/Makeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait Makeable
*
* @return static
*/
public static function make(string $name = null): self
public static function make(?string $name = null): self
{
return (new static)->name($name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Contracts/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Searchable
*/
public function perSearchShow(): int;

public function searchQuery(string $query = null): Builder;
public function searchQuery(?string $query = null): Builder;

public function label(): string;

Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Exceptions/FieldRequiredAttributeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FieldRequiredAttributeException extends Exception
/**
* FieldRequiredAttributeException constructor.
*/
public function __construct(string $attribute = '', int $code = 0, Throwable $previous = null)
public function __construct(string $attribute = '', int $code = 0, ?Throwable $previous = null)
{
parent::__construct($attribute, $code, $previous);
$this->message = 'Field must have the following attribute: '.$attribute;
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Fields/DateTimer.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function format(string $format): self
*
* @return $this
*/
public function serverFormat(string $format = null): self
public function serverFormat(?string $format = null): self
{
return $this->addBeforeRender(function () use ($format) {
$value = $this->get('value');
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Fields/RadioButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ public function __construct()

public function declarateActive(): self
{
return $this->set('active', fn (string $key, string $value = null) => $key === $value);
return $this->set('active', fn (string $key, ?string $value = null) => $key === $value);
}
}
2 changes: 1 addition & 1 deletion src/Screen/Fields/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Relation extends Field
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function fromModel(string $model, string $name, string $key = null): self
public function fromModel(string $model, string $name, ?string $key = null): self
{
$key = $key ?? resolve($model)->getModel()->getKeyName();

Expand Down
4 changes: 2 additions & 2 deletions src/Screen/Fields/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct()
/**
* @param string|Model $model
*/
public function fromModel($model, string $name, string $key = null): self
public function fromModel($model, string $name, ?string $key = null): self
{
/* @var $model Model */
$model = is_object($model) ? $model : new $model();
Expand Down Expand Up @@ -143,7 +143,7 @@ private function setFromEloquent($model, string $name, string $key): self
});
}

public function fromQuery(Builder $builder, string $name, string $key = null): self
public function fromQuery(Builder $builder, string $name, ?string $key = null): self
{
$key = $key ?? $builder->getModel()->getKeyName();

Expand Down
2 changes: 1 addition & 1 deletion src/Screen/LayoutFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function metrics(array $labels): Metric
*
* @return \Orchid\Screen\Layouts\Chart
*/
public static function chart(string $target, string $title = null): Chart
public static function chart(string $target, ?string $title = null): Chart
{
$chart = new class() extends Chart
{
Expand Down
Loading

0 comments on commit 7421825

Please sign in to comment.