Skip to content

Commit 5ee2d7b

Browse files
authored
Merge pull request #6 from Carnicero90/main
fix: prevent writing docblock on enums that don't implement the LaravelEnumHelperTrait
2 parents 4a2acb0 + 193b5b5 commit 5ee2d7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Commands/EnumAnnotateCommand.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ protected function annotateClass(string $className): int
8484
}
8585

8686
$reflection = new ReflectionEnum($className);
87-
$this->annotate($reflection);
87+
88+
if ($reflection->isSubclassOf(UnitEnum::class)) {
89+
if (class_uses_recursive($class)['Datomatic\LaravelEnumHelper\LaravelEnumHelper'] ?? false) {
90+
$this->annotate($reflection);
91+
}
92+
}
8893

8994
return self::SUCCESS;
9095
}

0 commit comments

Comments
 (0)