Skip to content

Commit 2cd5175

Browse files
Merge branch '5.4' into 6.0
* 5.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents be0ff93 + 343f4fe commit 2cd5175

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private static function doRemove(array $files, bool $isRecursive): void
192192

193193
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
194194
}
195-
} elseif (!self::box('unlink', $file) && (false !== strpos(self::$lastError, 'Permission denied') || file_exists($file))) {
195+
} elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
196196
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
197197
}
198198
}
@@ -382,7 +382,7 @@ public function hardlink(string $originFile, string|iterable $targetFiles)
382382
private function linkException(string $origin, string $target, string $linkType)
383383
{
384384
if (self::$lastError) {
385-
if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
385+
if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
386386
throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
387387
}
388388
}

Tests/FilesystemTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function setUpBeforeClass(): void
4848
$targetFile = tempnam(sys_get_temp_dir(), 'li');
4949
if (true !== @link($originFile, $targetFile)) {
5050
$report = error_get_last();
51-
if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
51+
if (\is_array($report) && str_contains($report['message'], 'error code(1314)')) {
5252
self::$linkOnWindows = false;
5353
}
5454
} else {
@@ -60,7 +60,7 @@ public static function setUpBeforeClass(): void
6060
$targetDir = tempnam(sys_get_temp_dir(), 'sl');
6161
if (true !== @symlink($originDir, $targetDir)) {
6262
$report = error_get_last();
63-
if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
63+
if (\is_array($report) && str_contains($report['message'], 'error code(1314)')) {
6464
self::$symlinkOnWindows = false;
6565
}
6666
} else {

0 commit comments

Comments
 (0)