Skip to content

Commit 343f4fe

Browse files
Merge branch '5.2' into 5.3
* 5.2: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 4f2948a + ed397ef commit 343f4fe

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Filesystem.php

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

200200
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
201201
}
202-
} elseif (!self::box('unlink', $file) && (false !== strpos(self::$lastError, 'Permission denied') || file_exists($file))) {
202+
} elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
203203
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
204204
}
205205
}
@@ -392,7 +392,7 @@ public function hardlink(string $originFile, $targetFiles)
392392
private function linkException(string $origin, string $target, string $linkType)
393393
{
394394
if (self::$lastError) {
395-
if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
395+
if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
396396
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);
397397
}
398398
}

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 {

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20-
"symfony/polyfill-ctype": "~1.8"
20+
"symfony/polyfill-ctype": "~1.8",
21+
"symfony/polyfill-php80": "^1.16"
2122
},
2223
"autoload": {
2324
"psr-4": { "Symfony\\Component\\Filesystem\\": "" },

0 commit comments

Comments
 (0)