You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewFileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
41
+
thrownewFileNotFoundException(\sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
42
42
}
43
43
44
44
$this->mkdir(\dirname($targetFile));
@@ -51,12 +51,12 @@ public function copy(string $originFile, string $targetFile, bool $overwriteNewe
51
51
if ($doCopy) {
52
52
// https://bugs.php.net/64634
53
53
if (!$source = self::box('fopen', $originFile, 'r')) {
54
-
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
54
+
thrownewIOException(\sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
55
55
}
56
56
57
57
// Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
59
+
thrownewIOException(\sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
79
-
thrownewIOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
79
+
thrownewIOException(\sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
80
80
}
81
81
}
82
82
}
@@ -95,7 +95,7 @@ public function mkdir(string|iterable $dirs, int $mode = 0777): void
95
95
}
96
96
97
97
if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
98
-
thrownewIOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
98
+
thrownewIOException(\sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
99
99
}
100
100
}
101
101
}
@@ -109,7 +109,7 @@ public function exists(string|iterable $files): bool
109
109
110
110
foreach ($this->toIterable($files) as$file) {
111
111
if (\strlen($file) > $maxPathLength) {
112
-
thrownewIOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
112
+
thrownewIOException(\sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
113
113
}
114
114
115
115
if (!file_exists($file)) {
@@ -132,7 +132,7 @@ public function touch(string|iterable $files, ?int $time = null, ?int $atime = n
if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
391
-
thrownewIOException(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);
391
+
thrownewIOException(\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);
392
392
}
393
393
}
394
-
thrownewIOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
394
+
thrownewIOException(\sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
395
395
}
396
396
397
397
/**
@@ -428,11 +428,11 @@ public function readlink(string $path, bool $canonicalize = false): ?string
thrownewInvalidArgumentException(sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
440
+
thrownewInvalidArgumentException(\sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
441
441
}
442
442
443
443
if (!self::isAbsolute($basePath)) {
444
-
thrownewInvalidArgumentException(sprintf('The base path "%s" is not an absolute path.', $basePath));
444
+
thrownewInvalidArgumentException(\sprintf('The base path "%s" is not an absolute path.', $basePath));
445
445
}
446
446
447
447
if (self::isAbsolute($path)) {
@@ -531,12 +531,12 @@ public static function makeRelative(string $path, string $basePath): string
531
531
// If the passed path is absolute, but the base path is not, we
532
532
// cannot generate a relative path
533
533
if ('' !== $root && '' === $baseRoot) {
534
-
thrownewInvalidArgumentException(sprintf('The absolute path "%s" cannot be made relative to the relative path "%s". You should provide an absolute base path instead.', $path, $basePath));
534
+
thrownewInvalidArgumentException(\sprintf('The absolute path "%s" cannot be made relative to the relative path "%s". You should provide an absolute base path instead.', $path, $basePath));
535
535
}
536
536
537
537
// Fail if the roots of the two paths are different
538
538
if ($baseRoot && $root !== $baseRoot) {
539
-
thrownewInvalidArgumentException(sprintf('The path "%s" cannot be made relative to "%s", because they have different roots ("%s" and "%s").', $path, $basePath, $root, $baseRoot));
539
+
thrownewInvalidArgumentException(\sprintf('The path "%s" cannot be made relative to "%s", because they have different roots ("%s" and "%s").', $path, $basePath, $root, $baseRoot));
Copy file name to clipboardexpand all lines: Tests/FilesystemTest.php
+2-2
Original file line number
Diff line number
Diff line change
@@ -1823,15 +1823,15 @@ public function testReadFile()
1823
1823
publicfunctiontestReadNonExistentFile()
1824
1824
{
1825
1825
$this->expectException(IOException::class);
1826
-
$this->expectExceptionMessageMatches(sprintf('#^Failed to read file ".+%1$sTests/invalid"\\: file_get_contents\\(.+%1$sTests/invalid\\)\\: Failed to open stream\\: No such file or directory$#', preg_quote(\DIRECTORY_SEPARATOR)));
1826
+
$this->expectExceptionMessageMatches(\sprintf('#^Failed to read file ".+%1$sTests/invalid"\\: file_get_contents\\(.+%1$sTests/invalid\\)\\: Failed to open stream\\: No such file or directory$#', preg_quote(\DIRECTORY_SEPARATOR)));
1827
1827
1828
1828
$this->filesystem->readFile(__DIR__.'/invalid');
1829
1829
}
1830
1830
1831
1831
publicfunctiontestReadDirectory()
1832
1832
{
1833
1833
$this->expectException(IOException::class);
1834
-
$this->expectExceptionMessageMatches(sprintf('#^Failed to read file ".+%sTests"\\: File is a directory\\.$#', preg_quote(\DIRECTORY_SEPARATOR)));
1834
+
$this->expectExceptionMessageMatches(\sprintf('#^Failed to read file ".+%sTests"\\: File is a directory\\.$#', preg_quote(\DIRECTORY_SEPARATOR)));
0 commit comments