Skip to content

Commit ed397ef

Browse files
Merge branch '4.4' into 5.2
* 4.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents d73a48e + 517fb79 commit ed397ef

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
@@ -175,7 +175,7 @@ public function remove($files)
175175
if (!self::box('rmdir', $file) && file_exists($file)) {
176176
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).self::$lastError);
177177
}
178-
} elseif (!self::box('unlink', $file) && (false !== strpos(self::$lastError, 'Permission denied') || file_exists($file))) {
178+
} elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
179179
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
180180
}
181181
}
@@ -368,7 +368,7 @@ public function hardlink(string $originFile, $targetFiles)
368368
private function linkException(string $origin, string $target, string $linkType)
369369
{
370370
if (self::$lastError) {
371-
if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
371+
if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
372372
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);
373373
}
374374
}

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)