Commit 5b4d7c4e authored by Guillaume Perréal's avatar Guillaume Perréal

CS.

parent 9f8a8c4b
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -75,12 +75,6 @@ class UploadController extends Controller
/**
* UploadController constructor.
*
* @param FileManagerInterface $fileManager
* @param UrlGeneratorInterface $urlGenerator
* @param CsrfTokenManagerInterface $csrfTokenManager
* @param TokenStorageInterface $tokenStorage
* @param EngineInterface $templating
*/
public function __construct(
FileManagerInterface $fileManager,
......@@ -99,10 +93,6 @@ class UploadController extends Controller
/**
* @Route("", name="file_upload_create")
* @Method("POST")
*
* @param Request $request
*
* @return JsonResponse
*/
public function createAction(Request $request): JsonResponse
{
......@@ -142,9 +132,6 @@ class UploadController extends Controller
* @Route("/{id}/content", name="file_upload_put_content")
* @Method("PUT")
*
* @param Request $request
* @param UploadedFile $file
*
* @return JsonResponse|Response
*/
public function putContentAction(Request $request, UploadedFile $file): Response
......@@ -166,11 +153,6 @@ class UploadController extends Controller
return $this->createResponse(Response::HTTP_OK, 'Chunk received');
}
/**
* @param Request $request
*
* @return array
*/
protected function handleRangeHeader(Request $request): array
{
if (!$request->headers->has('Content-Range')) {
......@@ -194,11 +176,6 @@ class UploadController extends Controller
return [$start, 1 + ($end - $start), $end === ($total - 1)];
}
/**
* @param UploadedFileInterface $file
*
* @return Response
*/
protected function completeUpload(UploadedFileInterface $file): Response
{
try {
......@@ -227,11 +204,6 @@ class UploadController extends Controller
/**
* @Route("/{id}/content", name="file_upload_get_content")
* @Method("GET")
*
* @param Request $request
* @param UploadedFile $file
*
* @return UploadedFileResponse
*/
public function getContentAction(Request $request, UploadedFile $file): UploadedFileResponse
{
......@@ -250,11 +222,6 @@ class UploadController extends Controller
/**
* @Route("/{id}", name="file_upload_delete")
* @Method("DELETE")
*
* @param Request $request
* @param UploadedFile $file
*
* @return JsonResponse
*/
public function deleteAction(Request $request, UploadedFile $file): JsonResponse
{
......@@ -268,8 +235,6 @@ class UploadController extends Controller
}
/**
* @param Request $request
*
* @throws HttpException
*/
protected function validateCsrfToken(Request $request): void
......@@ -283,10 +248,6 @@ class UploadController extends Controller
/**
* @param int $status
* @param string $message
* @param array $data
* @param array $headers
*
* @return JsonResponse
*/
protected function createResponse($status = Response::HTTP_OK, $message = 'OK', array $data = [], array $headers = []): JsonResponse
{
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -47,8 +47,6 @@ class UploadedFileController extends Controller
* @Method("GET")
* @Template()
*
* @param Request $request
*
* @return array
*/
public function indexAction(Request $request)
......@@ -80,8 +78,6 @@ class UploadedFileController extends Controller
* @Method("GET")
* @Template()
*
* @param UploadedFile $uploadedFile
*
* @return array
*/
public function showAction(UploadedFile $uploadedFile)
......@@ -93,7 +89,6 @@ class UploadedFileController extends Controller
/**
* @param string $message
* @param array $parameters
*/
public function notice($message, array $parameters = [])
{
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -362,8 +362,6 @@ class UploadedFile implements UploadedFileInterface
}
/**
* @param Filesystem $filesystem
*
* @internal
*/
public function setFilesystem(Filesystem $filesystem): void
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -32,9 +32,6 @@ class FileUploadCompleteEvent extends Event
*/
private $uploadedFile;
/**
* @param UploadedFileInterface $uploadedFile
*/
public function __construct(UploadedFileInterface $uploadedFile)
{
$this->uploadedFile = $uploadedFile;
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -33,10 +33,9 @@ class RejectedFileException extends RuntimeException implements Exception
protected $uploadedFile;
/**
* @param UploadedFileInterface $uploadedFile
* @param string $message
* @param int $code
* @param \Exception $previous
* @param string $message
* @param int $code
* @param \Exception $previous
*
* @internal param UploadedFileInterface $file
*/
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -43,8 +43,7 @@ class UploadedFileTransformer implements DataTransformerInterface
/**
* UploadedFileTransformer constructor.
*
* @param FileManagerInterface $fileManager
* @param bool $multiple
* @param bool $multiple
*/
public function __construct(FileManagerInterface $fileManager, $multiple = false)
{
......@@ -128,8 +127,6 @@ class UploadedFileTransformer implements DataTransformerInterface
/**
* @param mixed $value
*
* @return UploadedFileInterface|null
*/
public function reverseTransformFile($value): ?UploadedFileInterface
{
......@@ -138,9 +135,7 @@ class UploadedFileTransformer implements DataTransformerInterface
}
if (!is_array($value)) {
throw new TransformationFailedException(
sprintf('Expected an array, not a %s.', is_object($value) ? get_class($value) : gettype($value))
);
throw new TransformationFailedException(sprintf('Expected an array, not a %s.', is_object($value) ? get_class($value) : gettype($value)));
}
if (empty($value['id'])) {
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -68,9 +68,7 @@ class FileUploadType extends AbstractType
private $defaultMaxChunkSize;
/**
* @param Router $router
* @param FileManagerInterface $fileManager
* @param int $defaultMaxChunkSize
* @param int $defaultMaxChunkSize
*/
public function __construct(Router $router, FileManagerInterface $fileManager, $defaultMaxChunkSize)
{
......@@ -139,8 +137,7 @@ class FileUploadType extends AbstractType
/** Ajoute des contraintes de validation correspondants aux paramètres du champ.
* @todo Implémenter min_file_size, max_file_size && accept_file_types.
*
* @param OptionsResolver $options
* @param mixed $constraints
* @param mixed $constraints
*
* @return array|mixed
*/
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -53,7 +53,7 @@ class UploadedFileResponse extends Response
* @param int $status The response status code
* @param array $headers An array of response headers
* @param bool $public Files are public by default
* @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename
* @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename
*/
public function __construct(
UploadedFileInterface $file = null,
......@@ -78,7 +78,7 @@ class UploadedFileResponse extends Response
* @param int $status The response status code
* @param array $headers An array of response headers
* @param bool $public Files are public by default
* @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename
* @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename
*
* @return UploadedFileResponse The created response
*/
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -46,10 +46,6 @@ class CreationDataListener
$this->requestStack = $requestStack;
}
/**
* @param UploadedFileInterface $file
* @param LifecycleEventArgs $event
*/
public function prePersist(UploadedFileInterface $file, LifecycleEventArgs $event)
{
$file->setCreatedAt(new DateTime('now'));
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -39,17 +39,12 @@ class UploadedFileListener
*/
private $scheduledDeletion = [];
/**
* @param Filesystem $filesystem
*/
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}
/** Passe le filesystem à l'entité.
* @param UploadedFileInterface $file
* @param LifecycleEventArgs $event
*/
public function postLoad(UploadedFileInterface $file, LifecycleEventArgs $event)
{
......@@ -57,8 +52,6 @@ class UploadedFileListener
}
/** Renomme le fichier disque lorsque l'on change l'attribut 'path'.
* @param UploadedFileInterface $file
* @param LifecycleEventArgs $event
*/
public function postUpdate(UploadedFileInterface $file, LifecycleEventArgs $event)
{
......@@ -72,8 +65,6 @@ class UploadedFileListener
}
/** Enregistre le chemin du fichier à supprimer.
* @param UploadedFileInterface $file
* @param LifecycleEventArgs $event
*/
public function preRemove(UploadedFileInterface $file, LifecycleEventArgs $event)
{
......@@ -81,8 +72,6 @@ class UploadedFileListener
}
/** Supprime le fichier correspondant à l'UploadedFileInterface supprimé.
* @param UploadedFileInterface $file
* @param LifecycleEventArgs $event
*/
public function postRemove(UploadedFileInterface $file, LifecycleEventArgs $event)
{
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -34,17 +34,12 @@ class VirusScannerListener
*/
private $client;
/**
* @param Client $client
*/
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* @param FileUploadCompleteEvent $event
*
* @throws ConnectionException
*/
public function onFileUploadCompleted(FileUploadCompleteEvent $event)
......@@ -79,8 +74,6 @@ class VirusScannerListener
/**
* @throws ConnectionException
*
* @return Client
*/
private function getClient(): Client
{
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -54,12 +54,8 @@ interface FileManagerInterface
* N'accepte que des fichiers valides.
* Le nouveau fichier est automatiquement orphelin, avec un chemin par défaut.
*
* @param UploadedFileInterface $original
*
* @throws InvalidArgumentException le fichier original est invalide
*
* @return UploadedFileInterface
*
* @api
*/
public function duplicate(UploadedFileInterface $original): UploadedFileInterface;
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -207,7 +207,6 @@ interface UploadedFileInterface
public function getEtat();
/** Définit la date de création du fichier.
* @param DateTime $time
*
* @return self
*
......@@ -367,16 +366,11 @@ interface UploadedFileInterface
/**
* Détermine si ce fichier a le même contenu qu'un autre fichier.
*
* @param UploadedFileInterface $other
*
* @return bool true si les deux fichiers ont le même contenu
*
* @api
*/
public function hasSameContent(UploadedFileInterface $other);
/**
* @param Filesystem $fs
*/
public function setFilesystem(Filesystem $fs): void;
}
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -71,11 +71,7 @@ final class FileManager implements FileManagerInterface
/**
* FileManager constructor.
*
* @param Filesystem $filesystem
* @param EventDispatcherInterface $eventDispatcher
* @param RegistryInterface $doctrine
* @param string $entityClass
* @param LoggerInterface $logger
* @param LoggerInterface $logger
*/
public function __construct(
Filesystem $filesystem,
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -38,10 +38,6 @@ class FileUrlGenerator implements FileUrlGeneratorInterface
*/
protected $tokenManager;
/**
* @param UrlGeneratorInterface $urlGenerator
* @param CsrfTokenManagerInterface $tokenManager
*/
public function __construct(UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $tokenManager)
{
$this->urlGenerator = $urlGenerator;
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -46,10 +46,6 @@ class FileUploadExtension extends Twig_Extension
*/
private $urlGenerator;
/**
* @param TranslatorInterface $translator
* @param FileUrlGeneratorInterface $urlGenerator
*/
public function __construct(TranslatorInterface $translator, FileUrlGeneratorInterface $urlGenerator)
{
$this->translator = $translator;
......@@ -111,7 +107,6 @@ class FileUploadExtension extends Twig_Extension
* Inclut un lien sécurisé qui permet de télécharger le fichier, mais uniquement à l'utilisateur qui a affiché la page.
* Usage : `{{ irstea_uploaded_file(file) }}`.
*
* @param Twig_Environment $env
* @param UploadedFileInterface $file
*
* @return string
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -48,8 +48,6 @@ final class MimeTypeIcon
/**
* @param string $mimeType
*
* @return string|null
*/
public static function getMimeTypeIcon($mimeType): ?string
{
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*
* irstea/file-upload-bundle provides services and widgets to manage user-submitted files.
* Copyright (C) 2015-2018 IRSTEA
* Copyright (C) 2015-2019 IRSTEA
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......
<?php declare(strict_types=1);
/*