diff --git a/src/Attachment/Attachable.php b/src/Attachment/Attachable.php index 11f6763e9..74980f278 100644 --- a/src/Attachment/Attachable.php +++ b/src/Attachment/Attachable.php @@ -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), diff --git a/src/Attachment/Engines/Generator.php b/src/Attachment/Engines/Generator.php index 0f35fc432..5c68ef095 100644 --- a/src/Attachment/Engines/Generator.php +++ b/src/Attachment/Engines/Generator.php @@ -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; diff --git a/src/Attachment/File.php b/src/Attachment/File.php index 3cbc5ed77..f4604d09f 100644 --- a/src/Attachment/File.php +++ b/src/Attachment/File.php @@ -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.'); @@ -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); diff --git a/src/Attachment/MimeTypes.php b/src/Attachment/MimeTypes.php index 560ad4cb9..e4fcc1cf7 100644 --- a/src/Attachment/MimeTypes.php +++ b/src/Attachment/MimeTypes.php @@ -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); } @@ -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); } diff --git a/src/Attachment/Models/Attachment.php b/src/Attachment/Models/Attachment.php index 327fbcfb6..0f3beda5d 100644 --- a/src/Attachment/Models/Attachment.php +++ b/src/Attachment/Models/Attachment.php @@ -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')); diff --git a/src/Filters/Filterable.php b/src/Filters/Filterable.php index 864b15075..3fdd36baf 100644 --- a/src/Filters/Filterable.php +++ b/src/Filters/Filterable.php @@ -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); diff --git a/src/Filters/HttpFilter.php b/src/Filters/HttpFilter.php index 24a9a3bb3..d023d6551 100644 --- a/src/Filters/HttpFilter.php +++ b/src/Filters/HttpFilter.php @@ -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(); @@ -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(); diff --git a/src/Metrics/Chartable.php b/src/Metrics/Chartable.php index 99e9103fd..499f75bc4 100644 --- a/src/Metrics/Chartable.php +++ b/src/Metrics/Chartable.php @@ -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(); @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/src/Metrics/GroupCollection.php b/src/Metrics/GroupCollection.php index b51ab4d88..7ab24d6be 100644 --- a/src/Metrics/GroupCollection.php +++ b/src/Metrics/GroupCollection.php @@ -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; diff --git a/src/Metrics/TimeCollection.php b/src/Metrics/TimeCollection.php index 86fbb3886..4d3d63368 100644 --- a/src/Metrics/TimeCollection.php +++ b/src/Metrics/TimeCollection.php @@ -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; diff --git a/src/Platform/Dashboard.php b/src/Platform/Dashboard.php index 6bc22e270..c70406b4b 100644 --- a/src/Platform/Dashboard.php +++ b/src/Platform/Dashboard.php @@ -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); @@ -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); } diff --git a/src/Platform/Http/Controllers/RelationController.php b/src/Platform/Http/Controllers/RelationController.php index aaf912c11..aedf252e5 100644 --- a/src/Platform/Http/Controllers/RelationController.php +++ b/src/Platform/Http/Controllers/RelationController.php @@ -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) { diff --git a/src/Platform/Http/Screens/SearchScreen.php b/src/Platform/Http/Screens/SearchScreen.php index cca58bfc4..4d5dbf3f3 100644 --- a/src/Platform/Http/Screens/SearchScreen.php +++ b/src/Platform/Http/Screens/SearchScreen.php @@ -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; diff --git a/src/Screen/Action.php b/src/Screen/Action.php index 144275c13..320253b2f 100644 --- a/src/Screen/Action.php +++ b/src/Screen/Action.php @@ -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 ?? ''); } @@ -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(); } diff --git a/src/Screen/Actions/DropDown.php b/src/Screen/Actions/DropDown.php index 6fed30a11..afbfdae15 100644 --- a/src/Screen/Actions/DropDown.php +++ b/src/Screen/Actions/DropDown.php @@ -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); diff --git a/src/Screen/Actions/Menu.php b/src/Screen/Actions/Menu.php index d39806822..778e73c82 100644 --- a/src/Screen/Actions/Menu.php +++ b/src/Screen/Actions/Menu.php @@ -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); @@ -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); } diff --git a/src/Screen/Builder.php b/src/Screen/Builder.php index 621c852b0..f208b7dc1 100644 --- a/src/Screen/Builder.php +++ b/src/Screen/Builder.php @@ -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(); @@ -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; @@ -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; diff --git a/src/Screen/Cell.php b/src/Screen/Cell.php index e322dde93..eb0d4c211 100644 --- a/src/Screen/Cell.php +++ b/src/Screen/Cell.php @@ -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; @@ -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; diff --git a/src/Screen/Components/Cells/Boolean.php b/src/Screen/Components/Cells/Boolean.php index 45420e73e..467765aff 100644 --- a/src/Screen/Components/Cells/Boolean.php +++ b/src/Screen/Components/Cells/Boolean.php @@ -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; diff --git a/src/Screen/Components/Popover.php b/src/Screen/Components/Popover.php index 1484042de..396a7e93d 100644 --- a/src/Screen/Components/Popover.php +++ b/src/Screen/Components/Popover.php @@ -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; diff --git a/src/Screen/Concerns/Makeable.php b/src/Screen/Concerns/Makeable.php index c484a0837..7e55067a7 100644 --- a/src/Screen/Concerns/Makeable.php +++ b/src/Screen/Concerns/Makeable.php @@ -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); } diff --git a/src/Screen/Contracts/Searchable.php b/src/Screen/Contracts/Searchable.php index bcd4198cf..be7012cde 100644 --- a/src/Screen/Contracts/Searchable.php +++ b/src/Screen/Contracts/Searchable.php @@ -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; diff --git a/src/Screen/Exceptions/FieldRequiredAttributeException.php b/src/Screen/Exceptions/FieldRequiredAttributeException.php index dfeeb5366..9d58096d3 100644 --- a/src/Screen/Exceptions/FieldRequiredAttributeException.php +++ b/src/Screen/Exceptions/FieldRequiredAttributeException.php @@ -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; diff --git a/src/Screen/Fields/DateTimer.php b/src/Screen/Fields/DateTimer.php index c50766841..b69e87336 100644 --- a/src/Screen/Fields/DateTimer.php +++ b/src/Screen/Fields/DateTimer.php @@ -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'); diff --git a/src/Screen/Fields/RadioButtons.php b/src/Screen/Fields/RadioButtons.php index 492549e73..40f1c5b52 100644 --- a/src/Screen/Fields/RadioButtons.php +++ b/src/Screen/Fields/RadioButtons.php @@ -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); } } diff --git a/src/Screen/Fields/Relation.php b/src/Screen/Fields/Relation.php index a653bf243..94036e54c 100644 --- a/src/Screen/Fields/Relation.php +++ b/src/Screen/Fields/Relation.php @@ -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(); diff --git a/src/Screen/Fields/Select.php b/src/Screen/Fields/Select.php index 3d0c07b3b..4b879d396 100644 --- a/src/Screen/Fields/Select.php +++ b/src/Screen/Fields/Select.php @@ -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(); @@ -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(); diff --git a/src/Screen/LayoutFactory.php b/src/Screen/LayoutFactory.php index 7f02001ac..1863939df 100644 --- a/src/Screen/LayoutFactory.php +++ b/src/Screen/LayoutFactory.php @@ -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 { diff --git a/src/Screen/Layouts/Browsing.php b/src/Screen/Layouts/Browsing.php index 3199373ee..3e34b4d03 100644 --- a/src/Screen/Layouts/Browsing.php +++ b/src/Screen/Layouts/Browsing.php @@ -58,7 +58,7 @@ public function build(Repository $repository) * The policy defines what features are available to the