Skip to content

Commit 7dcfc21

Browse files
authored
Update BaseString.php
1 parent 1db5d51 commit 7dcfc21

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/BaseString.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,10 @@ public static function createLazy(callable $initializer): StringInterface
4949
* @param string $encoding Character encoding to use
5050
* @throws InvalidArgumentException If the encoding is not supported
5151
*/
52-
public function __construct(string|Stringable $string, string $encoding = 'UTF-8')
52+
public function __construct(string|Stringable $string, ?string $encoding = null)
5353
{
5454
$this->value = (string) $string;
5555
$this->encoding = $encoding;
56-
57-
// Check if encoding is supported
58-
if (!in_array($this->encoding, mb_list_encodings(), true)) {
59-
throw new InvalidArgumentException(
60-
sprintf('Encoding "%s" is not supported', $this->encoding)
61-
);
62-
}
63-
6456
// Determine if the string is multibyte
6557
$this->isMultibyte = Stringy::isMultibyte($this->value);
6658
}

0 commit comments

Comments
 (0)