private function getExtension(UploadedFile $file): ?string
    {
        $originalName = $file->getClientOriginalName();

        if ($extension = pathinfo($originalName, PATHINFO_EXTENSION)) {
            return strtolower($extension);
        }

        if ($extension = $file->guessExtension()) {
            return strtolower($extension);
        }

        return null;
    }
private function getExtension(UploadedFile $file): ?string
    {
        $originalName = $file->getClientOriginalName();

        if ($extension = pathinfo($originalName, PATHINFO_EXTENSION)) {
            return strtolower($extension);
        }

        if ($extension = $file->guessExtension()) {
            return strtolower($extension);
        }

        return null;
    }
private function getExtension ( UploadedFile $ file ) : ? string { $ originalName = $ file -> getClientOriginalName ( ) ; if ( $ extension = pathinfo ( $ originalName , PATHINFO_EXTENSION ) ) { return strtolower ( $ extension ) ; } if ( $ extension = $ file -> guessExtension ( ) ) { return strtolower ( $ extension ) ; } return null ; }
Guess the extension of the given file.

@param UploadedFile $file

@return string|null
Guess the extension of the given file .