Skip to content

Commit

Permalink
labels method should be static
Browse files Browse the repository at this point in the history
  • Loading branch information
henzeb committed Jun 5, 2022
1 parent e3812e6 commit a0ae4ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum YourEnum {
case ENUM;
case NO_LABEL;

public function labels(): array
public static function labels(): array
{
return [
'ENUM' => 'Your label';
Expand Down
4 changes: 2 additions & 2 deletions src/Concerns/Labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

trait Labels
{
public function labels(): array
public static function labels(): array
{
return [];
}

final public function label(): ?string
{
return $this->labels()[$this->name]
return self::labels()[$this->name]
?? (method_exists($this, 'value') ? $this->value() : null)
?? $this->value
?? $this->name;
Expand Down

0 comments on commit a0ae4ba

Please sign in to comment.