Skip to content

Commit 01b5537

Browse files
minor #41295 Remove constraint for PHP < 8 (jderusse)
This PR was squashed before being merged into the 6.0 branch. Discussion ---------- Remove constraint for PHP < 8 | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Remove code check against PHP_VERSION < 8 (except for PHPUnit Bridge) Commits ------- a8c74ae3fb Remove constraint for PHP < 8
2 parents 51e0b58 + 8732b6f commit 01b5537

File tree

3 files changed

+1
-16
lines changed

3 files changed

+1
-16
lines changed

AbstractUnicodeString.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function folded(bool $compat = true): parent
191191
{
192192
$str = clone $this;
193193

194-
if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
194+
if (!$compat || !\defined('Normalizer::NFKC_CF')) {
195195
$str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
196196
$str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8');
197197
} else {
@@ -427,10 +427,6 @@ public function upper(): parent
427427
$str = clone $this;
428428
$str->string = mb_strtoupper($str->string, 'UTF-8');
429429

430-
if (\PHP_VERSION_ID < 70300) {
431-
$str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
432-
}
433-
434430
return $str;
435431
}
436432

LazyString.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ public function __toString()
111111
$e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
112112
}
113113

114-
if (\PHP_VERSION_ID < 70400) {
115-
// leverage the ErrorHandler component with graceful fallback when it's not available
116-
return trigger_error($e, \E_USER_ERROR);
117-
}
118-
119114
throw $e;
120115
}
121116
}

UnicodeString.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ public function slice(int $start = 0, int $length = null): AbstractString
268268
{
269269
$str = clone $this;
270270

271-
if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
272-
$start = 0;
273-
}
274271
$str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
275272

276273
return $str;
@@ -280,9 +277,6 @@ public function splice(string $replacement, int $start = 0, int $length = null):
280277
{
281278
$str = clone $this;
282279

283-
if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
284-
$start = 0;
285-
}
286280
$start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
287281
$length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
288282
$str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);

0 commit comments

Comments
 (0)