@@ -42,8 +42,8 @@ class Path
4242 */
4343 public static function join (string |self $ path , string |self ...$ parts ): self
4444 {
45- $ path = (string )$ path ;
46- $ parts = \array_map (fn ($ p ) => (string )$ p , $ parts );
45+ $ path = (string ) $ path ;
46+ $ parts = \array_map (fn ($ p ) => (string ) $ p , $ parts );
4747
4848 foreach ($ parts as $ part ) {
4949 if (\str_starts_with ($ part , BuiltinProxy::$ DIRECTORY_SEPARATOR )) {
@@ -75,7 +75,7 @@ public static function join(string|self $path, string|self ...$parts): self
7575 */
7676 public static function splitDrive (string |self $ path ): array
7777 {
78- $ path = (string )$ path ;
78+ $ path = (string ) $ path ;
7979
8080 $ matches = [];
8181
@@ -84,10 +84,10 @@ public static function splitDrive(string|self $path): array
8484 return \array_slice ($ matches , -2 );
8585 }
8686
87- $ rx =
88- BuiltinProxy::$ DIRECTORY_SEPARATOR === '/ ' ?
89- '/(^\/\/[\w\-\s]{2,15}\/[\w\-\s]+)(.*)/ ' :
90- '/(^ \\\\\\\\[\w\-\s]{2,15} \\\[\w\-\s]+)(.*)/ ' ;
87+ $ rx
88+ = BuiltinProxy::$ DIRECTORY_SEPARATOR === '/ '
89+ ? '/(^\/\/[\w\-\s]{2,15}\/[\w\-\s]+)(.*)/ '
90+ : '/(^ \\\\\\\\[\w\-\s]{2,15} \\\[\w\-\s]+)(.*)/ ' ;
9191
9292 \preg_match ($ rx , $ path , $ matches );
9393 if ($ matches ) {
@@ -101,7 +101,7 @@ public function __construct(string|self $path)
101101 {
102102 $ this ->builtin = new BuiltinProxy ();
103103
104- $ this ->path = (string )$ path ;
104+ $ this ->path = (string ) $ path ;
105105 $ this ->handle = null ;
106106 }
107107
@@ -218,9 +218,9 @@ public function getHomeDir(): self
218218 }
219219
220220 if ($ this ->builtin ->function_exists ('exec ' )) {
221- $ homeDir = $ isWindows ?
222- $ this ->builtin ->exec ('echo %userprofile% ' ) :
223- $ this ->builtin ->exec ('echo ~ ' );
221+ $ homeDir = $ isWindows
222+ ? $ this ->builtin ->exec ('echo %userprofile% ' )
223+ : $ this ->builtin ->exec ('echo ~ ' );
224224
225225 if ($ homeDir ) {
226226 return new self ($ homeDir );
@@ -693,7 +693,7 @@ public function move(string|self $destination): self
693693 * @return void
694694 * @throws IOException
695695 */
696- public function touch (int |\DateTime $ time = null , int |\DateTime $ atime = null ): void
696+ public function touch (int |\DateTime | null $ time = null , int |\DateTime | null $ atime = null ): void
697697 {
698698 if ($ time instanceof \DateTime) {
699699 $ time = $ time ->getTimestamp ();
@@ -744,7 +744,7 @@ public function size(): int
744744 public function parent (int $ levels = 1 ): self
745745 {
746746 return $ this ->cast (
747- $ this ->builtin ->dirname ($ this ->path ?? ". " , $ levels )
747+ $ this ->builtin ->dirname ($ this ->path ?: ". " , $ levels )
748748 );
749749 }
750750
@@ -953,7 +953,7 @@ public function getPermissions(bool $asOctal = true): int
953953 }
954954
955955 if (!$ asOctal ) {
956- $ perms = (int )substr (sprintf ('%o ' , $ perms ), -4 );
956+ $ perms = (int ) substr (sprintf ('%o ' , $ perms ), -4 );
957957 }
958958
959959 return $ perms ;
@@ -1058,9 +1058,9 @@ public function setOwner(string $user, string $group, bool $clearStatCache = fal
10581058 $ this ->builtin ->clearstatcache ();
10591059 }
10601060
1061- $ success =
1062- $ this ->builtin ->chown ($ this ->path , $ user ) &&
1063- $ this ->builtin ->chgrp ($ this ->path , $ group );
1061+ $ success
1062+ = $ this ->builtin ->chown ($ this ->path , $ user )
1063+ && $ this ->builtin ->chgrp ($ this ->path , $ group );
10641064
10651065 if ($ success === false ) {
10661066 throw new IOException ("An error occurred while setting owner of " . $ this ->path );
@@ -1087,7 +1087,7 @@ public function exists(): bool
10871087 *
10881088 * @throws IOException
10891089 */
1090- public function sameFile (string | self $ other ): bool
1090+ public function sameFile (string | self $ other ): bool
10911091 {
10921092 return $ this ->absPath ()->path () === $ this ->cast ($ other )->absPath ()->path ();
10931093 }
@@ -1613,7 +1613,7 @@ public function link(string|self $newLink): self
16131613 throw new FileExistsException ($ newLink . " already exist " );
16141614 }
16151615
1616- $ success = $ this ->builtin ->link ($ this ->path , (string )$ newLink );
1616+ $ success = $ this ->builtin ->link ($ this ->path , (string ) $ newLink );
16171617
16181618 if ($ success === false ) {
16191619 throw new IOException ("An error occurred while creating the link from " . $ this ->path . " to " . $ newLink );
@@ -1650,7 +1650,7 @@ public function lstat(): array
16501650 * @throws FileExistsException If the symbolic link already exists.
16511651 * @throws IOException If there was an error while creating the symbolic link.
16521652 */
1653- public function symlink (string | self $ newLink ): self
1653+ public function symlink (string | self $ newLink ): self
16541654 {
16551655 if (!$ this ->exists ()) {
16561656 throw new FileNotFoundException ("File or dir does not exist : " . $ this );
@@ -1662,7 +1662,7 @@ public function symlink(string | self $newLink): self
16621662 throw new FileExistsException ($ newLink . " already exist " );
16631663 }
16641664
1665- $ success = $ this ->builtin ->symlink ($ this ->path , (string )$ newLink );
1665+ $ success = $ this ->builtin ->symlink ($ this ->path , (string ) $ newLink );
16661666
16671667 if ($ success === false ) {
16681668 throw new IOException ("An error occurred while creating the symbolic link from " . $ this ->path . " to " . $ newLink );
@@ -1719,8 +1719,8 @@ public function getRelativePath(string|self $basePath): self
17191719 throw new FileNotFoundException ("{$ this ->path } is not a file or directory " );
17201720 }
17211721
1722- $ path = (string )$ this ->absPath ();
1723- $ basePath = (string )$ basePath ;
1722+ $ path = (string ) $ this ->absPath ();
1723+ $ basePath = (string ) $ basePath ;
17241724
17251725 $ realBasePath = $ this ->builtin ->realpath ($ basePath );
17261726 if ($ realBasePath === false ) {
0 commit comments