Skip to content

Commit

Permalink
Add return type to lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
AmonDeShir committed Aug 7, 2024
1 parent 6ebf293 commit e849bdb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/Models/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public function organization(): BelongsTo

protected function totalMinutes(): Attribute
{
return Attribute::get(fn() => $this->workflowJobs->sum("minutes"));
return Attribute::get(fn(): float => $this->workflowJobs->sum("minutes"));
}

protected function totalPrice(): Attribute
{
return Attribute::get(fn() => $this->workflowJobs->sum("price"));
return Attribute::get(fn(): float => $this->workflowJobs->sum("price"));
}
}
4 changes: 2 additions & 2 deletions app/Models/WorkflowActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function workflowJobs(): HasManyThrough

protected function totalMinutes(): Attribute
{
return Attribute::get(fn() => $this->workflowJobs->sum("minutes"));
return Attribute::get(fn(): float => $this->workflowJobs->sum("minutes"));
}

protected function totalPrice(): Attribute
{
return Attribute::get(fn() => $this->workflowJobs->sum("price"));
return Attribute::get(fn(): float => $this->workflowJobs->sum("price"));
}
}
4 changes: 2 additions & 2 deletions app/Models/WorkflowJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public function workflowRun(): BelongsTo

protected function price(): Attribute
{
return Attribute::get(fn() => $this->minutes * $this->price_per_unit);
return Attribute::get(fn(): float => $this->minutes * $this->price_per_unit);
}

protected function fullName(): Attribute
{
return Attribute::get(fn() => $this->workflowRun->name . " - " . $this->name);
return Attribute::get(fn(): string => $this->workflowRun->name . " - " . $this->name);
}
}

0 comments on commit e849bdb

Please sign in to comment.