Skip to content

Update setSpinnerColor to return $this for method chaining #97

@SimonBarrettACT

Description

@SimonBarrettACT

Suggestion

To support method chaining and maintain consistency with other methods in the trait (like loadingIndicator), update the setSpinnerColor method so that it returns $this instead of void.

Current Implementation

$this->spinnerColor = $color;
}
public function showOverlay(): bool

The method currently returns void, which breaks method chaining:

public function setSpinnerColor($color): void
{
    $this->spinnerColor = $color;
}

Proposed Change

public function setSpinnerColor($color): static
{
    $this->spinnerColor = $color;
    return $this;
}

Benefits

  • Enables fluent API pattern for method chaining
  • Maintains consistency with the loadingIndicator() method in the same trait
  • Does not break existing code (backward compatible)
  • Allows for more concise configuration:
    $builder->setSpinnerColor('text-green-500')
            ->loadingIndicator(true);

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions