@@ -31,12 +31,10 @@ class Filesystem
31
31
* If the target file is newer, it is overwritten only when the
32
32
* $overwriteNewerFiles option is set to true.
33
33
*
34
- * @return void
35
- *
36
34
* @throws FileNotFoundException When originFile doesn't exist
37
35
* @throws IOException When copy fails
38
36
*/
39
- public function copy (string $ originFile , string $ targetFile , bool $ overwriteNewerFiles = false )
37
+ public function copy (string $ originFile , string $ targetFile , bool $ overwriteNewerFiles = false ): void
40
38
{
41
39
$ originIsLocal = stream_is_local ($ originFile ) || 0 === stripos ($ originFile , 'file:// ' );
42
40
if ($ originIsLocal && !is_file ($ originFile )) {
@@ -84,11 +82,9 @@ public function copy(string $originFile, string $targetFile, bool $overwriteNewe
84
82
/**
85
83
* Creates a directory recursively.
86
84
*
87
- * @return void
88
- *
89
85
* @throws IOException On any directory creation failure
90
86
*/
91
- public function mkdir (string |iterable $ dirs , int $ mode = 0777 )
87
+ public function mkdir (string |iterable $ dirs , int $ mode = 0777 ): void
92
88
{
93
89
foreach ($ this ->toIterable ($ dirs ) as $ dir ) {
94
90
if (is_dir ($ dir )) {
@@ -127,11 +123,9 @@ public function exists(string|iterable $files): bool
127
123
* @param int|null $time The touch time as a Unix timestamp, if not supplied the current system time is used
128
124
* @param int|null $atime The access time as a Unix timestamp, if not supplied the current system time is used
129
125
*
130
- * @return void
131
- *
132
126
* @throws IOException When touch fails
133
127
*/
134
- public function touch (string |iterable $ files , int $ time = null , int $ atime = null )
128
+ public function touch (string |iterable $ files , int $ time = null , int $ atime = null ): void
135
129
{
136
130
foreach ($ this ->toIterable ($ files ) as $ file ) {
137
131
if (!($ time ? self ::box ('touch ' , $ file , $ time , $ atime ) : self ::box ('touch ' , $ file ))) {
@@ -143,11 +137,9 @@ public function touch(string|iterable $files, int $time = null, int $atime = nul
143
137
/**
144
138
* Removes files or directories.
145
139
*
146
- * @return void
147
- *
148
140
* @throws IOException When removal fails
149
141
*/
150
- public function remove (string |iterable $ files )
142
+ public function remove (string |iterable $ files ): void
151
143
{
152
144
if ($ files instanceof \Traversable) {
153
145
$ files = iterator_to_array ($ files , false );
@@ -211,11 +203,9 @@ private static function doRemove(array $files, bool $isRecursive): void
211
203
* @param int $umask The mode mask (octal)
212
204
* @param bool $recursive Whether change the mod recursively or not
213
205
*
214
- * @return void
215
- *
216
206
* @throws IOException When the change fails
217
207
*/
218
- public function chmod (string |iterable $ files , int $ mode , int $ umask = 0000 , bool $ recursive = false )
208
+ public function chmod (string |iterable $ files , int $ mode , int $ umask = 0000 , bool $ recursive = false ): void
219
209
{
220
210
foreach ($ this ->toIterable ($ files ) as $ file ) {
221
211
if (!self ::box ('chmod ' , $ file , $ mode & ~$ umask )) {
@@ -233,11 +223,9 @@ public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool
233
223
* @param string|int $user A user name or number
234
224
* @param bool $recursive Whether change the owner recursively or not
235
225
*
236
- * @return void
237
- *
238
226
* @throws IOException When the change fails
239
227
*/
240
- public function chown (string |iterable $ files , string |int $ user , bool $ recursive = false )
228
+ public function chown (string |iterable $ files , string |int $ user , bool $ recursive = false ): void
241
229
{
242
230
foreach ($ this ->toIterable ($ files ) as $ file ) {
243
231
if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
@@ -261,11 +249,9 @@ public function chown(string|iterable $files, string|int $user, bool $recursive
261
249
* @param string|int $group A group name or number
262
250
* @param bool $recursive Whether change the group recursively or not
263
251
*
264
- * @return void
265
- *
266
252
* @throws IOException When the change fails
267
253
*/
268
- public function chgrp (string |iterable $ files , string |int $ group , bool $ recursive = false )
254
+ public function chgrp (string |iterable $ files , string |int $ group , bool $ recursive = false ): void
269
255
{
270
256
foreach ($ this ->toIterable ($ files ) as $ file ) {
271
257
if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
@@ -286,12 +272,10 @@ public function chgrp(string|iterable $files, string|int $group, bool $recursive
286
272
/**
287
273
* Renames a file or a directory.
288
274
*
289
- * @return void
290
- *
291
275
* @throws IOException When target file or directory already exists
292
276
* @throws IOException When origin cannot be renamed
293
277
*/
294
- public function rename (string $ origin , string $ target , bool $ overwrite = false )
278
+ public function rename (string $ origin , string $ target , bool $ overwrite = false ): void
295
279
{
296
280
// we check that target does not exist
297
281
if (!$ overwrite && $ this ->isReadable ($ target )) {
@@ -329,11 +313,9 @@ private function isReadable(string $filename): bool
329
313
/**
330
314
* Creates a symbolic link or copy a directory.
331
315
*
332
- * @return void
333
- *
334
316
* @throws IOException When symlink fails
335
317
*/
336
- public function symlink (string $ originDir , string $ targetDir , bool $ copyOnWindows = false )
318
+ public function symlink (string $ originDir , string $ targetDir , bool $ copyOnWindows = false ): void
337
319
{
338
320
self ::assertFunctionExists ('symlink ' );
339
321
@@ -367,12 +349,10 @@ public function symlink(string $originDir, string $targetDir, bool $copyOnWindow
367
349
*
368
350
* @param string|string[] $targetFiles The target file(s)
369
351
*
370
- * @return void
371
- *
372
352
* @throws FileNotFoundException When original file is missing or not a file
373
353
* @throws IOException When link fails, including if link already exists
374
354
*/
375
- public function hardlink (string $ originFile , string |iterable $ targetFiles )
355
+ public function hardlink (string $ originFile , string |iterable $ targetFiles ): void
376
356
{
377
357
self ::assertFunctionExists ('link ' );
378
358
@@ -526,11 +506,9 @@ public function makePathRelative(string $endPath, string $startPath): string
526
506
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false)
527
507
* - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
528
508
*
529
- * @return void
530
- *
531
509
* @throws IOException When file type is unknown
532
510
*/
533
- public function mirror (string $ originDir , string $ targetDir , \Traversable $ iterator = null , array $ options = [])
511
+ public function mirror (string $ originDir , string $ targetDir , \Traversable $ iterator = null , array $ options = []): void
534
512
{
535
513
$ targetDir = rtrim ($ targetDir , '/ \\' );
536
514
$ originDir = rtrim ($ originDir , '/ \\' );
@@ -652,11 +630,9 @@ public function tempnam(string $dir, string $prefix, string $suffix = ''): strin
652
630
*
653
631
* @param string|resource $content The data to write into the file
654
632
*
655
- * @return void
656
- *
657
633
* @throws IOException if the file cannot be written to
658
634
*/
659
- public function dumpFile (string $ filename , $ content )
635
+ public function dumpFile (string $ filename , $ content ): void
660
636
{
661
637
if (\is_array ($ content )) {
662
638
throw new \TypeError (sprintf ('Argument 2 passed to "%s()" must be string or resource, array given. ' , __METHOD__ ));
@@ -699,11 +675,9 @@ public function dumpFile(string $filename, $content)
699
675
* @param string|resource $content The content to append
700
676
* @param bool $lock Whether the file should be locked when writing to it
701
677
*
702
- * @return void
703
- *
704
678
* @throws IOException If the file is not writable
705
679
*/
706
- public function appendToFile (string $ filename , $ content , bool $ lock = false )
680
+ public function appendToFile (string $ filename , $ content , bool $ lock = false ): void
707
681
{
708
682
if (\is_array ($ content )) {
709
683
throw new \TypeError (sprintf ('Argument 2 passed to "%s()" must be string or resource, array given. ' , __METHOD__ ));
0 commit comments