@@ -111,7 +111,8 @@ public function getSizeByUnit(string $unit = 'b')
111111 public function guessExtension (): ?string
112112 {
113113 // naively get the path extension using pathinfo
114- $ pathinfo = pathinfo ($ this ->getRealPath () ?: $ this ->__toString ()) + ['extension ' => '' ];
114+ $ realPath = $ this ->getRealPath ();
115+ $ pathinfo = pathinfo ($ realPath === false ? $ this ->__toString () : $ realPath ) + ['extension ' => '' ];
115116
116117 $ proposedExtension = $ pathinfo ['extension ' ];
117118
@@ -131,9 +132,10 @@ public function getMimeType(): string
131132 return $ this ->originalMimeType ?? 'application/octet-stream ' ; // @codeCoverageIgnore
132133 }
133134
134- $ finfo = finfo_open (FILEINFO_MIME_TYPE );
135+ $ finfo = finfo_open (FILEINFO_MIME_TYPE );
136+ $ realPath = $ this ->getRealPath ();
135137
136- return finfo_file ($ finfo , $ this -> getRealPath () ?: $ this ->__toString ());
138+ return finfo_file ($ finfo , $ realPath === false ? $ this ->__toString () : $ realPath );
137139 }
138140
139141 /**
@@ -159,7 +161,8 @@ public function move(string $targetPath, ?string $name = null, bool $overwrite =
159161 $ name ??= $ this ->getBasename ();
160162 $ destination = $ overwrite ? $ targetPath . $ name : $ this ->getDestination ($ targetPath . $ name );
161163
162- $ oldName = $ this ->getRealPath () ?: $ this ->__toString ();
164+ $ realPath = $ this ->getRealPath ();
165+ $ oldName = $ realPath === false ? $ this ->__toString () : $ realPath ;
163166
164167 if (! @rename ($ oldName , $ destination )) {
165168 $ error = error_get_last ();
0 commit comments