Skip to content

Commit 2938239

Browse files
committed
Leverage array_is_list(), get_debug_type(), is_countable(), is_iterable(), str_contains() and str_starts_with()
1 parent c6171eb commit 2938239

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Path.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public static function makeRelative(string $path, string $basePath): string
574574
*/
575575
public static function isLocal(string $path): bool
576576
{
577-
return '' !== $path && false === mb_strpos($path, '://');
577+
return '' !== $path && !str_contains($path, '://');
578578
}
579579

580580
/**
@@ -638,7 +638,7 @@ public static function getLongestCommonBasePath(string ...$paths): ?string
638638

639639
// Prevent false positives for common prefixes
640640
// see isBasePath()
641-
if (0 === mb_strpos($path.'/', $basePath.'/')) {
641+
if (str_starts_with($path.'/', $basePath.'/')) {
642642
// next path
643643
continue 2;
644644
}
@@ -666,7 +666,7 @@ public static function join(string ...$paths): string
666666
if (null === $finalPath) {
667667
// For first part we keep slashes, like '/top', 'C:\' or 'phar://'
668668
$finalPath = $path;
669-
$wasScheme = (false !== mb_strpos($path, '://'));
669+
$wasScheme = str_contains($path, '://');
670670
continue;
671671
}
672672

@@ -717,7 +717,7 @@ public static function isBasePath(string $basePath, string $ofPath): bool
717717
// Don't append a slash for the root "/", because then that root
718718
// won't be discovered as common prefix ("//" is not a prefix of
719719
// "/foobar/").
720-
return 0 === mb_strpos($ofPath.'/', rtrim($basePath, '/').'/');
720+
return str_starts_with($ofPath.'/', rtrim($basePath, '/').'/');
721721
}
722722

723723
/**
@@ -786,7 +786,7 @@ private static function split(string $path): array
786786
$length = mb_strlen($path);
787787

788788
// Remove and remember root directory
789-
if (0 === mb_strpos($path, '/')) {
789+
if (str_starts_with($path, '/')) {
790790
$root .= '/';
791791
$path = $length > 1 ? mb_substr($path, 1) : '';
792792
} elseif ($length > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {

0 commit comments

Comments
 (0)