Skip to content

Commit f113128

Browse files
authored
fix(support): correct some string function oversights (#1743)
1 parent 7501c1b commit f113128

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/support/src/Str/functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function after_last(Stringable|string $string, Stringable|string|array $search):
257257
return $string;
258258
}
259259

260-
return mb_substr($string, $farthestPosition + strlen($foundSearch));
260+
return mb_substr($string, $farthestPosition + mb_strlen($foundSearch));
261261
}
262262

263263
/**
@@ -371,7 +371,7 @@ function replace_first(Stringable|string $string, array|Stringable|string $searc
371371
$search = normalize_string($search);
372372

373373
foreach (Arr\wrap($search) as $item) {
374-
if ($search === '') {
374+
if ($item === '') {
375375
continue;
376376
}
377377

@@ -421,7 +421,7 @@ function replace_end(Stringable|string $string, array|Stringable|string $search,
421421
$search = normalize_string($search);
422422

423423
foreach (Arr\wrap($search) as $item) {
424-
if ($search === '') {
424+
if ($item === '') {
425425
continue;
426426
}
427427

@@ -443,7 +443,7 @@ function replace_start(Stringable|string $string, array|Stringable|string $searc
443443
$string = (string) $string;
444444

445445
foreach (Arr\wrap($search) as $item) {
446-
if ($search === '') {
446+
if ($item === '') {
447447
continue;
448448
}
449449

packages/support/src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function str(Stringable|int|string|null $string = ''): ImmutableString
1818
}
1919

2020
/**
21-
* Creates an instance of {@see \Tempest\Support\Arr\ImmutableCollection} using the given `$input`. If `$input` is not an array, it will be wrapped in one.
21+
* Creates an instance of {@see \Tempest\Support\Arr\ImmutableArray} using the given `$input`. If `$input` is not an array, it will be wrapped in one.
2222
*/
2323
function arr(mixed $input = []): ImmutableArray
2424
{

0 commit comments

Comments
 (0)