From 9e449ed98ba81e215c2ab36950a212a26985da3c Mon Sep 17 00:00:00 2001 From: ewilan-riviere Date: Wed, 13 Dec 2023 07:18:39 +0000 Subject: [PATCH] Fix styling --- src/Commands/Commandable.php | 4 ++-- src/Engines/SearchEngine.php | 2 +- src/Filament/Components/AutoPicture.php | 2 +- src/Filament/Components/DescriptionInput.php | 2 +- src/Filament/Components/NameInput.php | 2 +- .../FilamentBuilderContainer.php | 4 ++-- src/Filament/Config/FilamentChart.php | 4 ++-- src/Filament/Config/FilamentForm.php | 6 +++--- .../FilamentLayout/FilamentLayoutCard.php | 2 +- src/Livewire/Traits/LiveNotify.php | 2 +- src/Livewire/Traits/LiveUpload.php | 2 +- src/Livewire/Traits/LiveValidator.php | 2 +- src/Queries/BaseQuery.php | 4 ++-- src/Queries/ExportQuery.php | 4 ++-- src/Services/Api/Seeds/SeedsApi.php | 2 +- src/Services/ClassParser/MetaClassItem.php | 2 +- src/Services/Factory/FactoryJson.php | 2 +- .../Factory/FactoryMediaDownloader.php | 6 +++--- src/Services/Factory/FactoryMediaLocal.php | 2 +- src/Services/Factory/FactoryText.php | 4 ++-- src/Services/Factory/Media/MediaProvider.php | 4 ++-- src/Services/FactoryService.php | 18 +++++++++--------- src/Services/FileUploadService.php | 6 +++--- src/Services/IframelyService.php | 2 +- src/Services/Markdown/MarkdownFrontmatter.php | 2 +- src/Services/MediaService.php | 6 +++--- src/Services/Notify/Notifying.php | 2 +- src/Services/NotifyService.php | 2 +- src/Services/ProcessService.php | 2 +- src/Services/Query/SortModule.php | 2 +- src/Services/ScoutService.php | 2 +- src/Services/SlugService.php | 4 ++-- src/Services/Social/Modules/SocialTwitter.php | 2 +- src/Services/Wikipedia/WikipediaItem.php | 2 +- src/Traits/HasAttachment.php | 2 +- src/Traits/HasSeo.php | 2 +- src/Traits/Mediable.php | 2 +- 37 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/Commands/Commandable.php b/src/Commands/Commandable.php index 625f310d..1cc8d03b 100644 --- a/src/Commands/Commandable.php +++ b/src/Commands/Commandable.php @@ -7,7 +7,7 @@ class Commandable extends Command { - public function title(string $signature = null, string $description = null) + public function title(?string $signature = null, ?string $description = null) { $app = config('app.name'); $this->newLine(); @@ -37,7 +37,7 @@ public function title(string $signature = null, string $description = null) $this->newLine(); } - public function askOnProduction(Closure $closure = null, bool $with_force = true, string $option = 'force') + public function askOnProduction(?Closure $closure = null, bool $with_force = true, string $option = 'force') { $force = false; diff --git a/src/Engines/SearchEngine.php b/src/Engines/SearchEngine.php index d40864be..dd11b815 100644 --- a/src/Engines/SearchEngine.php +++ b/src/Engines/SearchEngine.php @@ -34,7 +34,7 @@ public function __construct( /** * Create an instance of SearchEngine from query. */ - public static function create(?string $q = '', bool $relevant = false, bool $opds = false, string|array $types = null): SearchEngine + public static function create(?string $q = '', bool $relevant = false, bool $opds = false, string|array|null $types = null): SearchEngine { if (gettype($types) === 'string') { $types = explode(',', $types); diff --git a/src/Filament/Components/AutoPicture.php b/src/Filament/Components/AutoPicture.php index 6cce3bdb..f6884b79 100644 --- a/src/Filament/Components/AutoPicture.php +++ b/src/Filament/Components/AutoPicture.php @@ -19,7 +19,7 @@ public static function make( 'image/svg+xml', ], string $hint = 'Accepte JPG, WEBP, PNG, SVG', - Closure $disabled = null, + ?Closure $disabled = null, ): Forms\Components\FileUpload { if (! $disabled) { $disabled = false; diff --git a/src/Filament/Components/DescriptionInput.php b/src/Filament/Components/DescriptionInput.php index c95b094a..ce3de4dd 100644 --- a/src/Filament/Components/DescriptionInput.php +++ b/src/Filament/Components/DescriptionInput.php @@ -11,7 +11,7 @@ public static function make( string $field = 'description', string|false $metaField = 'meta_description', string $label = 'Description', - string $helper = null, + ?string $helper = null, string $skipContext = 'edit', int $width = 1, bool $required = false, diff --git a/src/Filament/Components/NameInput.php b/src/Filament/Components/NameInput.php index 1ea704b3..83bda825 100644 --- a/src/Filament/Components/NameInput.php +++ b/src/Filament/Components/NameInput.php @@ -13,7 +13,7 @@ public static function make( string|false $metaLink = 'slug', string|false $metaTitle = 'meta_title', string $label = 'Name', - string $helper = null, + ?string $helper = null, string $skipContext = 'edit', int $width = 1, bool $required = true, diff --git a/src/Filament/Config/FilamentBuilder/FilamentBuilderContainer.php b/src/Filament/Config/FilamentBuilder/FilamentBuilderContainer.php index 9cee12e2..034395e0 100644 --- a/src/Filament/Config/FilamentBuilder/FilamentBuilderContainer.php +++ b/src/Filament/Config/FilamentBuilder/FilamentBuilderContainer.php @@ -48,14 +48,14 @@ public function field(string $field = 'content'): self return $this; } - public function minItems(int $minItems = null): self + public function minItems(?int $minItems = null): self { $this->minItems = $minItems; return $this; } - public function maxItems(int $maxItems = null): self + public function maxItems(?int $maxItems = null): self { $this->maxItems = $maxItems; diff --git a/src/Filament/Config/FilamentChart.php b/src/Filament/Config/FilamentChart.php index 078ed8c2..9a98a556 100644 --- a/src/Filament/Config/FilamentChart.php +++ b/src/Filament/Config/FilamentChart.php @@ -19,7 +19,7 @@ public function __construct( ) { } - public static function chartBy(string $table, string $field, string $limit_year = null, bool $published = false): FilamentChart + public static function chartBy(string $table, string $field, ?string $limit_year = null, bool $published = false): FilamentChart { $models_db = DB::table($table) ->selectRaw(" @@ -59,7 +59,7 @@ public static function chartBy(string $table, string $field, string $limit_year return $chart_helper; } - public static function chartByField(string $table, string $field, string $limit_year = null, bool $published = false): self + public static function chartByField(string $table, string $field, ?string $limit_year = null, bool $published = false): self { $models_db = DB::table($table) ->selectRaw(" diff --git a/src/Filament/Config/FilamentForm.php b/src/Filament/Config/FilamentForm.php index 4b40de33..d2c9095b 100644 --- a/src/Filament/Config/FilamentForm.php +++ b/src/Filament/Config/FilamentForm.php @@ -28,7 +28,7 @@ public static function name( string|false $metaLink = 'slug', string|false $metaTitle = 'meta_title', string $label = 'Name', - string $helper = null, + ?string $helper = null, string $skipContext = 'edit', int $width = 1, bool $required = true, @@ -77,7 +77,7 @@ public static function description( string $field = 'description', string|false $metaField = 'meta_description', string $label = 'Description', - string $helper = null, + ?string $helper = null, string $skipContext = 'edit', int $width = 1, bool $required = false, @@ -263,7 +263,7 @@ public static function pictureField( 'image/svg+xml', ], string $hint = 'Accepte JPG, WEBP, PNG, SVG', - Closure $disabled = null, + ?Closure $disabled = null, ) { if (! $disabled) { $disabled = false; diff --git a/src/Filament/Config/FilamentLayout/FilamentLayoutCard.php b/src/Filament/Config/FilamentLayout/FilamentLayoutCard.php index b6dad7d5..f01e5793 100644 --- a/src/Filament/Config/FilamentLayout/FilamentLayoutCard.php +++ b/src/Filament/Config/FilamentLayout/FilamentLayoutCard.php @@ -13,7 +13,7 @@ class FilamentLayoutCard * @param Field[] $fields * @param ?string $title */ - public static function make(array $fields = [], string $title = null, int $width = 2): Section + public static function make(array $fields = [], ?string $title = null, int $width = 2): Section { $list = []; diff --git a/src/Livewire/Traits/LiveNotify.php b/src/Livewire/Traits/LiveNotify.php index 9506af41..6d2e8713 100644 --- a/src/Livewire/Traits/LiveNotify.php +++ b/src/Livewire/Traits/LiveNotify.php @@ -12,7 +12,7 @@ trait LiveNotify /** * Send notification to user. */ - public function notify(string $message = null): LiveNotifyItem + public function notify(?string $message = null): LiveNotifyItem { if (method_exists($this, 'mount')) { $this->mount(); diff --git a/src/Livewire/Traits/LiveUpload.php b/src/Livewire/Traits/LiveUpload.php index 3b7a6342..b1b1753e 100644 --- a/src/Livewire/Traits/LiveUpload.php +++ b/src/Livewire/Traits/LiveUpload.php @@ -181,7 +181,7 @@ public function deleteAllUpload(string $field) /** * Delete existing upload in model. */ - protected function deleteToModel(string $field, string|int $index = null, bool $all = false): void + protected function deleteToModel(string $field, string|int|null $index = null, bool $all = false): void { $isArray = is_array($this->{$field}); $current = $this->{$field} ?? null; diff --git a/src/Livewire/Traits/LiveValidator.php b/src/Livewire/Traits/LiveValidator.php index 2574ebc5..acbb9b42 100644 --- a/src/Livewire/Traits/LiveValidator.php +++ b/src/Livewire/Traits/LiveValidator.php @@ -12,7 +12,7 @@ trait LiveValidator { use LiveNotify; - public function validator(Closure $callback = null): array + public function validator(?Closure $callback = null): array { return $this->withValidator( fn (Validator $validator) => $validator->after( diff --git a/src/Queries/BaseQuery.php b/src/Queries/BaseQuery.php index ca67b5f8..25acb3bd 100644 --- a/src/Queries/BaseQuery.php +++ b/src/Queries/BaseQuery.php @@ -81,7 +81,7 @@ abstract class BaseQuery */ protected int $pagination = 15; - protected function setup(string|Builder $model, Request $request = null): self + protected function setup(string|Builder $model, ?Request $request = null): self { if (! \Composer\InstalledVersions::isInstalled('spatie/laravel-query-builder')) { throw new \Exception('Package `spatie/laravel-query-builder` not installed, see: https://github.com/spatie/laravel-query-builder'); @@ -147,7 +147,7 @@ public function inertia(): QueryResponse * @param string|null $toSave Path to save file, if null return download response. * @param bool $skipExcel If you have `maatwebsite/excel` installed, you can skip Excel export and use only CSV. */ - public function export(string $toSave = null, bool $skipExcel = false): Response|BinaryFileResponse|bool + public function export(?string $toSave = null, bool $skipExcel = false): Response|BinaryFileResponse|bool { $this->loadRequest(); $this->exportGuess(); diff --git a/src/Queries/ExportQuery.php b/src/Queries/ExportQuery.php index 96394597..ee7c7e24 100644 --- a/src/Queries/ExportQuery.php +++ b/src/Queries/ExportQuery.php @@ -22,7 +22,7 @@ protected function __construct( ) { } - public static function make(Collection $data, QueryBuilder $query, string $name, string $export = null, string $path = null, bool $skipExcel = false): self + public static function make(Collection $data, QueryBuilder $query, string $name, ?string $export = null, ?string $path = null, bool $skipExcel = false): self { $filename = $name; $date = date('Ymd-His'); @@ -121,7 +121,7 @@ private function selectType(): string return \Composer\InstalledVersions::isInstalled('maatwebsite/excel') ? 'excel' : 'standard'; } - private function arrayFlatten(array $array, string $prefix = null): ?array + private function arrayFlatten(array $array, ?string $prefix = null): ?array { if (! is_array($array)) { return null; diff --git a/src/Services/Api/Seeds/SeedsApi.php b/src/Services/Api/Seeds/SeedsApi.php index 37d5914c..d4375e08 100644 --- a/src/Services/Api/Seeds/SeedsApi.php +++ b/src/Services/Api/Seeds/SeedsApi.php @@ -63,7 +63,7 @@ public function medias(): Collection public function fetchPictures( SeedsApiCategoryEnum $category = SeedsApiCategoryEnum::all, SeedsApiSizeEnum $size = SeedsApiSizeEnum::medium, - int $count = null + ?int $count = null ): Collection { $count = $count ?? null; diff --git a/src/Services/ClassParser/MetaClassItem.php b/src/Services/ClassParser/MetaClassItem.php index 5eb13035..a8a8e14f 100644 --- a/src/Services/ClassParser/MetaClassItem.php +++ b/src/Services/ClassParser/MetaClassItem.php @@ -29,7 +29,7 @@ protected function __construct( * * @param string $classString like `WikipediaItem::class` */ - public static function make(string $classString, ReflectionClass $reflect = null): self + public static function make(string $classString, ?ReflectionClass $reflect = null): self { $self = new self($classString); diff --git a/src/Services/Factory/FactoryJson.php b/src/Services/Factory/FactoryJson.php index 411bccf4..c1cf56ca 100644 --- a/src/Services/Factory/FactoryJson.php +++ b/src/Services/Factory/FactoryJson.php @@ -143,7 +143,7 @@ private function parseEntity(mixed $entity): void $created_model->save(); } - public function setMedia(mixed $model, string $path = null): ?string + public function setMedia(mixed $model, ?string $path = null): ?string { if (! $model instanceof Model) { return null; diff --git a/src/Services/Factory/FactoryMediaDownloader.php b/src/Services/Factory/FactoryMediaDownloader.php index 346b5a84..7cddec46 100644 --- a/src/Services/Factory/FactoryMediaDownloader.php +++ b/src/Services/Factory/FactoryMediaDownloader.php @@ -28,8 +28,8 @@ public function __construct( * @param SeedsApiSizeEnum|null $size default is `medium` */ public function config( - SeedsApiCategoryEnum $category = null, - SeedsApiSizeEnum $size = null, + ?SeedsApiCategoryEnum $category = null, + ?SeedsApiSizeEnum $size = null, ): self { $this->config = [ 'category' => $category ?? StewardConfig::factoryMediaDownloaderDefaultCategory(), @@ -98,7 +98,7 @@ private function associateByChunk(Collection $models, string $field, bool $multi /** * @return Collection */ - private function fetchMedias(int $count = 1, string $basePath = null) + private function fetchMedias(int $count = 1, ?string $basePath = null) { $this->config['count'] = $count; diff --git a/src/Services/Factory/FactoryMediaLocal.php b/src/Services/Factory/FactoryMediaLocal.php index 76f8f636..6d982ec4 100644 --- a/src/Services/Factory/FactoryMediaLocal.php +++ b/src/Services/Factory/FactoryMediaLocal.php @@ -78,7 +78,7 @@ private function associateByChunk(Collection $models, string $field, bool $multi /** * @return Collection */ - private function fetchMedias(string $basePath = null): Collection + private function fetchMedias(?string $basePath = null): Collection { $path = "{$this->basePath}/{$this->path}"; diff --git a/src/Services/Factory/FactoryText.php b/src/Services/Factory/FactoryText.php index 342d5ddc..95f457c2 100644 --- a/src/Services/Factory/FactoryText.php +++ b/src/Services/Factory/FactoryText.php @@ -29,7 +29,7 @@ public function title(): string return TextProvider::capitalizeFirst($this->words()); } - public function category(string $class = null, string $field = 'name'): string + public function category(?string $class = null, string $field = 'name'): string { if (! $class) { return MeaningProvider::find(); @@ -58,7 +58,7 @@ public function category(string $class = null, string $field = 'name'): string // } } - public function tag(string $class = null, string $field = 'name'): string + public function tag(?string $class = null, string $field = 'name'): string { if (! $class) { return MeaningProvider::find('tag'); diff --git a/src/Services/Factory/Media/MediaProvider.php b/src/Services/Factory/Media/MediaProvider.php index d28d16a4..9d5849ea 100644 --- a/src/Services/Factory/Media/MediaProvider.php +++ b/src/Services/Factory/Media/MediaProvider.php @@ -23,8 +23,8 @@ public static function make(): self } public function seeds( - SeedsApiCategoryEnum $category = null, - SeedsApiSizeEnum $size = null, + ?SeedsApiCategoryEnum $category = null, + ?SeedsApiSizeEnum $size = null, int $count = 1, ): MediaApi { $this->type = MediaApiEnum::seeds; diff --git a/src/Services/FactoryService.php b/src/Services/FactoryService.php index 1a6fba39..7a3a982a 100644 --- a/src/Services/FactoryService.php +++ b/src/Services/FactoryService.php @@ -57,7 +57,7 @@ public static function afterSeed(): void Artisan::call(MediaCleanCommand::class, ['--force' => true]); } - public static function make(string|\UnitEnum $mediaPath = null): self + public static function make(string|\UnitEnum|null $mediaPath = null): self { $faker = \Faker\Factory::create(); $service = new FactoryService($faker); @@ -82,7 +82,7 @@ public static function noSearch(string $model, Closure $closure): mixed return $model::withoutSyncingToSearch(fn () => $closure()); } - public function useText(FactoryTextEnum $type = null): self + public function useText(?FactoryTextEnum $type = null): self { $this->text = $this->setFactoryText($type); $this->richText = $this->setFactoryRichText($type); @@ -113,7 +113,7 @@ public function dateTime(): FactoryDateTime /** * @param string|null $basePath If null, use `database_path('seeders/media')` */ - public function mediaLocal(string $path, string $basePath = null): FactoryMediaLocal + public function mediaLocal(string $path, ?string $basePath = null): FactoryMediaLocal { if (! $basePath) { $this->mediaLocal->basePath = database_path('seeders/media'); @@ -139,14 +139,14 @@ public function json(): FactoryJson // return FactoryBuilder::make($this, $builder); // } - private function setFactoryText(FactoryTextEnum $type = null): FactoryText + private function setFactoryText(?FactoryTextEnum $type = null): FactoryText { $type = $type ?? \Kiwilan\Steward\StewardConfig::factoryText(); return new FactoryText($this, $type); } - private function setFactoryRichText(FactoryTextEnum $type = null): FactoryRichText + private function setFactoryRichText(?FactoryTextEnum $type = null): FactoryRichText { $type = $type ?? \Kiwilan\Steward\StewardConfig::factoryText(); $text = $this->setFactoryText($type); @@ -159,7 +159,7 @@ private function setFactoryDate(): FactoryDateTime return new FactoryDateTime($this); } - private function setFactoryMediaLocal(string|\UnitEnum $media_path = null): FactoryMediaLocal + private function setFactoryMediaLocal(string|\UnitEnum|null $media_path = null): FactoryMediaLocal { if ($media_path && $media_path instanceof \UnitEnum) { $media_path = $media_path->name; @@ -178,7 +178,7 @@ private function setFactoryJson(): FactoryJson return new FactoryJson($this); } - public static function mediaFromResponse(?HttpPoolResponse $response, string $basePath = null): ?string + public static function mediaFromResponse(?HttpPoolResponse $response, ?string $basePath = null): ?string { if (! $response || ! $response->isSuccess()) { return null; @@ -195,7 +195,7 @@ public static function mediaFromResponse(?HttpPoolResponse $response, string $ba return FactoryService::saveFile($data, $ext, $basePath); } - public static function mediaFromFile(string $path, string $basePath = null): ?string + public static function mediaFromFile(string $path, ?string $basePath = null): ?string { $data = File::get($path); $ext = pathinfo($path)['extension']; @@ -203,7 +203,7 @@ public static function mediaFromFile(string $path, string $basePath = null): ?st return FactoryService::saveFile($data, $ext, $basePath); } - private static function saveFile(string $data, string $ext = 'jpg', string $basePath = null): string + private static function saveFile(string $data, string $ext = 'jpg', ?string $basePath = null): string { $random = uniqid(); diff --git a/src/Services/FileUploadService.php b/src/Services/FileUploadService.php index bb30ace6..61ce88e9 100644 --- a/src/Services/FileUploadService.php +++ b/src/Services/FileUploadService.php @@ -12,7 +12,7 @@ protected function __construct( ) { } - public static function make(string $saveDirectory = null, string $baseUrl = null): self + public static function make(?string $saveDirectory = null, ?string $baseUrl = null): self { $self = new self(); @@ -36,7 +36,7 @@ public static function make(string $saveDirectory = null, string $baseUrl = null * * @return FileServiceItem[]|FileServiceItem|null */ - public function uploadAll(array|string $paths, string $prefix = null): array|FileServiceItem|null + public function uploadAll(array|string $paths, ?string $prefix = null): array|FileServiceItem|null { /** @var FileServiceItem[] $items */ $items = []; @@ -52,7 +52,7 @@ public function uploadAll(array|string $paths, string $prefix = null): array|Fil return $items; } - public function upload(string $p, string $prefix = null): FileServiceItem + public function upload(string $p, ?string $prefix = null): FileServiceItem { $self = new FileServiceItem($p); $path = str_replace(['(', ')'], '', $p); diff --git a/src/Services/IframelyService.php b/src/Services/IframelyService.php index 872f6700..29c422e6 100644 --- a/src/Services/IframelyService.php +++ b/src/Services/IframelyService.php @@ -22,7 +22,7 @@ protected function __construct( /** * @param string $api Iframely instance to use, can be set from `steward.iframely.api` */ - public static function make(string $api = null): self + public static function make(?string $api = null): self { if (! $api) { $api = \Kiwilan\Steward\StewardConfig::iframelyApi(); diff --git a/src/Services/Markdown/MarkdownFrontmatter.php b/src/Services/Markdown/MarkdownFrontmatter.php index 2d1a2072..a4a9dcb0 100644 --- a/src/Services/Markdown/MarkdownFrontmatter.php +++ b/src/Services/Markdown/MarkdownFrontmatter.php @@ -15,7 +15,7 @@ protected function __construct( /** * @param array | null $frontMatter */ - public static function make(array $frontMatter = null): self + public static function make(?array $frontMatter = null): self { if (! $frontMatter) { $frontMatter = []; diff --git a/src/Services/MediaService.php b/src/Services/MediaService.php index e0cf8300..b5a50a8d 100644 --- a/src/Services/MediaService.php +++ b/src/Services/MediaService.php @@ -38,9 +38,9 @@ public static function make( Model $model, string $name, mixed $disk = 'media', - string $collection = null, - string $extension = null, - SpatieMediaMethodEnum $method = null + ?string $collection = null, + ?string $extension = null, + ?SpatieMediaMethodEnum $method = null ): self { if ($disk instanceof BackedEnum) { $disk = $disk->value; diff --git a/src/Services/Notify/Notifying.php b/src/Services/Notify/Notifying.php index 7681093c..0aba71b3 100644 --- a/src/Services/Notify/Notifying.php +++ b/src/Services/Notify/Notifying.php @@ -155,7 +155,7 @@ protected function guzzle(array $config): self // return $servers; // } - protected function handleSendTo(string $sendto = null): array + protected function handleSendTo(?string $sendto = null): array { if (! $sendto) { return []; diff --git a/src/Services/NotifyService.php b/src/Services/NotifyService.php index 027bd8a6..62211bd0 100644 --- a/src/Services/NotifyService.php +++ b/src/Services/NotifyService.php @@ -36,7 +36,7 @@ public function to(array $options): self /** * @param NotifyApplication|string $application default `NotifyApplication::discord`, can be string of application like `discord` */ - public function application(NotifyApplication|string $application = null): self + public function application(NotifyApplication|string|null $application = null): self { if (! $application) { $application = StewardConfig::notifyDefault(); diff --git a/src/Services/ProcessService.php b/src/Services/ProcessService.php index 17b55f0c..bdf1c42e 100644 --- a/src/Services/ProcessService.php +++ b/src/Services/ProcessService.php @@ -29,7 +29,7 @@ public static function executionTime(Closure $closure, bool $console = false, bo } } - public static function memoryPeekFile(Closure $closure, string $path = null, int $limit = 200): void + public static function memoryPeekFile(Closure $closure, ?string $path = null, int $limit = 200): void { $currentMemory = ini_get('memory_limit'); $filesize = filesize($path); diff --git a/src/Services/Query/SortModule.php b/src/Services/Query/SortModule.php index cde1cf9e..c52b3614 100644 --- a/src/Services/Query/SortModule.php +++ b/src/Services/Query/SortModule.php @@ -16,7 +16,7 @@ public function __construct( ) { } - public static function make(string $field, string $label = null): SortModule + public static function make(string $field, ?string $label = null): SortModule { $label ??= $field; diff --git a/src/Services/ScoutService.php b/src/Services/ScoutService.php index 3ae20e65..24807dd5 100644 --- a/src/Services/ScoutService.php +++ b/src/Services/ScoutService.php @@ -18,7 +18,7 @@ protected function __construct( ) { } - public static function make(string $path = null): self + public static function make(?string $path = null): self { if (is_null($path)) { $path = app_path('Models'); diff --git a/src/Services/SlugService.php b/src/Services/SlugService.php index 1cd4e1ad..4ef6a687 100644 --- a/src/Services/SlugService.php +++ b/src/Services/SlugService.php @@ -17,7 +17,7 @@ protected function __construct( ) { } - public static function make(string $origin = null): string + public static function make(?string $origin = null): string { $service = new self(); @@ -80,7 +80,7 @@ private function setName(): string return $modelName; } - private function unique(string $name = null, int $counter = 0): string + private function unique(?string $name = null, int $counter = 0): string { if ($name === null) { $name = uniqid(); diff --git a/src/Services/Social/Modules/SocialTwitter.php b/src/Services/Social/Modules/SocialTwitter.php index 3e456995..98c10c05 100644 --- a/src/Services/Social/Modules/SocialTwitter.php +++ b/src/Services/Social/Modules/SocialTwitter.php @@ -35,7 +35,7 @@ public function regex() $this->is_valid = $this->social->getIsValid(); } - private function html(string $html = null) + private function html(?string $html = null) { return << diff --git a/src/Services/Wikipedia/WikipediaItem.php b/src/Services/Wikipedia/WikipediaItem.php index 7b7aa9a9..7476b602 100644 --- a/src/Services/Wikipedia/WikipediaItem.php +++ b/src/Services/Wikipedia/WikipediaItem.php @@ -28,7 +28,7 @@ protected function __construct( ) { } - public static function make(HttpPoolResponse $response, array $precisionQuery = null): ?self + public static function make(HttpPoolResponse $response, ?array $precisionQuery = null): ?self { if (! $response->isSuccess()) { return null; diff --git a/src/Traits/HasAttachment.php b/src/Traits/HasAttachment.php index f07a5449..ba322e38 100644 --- a/src/Traits/HasAttachment.php +++ b/src/Traits/HasAttachment.php @@ -15,7 +15,7 @@ trait HasAttachment * * @param string[] $fields */ - public function saveAttachments(array $fields, Model $model, Request $request, string $field_name = null, MediaTypeEnum $type = MediaTypeEnum::media) + public function saveAttachments(array $fields, Model $model, Request $request, ?string $field_name = null, MediaTypeEnum $type = MediaTypeEnum::media) { $filesystem_disk = storage_path('app/public/'.$type->name); $directory_path = '/'.$type->name.'/'; diff --git a/src/Traits/HasSeo.php b/src/Traits/HasSeo.php index 9ccf5fa4..750d822d 100644 --- a/src/Traits/HasSeo.php +++ b/src/Traits/HasSeo.php @@ -89,7 +89,7 @@ public function getSeoAttribute(): array ]; } - private function seoFormat(string $string = null, int $limit = 250): ?string + private function seoFormat(?string $string = null, int $limit = 250): ?string { if ($string) { $string = strip_tags($string); diff --git a/src/Traits/Mediable.php b/src/Traits/Mediable.php index acd469ea..fbe9faab 100644 --- a/src/Traits/Mediable.php +++ b/src/Traits/Mediable.php @@ -64,7 +64,7 @@ public function mediable(string $field = 'picture', bool $usePath = false): stri public function mediableSave( string $media, string $field = 'picture', - string $upload = null, + ?string $upload = null, bool $convert = true, bool $deleteOriginal = true ): void {