Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
Add return types
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Jan 22, 2018
1 parent 3cf038d commit d209f31
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait Translatable
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function translate(string $locale = null, bool $fallback = true)
public function translate(string $locale = null, bool $fallback = true): ?Model
{
$locale = $locale ?: $this->getLocale();

Expand Down Expand Up @@ -103,14 +103,14 @@ protected function translateOrNew(string $locale): Model
*
* @return \Illuminate\Database\Eloquent\Model|null
*/
protected function getTranslation(string $locale)
protected function getTranslation(string $locale): ?Model
{
if (isset($this->translationCache[$locale])) {
return $this->translationCache[$locale];
}

if (!$this->exists) {
return;
return null;
}

$translation = $this->translations
Expand Down Expand Up @@ -232,7 +232,7 @@ public function isDirty($attributes = null): bool
*
* @return void
*/
protected function finishSave(array $options)
protected function finishSave(array $options): void
{
$this->translations()->saveMany($this->translationCache);

Expand All @@ -244,7 +244,7 @@ protected function finishSave(array $options)
*
* @return bool|null
*/
public function delete()
public function delete(): ?bool
{
if ($deleted = parent::delete()) {
$this->translations()->delete();
Expand All @@ -260,7 +260,7 @@ public function delete()
*
* @return void
*/
protected function setLocale(string $locale)
protected function setLocale(string $locale): void
{
Config::set('app.locale', $locale);
}
Expand Down

0 comments on commit d209f31

Please sign in to comment.