diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c91d6..bb40d90 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ + +# [3.0.2](https://github.com/atomastic/strings) (2021-04-13) +* fix snake() method + # [3.0.1](https://github.com/atomastic/strings) (2021-02-19) * fix dependencies. diff --git a/src/Strings.php b/src/Strings.php index b5a267e..7593a61 100644 --- a/src/Strings.php +++ b/src/Strings.php @@ -402,10 +402,10 @@ public function snake(string $delimiter = '_'): self if (! ctype_lower($this->string)) { $string = preg_replace('/\s+/u', '', ucwords($this->string)); $string = static::create(preg_replace('/(.)(?=[A-Z])/u', '$1' . $delimiter, $string), $this->encoding)->lower(); + + $this->string = $string->toString(); } - $this->string = $string->toString(); - return $this; }