@@ -45,7 +45,7 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
4545 throw new FileNotFoundException (sprintf ('Failed to copy "%s" because file does not exist. ' , $ originFile ), 0 , null , $ originFile );
4646 }
4747
48- $ this ->mkdir (dirname ($ targetFile ));
48+ $ this ->mkdir (\ dirname ($ targetFile ));
4949
5050 $ doCopy = true ;
5151 if (!$ overwriteNewerFiles && null === parse_url ($ originFile , PHP_URL_HOST ) && is_file ($ targetFile )) {
@@ -122,7 +122,7 @@ public function exists($files)
122122 $ maxPathLength = PHP_MAXPATHLEN - 2 ;
123123
124124 foreach ($ this ->toIterable ($ files ) as $ file ) {
125- if (strlen ($ file ) > $ maxPathLength ) {
125+ if (\ strlen ($ file ) > $ maxPathLength ) {
126126 throw new IOException (sprintf ('Could not check if file exist because path length exceeds %d characters. ' , $ maxPathLength ), 0 , null , $ file );
127127 }
128128
@@ -164,7 +164,7 @@ public function remove($files)
164164 {
165165 if ($ files instanceof \Traversable) {
166166 $ files = iterator_to_array ($ files , false );
167- } elseif (!is_array ($ files )) {
167+ } elseif (!\ is_array ($ files )) {
168168 $ files = array ($ files );
169169 }
170170 $ files = array_reverse ($ files );
@@ -223,7 +223,7 @@ public function chown($files, $user, $recursive = false)
223223 if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
224224 $ this ->chown (new \FilesystemIterator ($ file ), $ user , true );
225225 }
226- if (is_link ($ file ) && function_exists ('lchown ' )) {
226+ if (is_link ($ file ) && \ function_exists ('lchown ' )) {
227227 if (true !== @lchown ($ file , $ user )) {
228228 throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ), 0 , null , $ file );
229229 }
@@ -250,7 +250,7 @@ public function chgrp($files, $group, $recursive = false)
250250 if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
251251 $ this ->chgrp (new \FilesystemIterator ($ file ), $ group , true );
252252 }
253- if (is_link ($ file ) && function_exists ('lchgrp ' )) {
253+ if (is_link ($ file ) && \ function_exists ('lchgrp ' )) {
254254 if (true !== @lchgrp ($ file , $ group )) {
255255 throw new IOException (sprintf ('Failed to chgrp file "%s". ' , $ file ), 0 , null , $ file );
256256 }
@@ -304,7 +304,7 @@ private function isReadable($filename)
304304 {
305305 $ maxPathLength = PHP_MAXPATHLEN - 2 ;
306306
307- if (strlen ($ filename ) > $ maxPathLength ) {
307+ if (\ strlen ($ filename ) > $ maxPathLength ) {
308308 throw new IOException (sprintf ('Could not check if file is readable because path length exceeds %d characters. ' , $ maxPathLength ), 0 , null , $ filename );
309309 }
310310
@@ -333,7 +333,7 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
333333 }
334334 }
335335
336- $ this ->mkdir (dirname ($ targetDir ));
336+ $ this ->mkdir (\ dirname ($ targetDir ));
337337
338338 if (is_link ($ targetDir )) {
339339 if (readlink ($ targetDir ) === $ originDir ) {
@@ -461,7 +461,7 @@ public function makePathRelative($endPath, $startPath)
461461 }
462462
463463 $ stripDriveLetter = function ($ path ) {
464- if (strlen ($ path ) > 2 && ': ' === $ path [1 ] && '/ ' === $ path [2 ] && ctype_alpha ($ path [0 ])) {
464+ if (\ strlen ($ path ) > 2 && ': ' === $ path [1 ] && '/ ' === $ path [2 ] && ctype_alpha ($ path [0 ])) {
465465 return substr ($ path , 2 );
466466 }
467467
@@ -499,16 +499,16 @@ public function makePathRelative($endPath, $startPath)
499499 }
500500
501501 // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
502- if (1 === count ($ startPathArr ) && '' === $ startPathArr [0 ]) {
502+ if (1 === \ count ($ startPathArr ) && '' === $ startPathArr [0 ]) {
503503 $ depth = 0 ;
504504 } else {
505- $ depth = count ($ startPathArr ) - $ index ;
505+ $ depth = \ count ($ startPathArr ) - $ index ;
506506 }
507507
508508 // Repeated "../" for each level need to reach the common path
509509 $ traverser = str_repeat ('../ ' , $ depth );
510510
511- $ endPathRemainder = implode ('/ ' , array_slice ($ endPathArr , $ index ));
511+ $ endPathRemainder = implode ('/ ' , \ array_slice ($ endPathArr , $ index ));
512512
513513 // Construct $endPath from traversing to the common path, then to the remaining $endPath
514514 $ relativePath = $ traverser .('' !== $ endPathRemainder ? $ endPathRemainder .'/ ' : '' );
@@ -539,7 +539,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
539539 {
540540 $ targetDir = rtrim ($ targetDir , '/ \\' );
541541 $ originDir = rtrim ($ originDir , '/ \\' );
542- $ originDirLen = strlen ($ originDir );
542+ $ originDirLen = \ strlen ($ originDir );
543543
544544 // Iterate in destination folder to remove obsolete entries
545545 if ($ this ->exists ($ targetDir ) && isset ($ options ['delete ' ]) && $ options ['delete ' ]) {
@@ -548,7 +548,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
548548 $ flags = \FilesystemIterator::SKIP_DOTS ;
549549 $ deleteIterator = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ targetDir , $ flags ), \RecursiveIteratorIterator::CHILD_FIRST );
550550 }
551- $ targetDirLen = strlen ($ targetDir );
551+ $ targetDirLen = \ strlen ($ targetDir );
552552 foreach ($ deleteIterator as $ file ) {
553553 $ origin = $ originDir .substr ($ file ->getPathname (), $ targetDirLen );
554554 if (!$ this ->exists ($ origin )) {
@@ -606,7 +606,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
606606 public function isAbsolutePath ($ file )
607607 {
608608 return strspn ($ file , '/ \\' , 0 , 1 )
609- || (strlen ($ file ) > 3 && ctype_alpha ($ file [0 ])
609+ || (\ strlen ($ file ) > 3 && ctype_alpha ($ file [0 ])
610610 && ': ' === $ file [1 ]
611611 && strspn ($ file , '/ \\' , 2 , 1 )
612612 )
@@ -676,7 +676,7 @@ public function tempnam($dir, $prefix)
676676 */
677677 public function dumpFile ($ filename , $ content )
678678 {
679- $ dir = dirname ($ filename );
679+ $ dir = \ dirname ($ filename );
680680
681681 if (!is_dir ($ dir )) {
682682 $ this ->mkdir ($ dir );
@@ -709,7 +709,7 @@ public function dumpFile($filename, $content)
709709 */
710710 public function appendToFile ($ filename , $ content )
711711 {
712- $ dir = dirname ($ filename );
712+ $ dir = \ dirname ($ filename );
713713
714714 if (!is_dir ($ dir )) {
715715 $ this ->mkdir ($ dir );
@@ -726,7 +726,7 @@ public function appendToFile($filename, $content)
726726
727727 private function toIterable ($ files ): iterable
728728 {
729- return is_array ($ files ) || $ files instanceof \Traversable ? $ files : array ($ files );
729+ return \ is_array ($ files ) || $ files instanceof \Traversable ? $ files : array ($ files );
730730 }
731731
732732 /**
@@ -736,7 +736,7 @@ private function getSchemeAndHierarchy(string $filename): array
736736 {
737737 $ components = explode (':// ' , $ filename , 2 );
738738
739- return 2 === count ($ components ) ? array ($ components [0 ], $ components [1 ]) : array (null , $ components [0 ]);
739+ return 2 === \ count ($ components ) ? array ($ components [0 ], $ components [1 ]) : array (null , $ components [0 ]);
740740 }
741741
742742 private static function box ($ func )
0 commit comments