Skip to content

Commit

Permalink
Merge pull request #46 from Jared0430/patch-1
Browse files Browse the repository at this point in the history
Skip interfaces/traits/enums in model:typer - fixes #45
  • Loading branch information
acidjazz authored Apr 18, 2023
2 parents 1a4795b + 6e5cba7 commit 7656520
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Commands/ShowModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ protected function qualifyModel(string $model)
{
$class = parent::qualifyModel($model);
$reflection = new ReflectionClass($class);

if ($reflection->isInterface() || $reflection->isTrait() || $reflection->isEnum()) {
$msg = "Skipping '$model' as it is an interface/trait/enum.";
$this->components->error($msg, OutputStyle::OUTPUT_NORMAL, AbstractModelException::class); // @phpstan-ignore-line
}

if ($reflection->isAbstract() && ! $this->option('resolve-abstract')) {
$msg = "Trying to resolve an abstract model '$model' when 'resolve-abstract' option is not enabled.";
Expand Down

0 comments on commit 7656520

Please sign in to comment.