Begin work to make codebase more type-safe

This commit is contained in:
Dan Harrin
2021-12-23 10:44:23 +00:00
parent cceefacc5a
commit 7fbaf8537b
41 changed files with 3117 additions and 261 deletions
+6 -1
View File
@@ -6,15 +6,20 @@
"php": "^8.0"
},
"require-dev": {
"akaunting/laravel-money": "^1.2",
"blade-ui-kit/blade-heroicons": "^1.2",
"danharrin/livewire-rate-limiting": "^0.3.0",
"doctrine/dbal": "^3.2",
"laravel/ui": "^3.3",
"league/flysystem-aws-s3-v3": "^1.0",
"nunomaduro/larastan": "^1.0",
"orchestra/testbench": "^6.0",
"pestphp/pest": "^1.17",
"pestphp/pest-plugin-livewire": "^1.0",
"pestphp/pest-plugin-parallel": "^0.3",
"phpstan/phpstan": "^0.12",
"spatie/laravel-medialibrary": "^9.11",
"spatie/laravel-package-tools": "^1.9",
"spatie/laravel-tags": "^4.2",
"symplify/monorepo-builder": "^9.0"
},
"autoload-dev": {
Generated
+2921 -143
View File
File diff suppressed because it is too large Load Diff
@@ -2,12 +2,13 @@
namespace Filament\AvatarProviders;
use Filament\Facades\Filament;
use Illuminate\Contracts\Auth\Authenticatable;
class UiAvatarsProvider implements Contracts\AvatarProvider
{
public function get(Authenticatable $user): string
{
return 'https://ui-avatars.com/api/?name=' . urlencode($user->name) . '&color=FFFFFF&background=111827';
return 'https://ui-avatars.com/api/?name=' . urlencode(Filament::getUserName($user)) . '&color=FFFFFF&background=111827';
}
}
@@ -18,6 +18,10 @@ class NavigationItem
protected ?string $url = null;
final public function __construct()
{
}
public static function make(): static
{
return new static();
+1
View File
@@ -9,6 +9,7 @@ use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Livewire\Component;
use Livewire\Macros\ViewMacros;
class Page extends Component
{
+4
View File
@@ -12,6 +12,10 @@ class Form
protected array | Component | Closure $schema = [];
final public function __construct()
{
}
public static function make(): static
{
return new static();
+4
View File
@@ -18,6 +18,10 @@ class Table
protected array $headerActions = [];
final public function __construct()
{
}
public static function make(): static
{
return new static();
@@ -2,6 +2,7 @@
namespace Filament\Forms\Commands\Concerns;
use Closure;
use Illuminate\Support\Facades\Validator;
trait CanValidateInput
@@ -11,7 +12,7 @@ trait CanValidateInput
return $this->validateInput(fn () => $this->ask($question), $field, ['required']);
}
protected function validateInput(callable $callback, string $field, array $rules): string
protected function validateInput(Closure $callback, string $field, array $rules): string
{
$input = $callback();
@@ -7,11 +7,11 @@ use Illuminate\Database\Eloquent\Model;
trait BelongsToModel
{
protected $model = null;
protected Model | string | Closure | null $model = null;
protected ?Closure $saveRelationshipsUsing = null;
public function model(Model | string | callable | null $model = null): static
public function model(Model | string | Closure | null $model = null): static
{
$this->model = $model;
@@ -2,9 +2,11 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeAccepted
{
public function accepted(bool | callable $condition = true): static
public function accepted(bool | Closure $condition = true): static
{
$this->rule('accepted', $condition);
@@ -2,18 +2,20 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeAutocapitalized
{
protected $autocapitalize = null;
protected string | Closure | null $autocapitalize = null;
public function autocapitalize(string | callable $autocapitalize = 'on'): static
public function autocapitalize(string | Closure | null $autocapitalize = 'on'): static
{
$this->autocapitalize = $autocapitalize;
return $this;
}
public function disableAutocapitalize(bool | callable $condition = true): static
public function disableAutocapitalize(bool | Closure $condition = true): static
{
$this->autocapitalize(function () use ($condition): ?string {
return $this->evaluate($condition) ? 'off' : null;
@@ -2,18 +2,20 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeAutocompleted
{
protected $autocomplete = null;
protected string | Closure | null $autocomplete = null;
public function autocomplete(string | callable $autocomplete = 'on'): static
public function autocomplete(string | Closure | null $autocomplete = 'on'): static
{
$this->autocomplete = $autocomplete;
return $this;
}
public function disableAutocomplete(bool | callable $condition = true): static
public function disableAutocomplete(bool | Closure $condition = true): static
{
$this->autocomplete(function () use ($condition): ?string {
return $this->evaluate($condition) ? 'off' : null;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeAutofocused
{
protected $isAutofocused = false;
protected bool | Closure $isAutofocused = false;
public function autofocus(bool | callable $condition = true): static
public function autofocus(bool | Closure $condition = true): static
{
$this->isAutofocused = $condition;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeDisabled
{
protected $isDisabled = false;
protected bool | Closure $isDisabled = false;
public function disabled(bool | callable $condition = true): static
public function disabled(bool | Closure $condition = true): static
{
$this->isDisabled = $condition;
@@ -2,22 +2,23 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Illuminate\Support\Arr;
trait CanBeHidden
{
protected $isHidden = false;
protected bool | Closure $isHidden = false;
protected $isVisible = true;
protected bool | Closure $isVisible = true;
public function hidden(bool | callable $condition = true): static
public function hidden(bool | Closure $condition = true): static
{
$this->isHidden = $condition;
return $this;
}
public function when(bool | callable $condition = true): static
public function when(bool | Closure $condition = true): static
{
$this->visible($condition);
@@ -28,7 +29,7 @@ trait CanBeHidden
{
$paths = Arr::wrap($paths);
$this->hidden(function (callable $get) use ($paths): bool {
$this->hidden(function (Closure $get) use ($paths): bool {
foreach ($paths as $path) {
if (! $get($path)) {
return true;
@@ -45,7 +46,7 @@ trait CanBeHidden
{
$paths = Arr::wrap($paths);
$this->hidden(function (callable $get) use ($paths): bool {
$this->hidden(function (Closure $get) use ($paths): bool {
foreach ($paths as $path) {
if (! ! $get($path)) {
return true;
@@ -58,7 +59,7 @@ trait CanBeHidden
return $this;
}
public function visible(bool | callable $condition = true): static
public function visible(bool | Closure $condition = true): static
{
$this->isVisible = $condition;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeInline
{
protected $isInline = true;
protected bool | Closure $isInline = true;
public function inline(bool | callable $condition = true): static
public function inline(bool | Closure $condition = true): static
{
$this->isInline = $condition;
@@ -2,13 +2,15 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait CanBeLengthConstrained
{
protected $maxLength = null;
protected int | Closure | null $maxLength = null;
protected $minLength = null;
protected int | Closure | null $minLength = null;
public function maxLength(int | callable $length): static
public function maxLength(int | Closure $length): static
{
$this->maxLength = $length;
@@ -21,7 +23,7 @@ trait CanBeLengthConstrained
return $this;
}
public function minLength(int | callable $length): static
public function minLength(int | Closure $length): static
{
$this->minLength = $length;
@@ -10,13 +10,13 @@ use Illuminate\Validation\Rules\Unique;
trait CanBeValidated
{
protected $isRequired = false;
protected bool | Closure $isRequired = false;
protected array $rules = [];
protected $validationAttribute = null;
protected string | Closure | null $validationAttribute = null;
public function exists(string | callable | null $table = null, string | callable | null $column = null, ?Closure $callback = null): static
public function exists(string | Closure | null $table = null, string | Closure | null $column = null, ?Closure $callback = null): static
{
$this->rule(function (Component $component) use ($callback, $column, $table) {
$table = $component->evaluate($table) ?? $component->getModelClass();
@@ -36,7 +36,7 @@ trait CanBeValidated
return $this;
}
public function nullable(bool | callable $condition = true): static
public function nullable(bool | Closure $condition = true): static
{
$this->required(function (Component $component) use ($condition): bool {
return ! $component->evaluate($condition);
@@ -45,14 +45,14 @@ trait CanBeValidated
return $this;
}
public function required(bool | callable $condition = true): static
public function required(bool | Closure $condition = true): static
{
$this->isRequired = $condition;
return $this;
}
public function rule(string | object | callable $rule, bool | callable $condition = true): static
public function rule(string | object $rule, bool | Closure $condition = true): static
{
$this->rules = array_merge(
$this->rules,
@@ -62,67 +62,67 @@ trait CanBeValidated
return $this;
}
public function rules(array $rules, bool | callable $condition = true): static
public function rules(array $rules, bool | Closure $condition = true): static
{
$this->rules = array_merge(
$this->rules,
array_map(fn (string | object | callable $rule) => [$rule, $condition], $rules),
array_map(fn (string | object $rule) => [$rule, $condition], $rules),
);
return $this;
}
public function after(string | callable $date, bool $isStatePathAbsolute = false): static
public function after(string | Closure $date, bool $isStatePathAbsolute = false): static
{
return $this->dateComparisonRule('after', $date, $isStatePathAbsolute);
}
public function afterOrEqual(string | callable $date, bool $isStatePathAbsolute = false): static
public function afterOrEqual(string | Closure $date, bool $isStatePathAbsolute = false): static
{
return $this->dateComparisonRule('after_or_equal', $date, $isStatePathAbsolute);
}
public function before(string | callable $date, bool $isStatePathAbsolute = false): static
public function before(string | Closure $date, bool $isStatePathAbsolute = false): static
{
return $this->dateComparisonRule('before', $date, $isStatePathAbsolute);
}
public function beforeOrEqual(string | callable $date, bool $isStatePathAbsolute = false): static
public function beforeOrEqual(string | Closure $date, bool $isStatePathAbsolute = false): static
{
return $this->dateComparisonRule('before_or_equal', $date, $isStatePathAbsolute);
}
public function different(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function different(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('different', $statePath, $isStatePathAbsolute);
}
public function gt(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function gt(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('gt', $statePath, $isStatePathAbsolute);
}
public function gte(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function gte(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('gte', $statePath, $isStatePathAbsolute);
}
public function lt(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function lt(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('lt', $statePath, $isStatePathAbsolute);
}
public function lte(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function lte(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('lte', $statePath, $isStatePathAbsolute);
}
public function same(string | callable $statePath, bool $isStatePathAbsolute = false): static
public function same(string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
return $this->fieldComparisonRule('same', $statePath, $isStatePathAbsolute);
}
public function unique(string | callable | null $table = null, string | callable | null $column = null, Model | callable $ignorable = null, ?Closure $callback = null): static
public function unique(string | Closure | null $table = null, string | Closure | null $column = null, Model | Closure $ignorable = null, ?Closure $callback = null): static
{
$this->rule(function (Component $component) use ($callback, $column, $ignorable, $table) {
$table = $component->evaluate($table) ?? $component->getModelClass();
@@ -150,7 +150,7 @@ trait CanBeValidated
return $this;
}
public function validationAttribute(string | callable $label): static
public function validationAttribute(string | Closure | null $label): static
{
$this->validationAttribute = $label;
@@ -189,7 +189,7 @@ trait CanBeValidated
return (bool) $this->evaluate($this->isRequired);
}
protected function dateComparisonRule(string $rule, string | callable $date, bool $isStatePathAbsolute = false): static
protected function dateComparisonRule(string $rule, string | Closure $date, bool $isStatePathAbsolute = false): static
{
$this->rule(function (Component $component) use ($date, $isStatePathAbsolute, $rule): string {
$date = $component->evaluate($date);
@@ -208,7 +208,7 @@ trait CanBeValidated
return $this;
}
protected function fieldComparisonRule(string $rule, string | callable $statePath, bool $isStatePathAbsolute = false): static
protected function fieldComparisonRule(string $rule, string | Closure $statePath, bool $isStatePathAbsolute = false): static
{
$this->rule(function (Component $component) use ($isStatePathAbsolute, $rule, $statePath): string {
$statePath = $component->evaluate($statePath);
@@ -2,15 +2,16 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Filament\Forms\Components\Component;
trait CanLimitItemsLength
{
protected $maxItems = null;
protected int | Closure | null $maxItems = null;
protected $minItems = null;
protected int | Closure | null $minItems = null;
public function maxItems(int | callable $count): static
public function maxItems(int | Closure $count): static
{
$this->maxItems = $count;
@@ -24,7 +25,7 @@ trait CanLimitItemsLength
return $this;
}
public function minItems(int | callable $count): static
public function minItems(int | Closure $count): static
{
$this->minItems = $count;
@@ -2,13 +2,14 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Illuminate\View\ComponentAttributeBag;
trait HasExtraAlpineAttributes
{
protected $extraAlpineAttributes = [];
protected array | Closure $extraAlpineAttributes = [];
public function extraAlpineAttributes(array | callable $attributes): static
public function extraAlpineAttributes(array | Closure $attributes): static
{
$this->extraAlpineAttributes = $attributes;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasExtraAttributes
{
protected $extraAttributes = [];
protected array | Closure $extraAttributes = [];
public function extraAttributes(array | callable $attributes): static
public function extraAttributes(array | Closure $attributes): static
{
$this->extraAttributes = $attributes;
@@ -2,6 +2,7 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
@@ -9,24 +10,24 @@ use SplFileInfo;
trait HasFileAttachments
{
protected $fileAttachmentsDirectory = null;
protected string | Closure | null $fileAttachmentsDirectory = null;
protected $fileAttachmentsDiskName = null;
protected string | Closure | null $fileAttachmentsDiskName = null;
protected $getUploadedAttachmentUrlUsing = null;
protected ?Closure $getUploadedAttachmentUrlUsing = null;
protected $saveUploadedFileAttachmentsUsing = null;
protected ?Closure $saveUploadedFileAttachmentsUsing = null;
protected $fileAttachmentsVisibility = 'public';
protected string | Closure $fileAttachmentsVisibility = 'public';
public function fileAttachmentsDirectory(string | callable $directory): static
public function fileAttachmentsDirectory(string | Closure | null $directory): static
{
$this->fileAttachmentsDirectory = $directory;
return $this;
}
public function fileAttachmentsDisk($name): static
public function fileAttachmentsDisk(string | Closure | null $name): static
{
$this->fileAttachmentsDiskName = $name;
@@ -52,13 +53,27 @@ trait HasFileAttachments
return $this->handleUploadedAttachmentUrlRetrieval($file);
}
public function fileAttachmentsVisibility(string | callable $visibility): static
public function fileAttachmentsVisibility(string | Closure $visibility): static
{
$this->fileAttachmentsVisibility = $visibility;
return $this;
}
public function getUploadedAttachmentUrlUsing(Closure | null $callback): static
{
$this->getUploadedAttachmentUrlUsing = $callback;
return $this;
}
public function saveUploadedFileAttachmentsUsing(Closure | null $callback): static
{
$this->saveUploadedFileAttachmentsUsing = $callback;
return $this;
}
public function getFileAttachmentsDirectory(): ?string
{
return $this->evaluate($this->fileAttachmentsDirectory);
@@ -79,13 +94,6 @@ trait HasFileAttachments
return $this->evaluate($this->fileAttachmentsVisibility);
}
public function getUploadedAttachmentUrlUsing(callable $callback): static
{
$this->getUploadedAttachmentUrlUsing = $callback;
return $this;
}
protected function handleFileAttachmentUpload($file)
{
$storeMethod = $this->getFileAttachmentsVisibility() === 'public' ? 'storePublicly' : 'store';
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasHelperText
{
protected $helperText = null;
protected string | Closure | null $helperText = null;
public function helperText(string | callable $text): static
public function helperText(string | Closure | null $text): static
{
$this->helperText = $text;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasHint
{
protected $hint = null;
protected string | Closure | null $hint = null;
public function hint(string | callable $hint): static
public function hint(string | Closure | null $hint): static
{
$this->hint = $hint;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasId
{
protected $id = null;
protected string | Closure | null $id = null;
public function id(string | callable $id): static
public function id(string | Closure | null $id): static
{
$this->id = $id;
@@ -2,20 +2,22 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasLabel
{
protected $isLabelHidden = false;
protected bool | Closure $isLabelHidden = false;
protected $label = null;
protected string | Closure | null $label = null;
public function disableLabel(bool | callable $condition = true): static
public function disableLabel(bool | Closure $condition = true): static
{
$this->isLabelHidden = $condition;
return $this;
}
public function label(string | callable $label): static
public function label(string | Closure | null $label): static
{
$this->label = $label;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasMaxWidth
{
protected $maxWidth = null;
protected string | Closure | null $maxWidth = null;
public function maxWidth(string | callable $width): static
public function maxWidth(string | Closure | null $width): static
{
$this->maxWidth = $width;
@@ -2,11 +2,13 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait HasPlaceholder
{
protected $placeholder = null;
protected string | Closure | null $placeholder = null;
public function placeholder(string | callable $placeholder): static
public function placeholder(string | Closure | null $placeholder): static
{
$this->placeholder = $placeholder;
@@ -2,41 +2,42 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Filament\Forms\Components\Component;
trait HasState
{
protected $afterStateHydrated = null;
protected ?Closure $afterStateHydrated = null;
protected $afterStateUpdated = null;
protected ?Closure $afterStateUpdated = null;
protected $beforeStateDehydrated = null;
protected ?Closure $beforeStateDehydrated = null;
protected $defaultState = null;
protected $dehydrateStateUsing = null;
protected ?Closure $dehydrateStateUsing = null;
protected bool $hasDefaultState = false;
protected $isDehydrated = true;
protected bool | Closure $isDehydrated = true;
protected ?string $statePath = null;
public function afterStateHydrated(?callable $callback): static
public function afterStateHydrated(?Closure $callback): static
{
$this->afterStateHydrated = $callback;
return $this;
}
public function afterStateUpdated(?callable $callback): static
public function afterStateUpdated(?Closure $callback): static
{
$this->afterStateUpdated = $callback;
return $this;
}
public function beforeStateDehydrated(?callable $callback): static
public function beforeStateDehydrated(?Closure $callback): static
{
$this->beforeStateDehydrated = $callback;
@@ -78,7 +79,7 @@ trait HasState
return $this;
}
public function dehydrated(bool | callable $condition = true): static
public function dehydrated(bool | Closure $condition = true): static
{
$this->isDehydrated = $condition;
@@ -94,7 +95,7 @@ trait HasState
return $this->getState();
}
public function dehydrateStateUsing(?callable $callback): static
public function dehydrateStateUsing(?Closure $callback): static
{
$this->dehydrateStateUsing = $callback;
@@ -170,7 +171,7 @@ trait HasState
return (bool) $this->evaluate($this->isDehydrated);
}
protected function getGetCallback(): callable
protected function getGetCallback(): Closure
{
return function (Component | string $path, bool $isAbsolute = false) {
if ($path instanceof Component) {
@@ -188,7 +189,7 @@ trait HasState
};
}
protected function getSetCallback(): callable
protected function getSetCallback(): Closure
{
return function (string | Component $path, $state, bool $isAbsolute = false) {
if ($path instanceof Component) {
@@ -2,6 +2,8 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
trait InteractsWithToolbarButtons
{
public function disableAllToolbarButtons(bool $condition = true): static
@@ -29,7 +31,7 @@ trait InteractsWithToolbarButtons
return $this;
}
public function toolbarButtons(array | callable $buttons = []): static
public function toolbarButtons(array | Closure $buttons = []): static
{
$this->toolbarButtons = $buttons;
@@ -2,6 +2,8 @@
namespace Filament\Forms\Components;
use Closure;
class MarkdownEditor extends Field implements Contracts\HasFileAttachments
{
use Concerns\HasExtraAlpineAttributes;
@@ -11,7 +13,7 @@ class MarkdownEditor extends Field implements Contracts\HasFileAttachments
protected string $view = 'forms::components.markdown-editor';
protected $toolbarButtons = [
protected array | Closure $toolbarButtons = [
'attachFiles',
'bold',
'bulletList',
@@ -78,11 +78,15 @@ class MultipleFileUpload extends Field
public function minFiles(int | callable $count): static
{
$this->minItems($count);
return $this;
}
public function maxFiles(int | callable $count): static
{
$this->maxItems($count);
return $this;
}
public function uploadComponent(Component | callable $component): static
+3 -1
View File
@@ -2,6 +2,8 @@
namespace Filament\Forms\Components;
use Closure;
class RichEditor extends Field implements Contracts\HasFileAttachments
{
use Concerns\HasExtraAlpineAttributes;
@@ -11,7 +13,7 @@ class RichEditor extends Field implements Contracts\HasFileAttachments
protected string $view = 'forms::components.rich-editor';
protected $toolbarButtons = [
protected array | Closure $toolbarButtons = [
'attachFiles',
'blockquote',
'bold',
@@ -2,6 +2,7 @@
namespace Filament\Forms\Components\TextInput;
use Closure;
use Illuminate\Contracts\Support\Jsonable;
class Mask implements Jsonable
@@ -259,7 +260,7 @@ class Mask implements Jsonable
if ($this->patternBlocks !== []) {
$configuration['blocks'] = array_map(
fn (callable $configuration): array => $configuration(new static())->getArrayableConfiguration(),
fn (Closure $configuration): array => $configuration(new static())->getArrayableConfiguration(),
$this->patternBlocks,
);
}
@@ -24,7 +24,7 @@ trait HasComponents
return $this;
}
public function getComponent(string | callable $callback, bool $withHidden = false): ?Component
public function getComponent(string | Closure $callback, bool $withHidden = false): ?Component
{
$callback = $callback instanceof Closure
? $callback
@@ -2,6 +2,7 @@
namespace Filament\Forms\Components;
use Closure;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
@@ -9,7 +10,7 @@ use SplFileInfo;
class SpatieMediaLibraryFileUpload extends FileUpload
{
protected $collection = null;
protected string | Closure | null $collection = null;
protected function setUp(): void
{
@@ -28,7 +29,7 @@ class SpatieMediaLibraryFileUpload extends FileUpload
$this->dehydrated(false);
}
public function collection(string | callable $collection): static
public function collection(string | Closure | null $collection): static
{
$this->collection = $collection;
@@ -2,11 +2,12 @@
namespace Filament\Forms\Components;
use Closure;
use Spatie\MediaLibrary\HasMedia;
class SpatieMediaLibraryMultipleFileUpload extends MultipleFileUpload
{
protected $collection = null;
protected string | Closure | null $collection = null;
protected function setUp(): void
{
@@ -42,7 +43,7 @@ class SpatieMediaLibraryMultipleFileUpload extends MultipleFileUpload
return $files;
}
public function collection(string | callable $collection): static
public function collection(string | Closure | null $collection): static
{
$this->collection = $collection;
@@ -2,13 +2,14 @@
namespace Filament\Forms\Components;
use Closure;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Spatie\Tags\Tag;
class SpatieTagsInput extends TagsInput
{
protected $type = null;
protected string | Closure | null $type = null;
protected function setUp(): void
{
@@ -50,7 +51,7 @@ class SpatieTagsInput extends TagsInput
$model->syncTags($tags);
}
public function type(string | callable $type): static
public function type(string | Closure | null $type): static
{
$this->type = $type;
@@ -14,7 +14,7 @@ class SpatieTagsColumn extends TagsColumn
return $tags->pluck('name')->toArray();
}
public function type(string | callable $type): static
public function type(?string $type): static
{
$this->type = $type;
-6
View File
@@ -1,6 +0,0 @@
parameters:
paths:
- packages/forms/src
- packages/spatie-laravel-media-library-plugin/src
- packages/spatie-laravel-tags-plugin/src
level: 5
+10
View File
@@ -0,0 +1,10 @@
parameters:
paths:
- packages/admin/src
- packages/forms/src
- packages/spatie-laravel-media-library-plugin/src
- packages/spatie-laravel-settings-plugin/src
- packages/spatie-laravel-tags-plugin/src
- packages/spatie-laravel-translatable-plugin/src
- packages/tables/src
level: 0