This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -185,7 +185,7 @@ class UnicodeString extends AbstractUnicodeString
return false === $i ? null : $i;
}
public function join(array $strings, string $lastGlue = null): static
public function join(array $strings, ?string $lastGlue = null): static
{
$str = parent::join($strings, $lastGlue);
normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
@@ -272,7 +272,7 @@ class UnicodeString extends AbstractUnicodeString
return $str;
}
public function slice(int $start = 0, int $length = null): static
public function slice(int $start = 0, ?int $length = null): static
{
$str = clone $this;
@@ -281,12 +281,12 @@ class UnicodeString extends AbstractUnicodeString
return $str;
}
public function splice(string $replacement, int $start = 0, int $length = null): static
public function splice(string $replacement, int $start = 0, ?int $length = null): static
{
$str = clone $this;
$start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
$length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
$length = $length ? \strlen(grapheme_substr($this->string, $start, $length)) : $length;
$str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
if (normalizer_is_normalized($str->string)) {
@@ -302,7 +302,7 @@ class UnicodeString extends AbstractUnicodeString
return $str;
}
public function split(string $delimiter, int $limit = null, int $flags = null): array
public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
{
if (1 > $limit ??= 2147483647) {
throw new InvalidArgumentException('Split limit must be a positive integer.');