alexeymezenin / laravel-best-practices

Laravel best practices
11.38k stars 2.38k forks source link

Wrong return type? #124

Closed mpspm closed 2 years ago

mpspm commented 2 years ago

Under the single responsibility principle "good" example, should the return type for getFullNameAttribute() be "string" and not "bool"?

public function getFullNameAttribute(): bool
{
    return $this->isVerifiedClient() ? $this->getFullNameLong() : $this->getFullNameShort();
}
thomas-tosch commented 2 years ago

I suspect this is a mistake since calling this function would cause an error. The two ternary options both return string type values.