Skip to content

Commit de97fc5

Browse files
Merge branch '5.1' into 5.x
* 5.1: Remove "version" from composer.json files, use "branch-version" instead [String] fix "is too large" ValueError on PHP 8
2 parents f6b50e4 + 615bde9 commit de97fc5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

UnicodeString.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function slice(int $start = 0, int $length = null): AbstractString
268268
{
269269
$str = clone $this;
270270
try {
271-
$str->string = (string) grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX);
271+
$str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
272272
} catch (\ValueError $e) {
273273
$str->string = '';
274274
}
@@ -280,8 +280,8 @@ public function splice(string $replacement, int $start = 0, int $length = null):
280280
{
281281
$str = clone $this;
282282
$start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
283-
$length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX)) : $length;
284-
$str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
283+
$length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
284+
$str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
285285
normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
286286

287287
if (false === $str->string) {
@@ -293,7 +293,7 @@ public function splice(string $replacement, int $start = 0, int $length = null):
293293

294294
public function split(string $delimiter, int $limit = null, int $flags = null): array
295295
{
296-
if (1 > $limit = $limit ?? \PHP_INT_MAX) {
296+
if (1 > $limit = $limit ?? 2147483647) {
297297
throw new InvalidArgumentException('Split limit must be a positive integer.');
298298
}
299299

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@
3737
]
3838
},
3939
"minimum-stability": "dev",
40-
"version": "5.2.x-dev"
40+
"extra": {
41+
"branch-version": "5.2-dev"
42+
}
4143
}

0 commit comments

Comments
 (0)