Skip to content

Commit

Permalink
phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Apr 29, 2024
1 parent 60cc514 commit fac8a4b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ public function translate(string $country, string $name, ?string $locale = null)

protected function toHyphenSeparated(string $text): string
{
return strtolower(
preg_replace('/(?<=\\w)(?=[A-Z])/', '-$1', $text)
);
$toHyphens = preg_replace('/(?<=\\w)(?=[A-Z])/', '-$1', $text);

if ($toHyphens === null) {
return strtolower($text);
}

return strtolower($toHyphens);
}
}

0 comments on commit fac8a4b

Please sign in to comment.