[TOOLS] Fix all issues found by PHPStan level 2

This commit is contained in:
2021-09-06 23:47:28 +01:00
parent 4b1780a2ee
commit 4e30e5aad9
33 changed files with 114 additions and 89 deletions

View File

@@ -30,8 +30,9 @@ use App\Util\Exception\NoSuchFileException;
use App\Util\Exception\NotFoundException;
use App\Util\Exception\NotStoredLocallyException;
use App\Util\Exception\ServerException;
use SplFileInfo;
use App\Util\TemporaryFile;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\File as SymfonyFile;
use Symfony\Component\HttpFoundation\HeaderUtils;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mime\MimeTypes;
@@ -52,17 +53,13 @@ class GSFile
/**
* Perform file validation (checks and normalization), store the given file if needed and increment lives
*
* @param SplFileInfo $file
* @param string $dest_dir
* @param null|string $title
* @param bool $is_local
* @param null|int $actor_id
* @param SymfonyFile|TemporaryFile $file
*
* @throws DuplicateFoundException
*
* @return Attachment
*/
public static function sanitizeAndStoreFileAsAttachment(SplFileInfo $file): Attachment
public static function sanitizeAndStoreFileAsAttachment(TemporaryFile|SymfonyFile $file): Attachment
{
$hash = null;
Event::handle('HashFile', [$file->getPathname(), &$hash]);