Skip to content

Commit

Permalink
chore: Mark all "not allowed" methods as deprecated
Browse files Browse the repository at this point in the history
chore: Mark all "not allowed" methods as deprecated
  • Loading branch information
lukas-frey authored Jun 27, 2024
2 parents 63015bf + 068cde5 commit 9107853
Showing 1 changed file with 63 additions and 11 deletions.
74 changes: 63 additions & 11 deletions src/Forms/IconPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,59 +163,111 @@ public function getSearchResults(string $search): array
return $results;
}

/**
* Marks the calling method as not allowed (whether because it's not supported or because it's meaningless when using this field)
* @throws \BadMethodCallException Always
*/
protected function markAsNotAllowed(string $reason = 'Method not allowed.'): void {
throw new \BadMethodCallException($reason);
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function relationship(string|Closure|null $name = null, string|Closure|null $titleAttribute = null, ?Closure $modifyQueryUsing = null, bool $ignoreRecord = false): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function options(Arrayable|Closure|array|string|null $options): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function allowHtml(bool|Closure $condition = true): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function searchable(bool|array|Closure $condition = true): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function getSearchResultsUsing(?Closure $callback): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function getOptionLabelFromRecordUsing(?Closure $callback): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function createOptionUsing(?Closure $callback): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function createOptionAction(?Closure $callback): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function createOptionForm(array|Closure|null $schema): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function schema(array|Closure $components): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

/**
* @deprecated Method inherited from `\Filament\Forms\Components\Select` but not supported (or meaningless) when using this field
* @throws \BadMethodCallException
*/
public function multiple(bool|Closure $condition = true): static
{
throw new \BadMethodCallException('Method not allowed.');
$this->markAsNotAllowed();
}

private function loadIcons(): Collection
Expand Down

0 comments on commit 9107853

Please sign in to comment.