Skip to content

Commit

Permalink
Fix PHP Stan and PHP MD
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Jun 25, 2024
1 parent 144f56e commit f61e936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/Controller/BrowserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use MonsieurBiz\SyliusMediaManagerPlugin\Exception\InvalidTypeException;
use MonsieurBiz\SyliusMediaManagerPlugin\Helper\FileHelperInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -90,6 +91,9 @@ public function chooseAction(
return new JsonResponse(['path' => $fileHelper->cleanPath($path)]);
}

/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function uploadAction(
FileHelperInterface $fileHelper,
Request $request,
Expand All @@ -99,7 +103,7 @@ public function uploadAction(
$folder = (string) $request->request->get('folder', '');
$file = $request->files->get('file');

if (null === $file) {
if (null === $file || !($file instanceof UploadedFile)) {
return new JsonResponse([
'error' => $translator->trans('monsieurbiz_sylius_media_manager.error.cannot_upload_file'),
], Response::HTTP_BAD_REQUEST);
Expand Down
8 changes: 4 additions & 4 deletions src/Twig/Extension/FilterExtensionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public function __construct(
/**
* Allow us to have multiple data roots for svg images.
*
* @param mixed $path
* @param mixed $filter
* @param mixed|null $resolver
* @param mixed $referenceType
* @param string $path
* @param string $filter
* @param string|null $resolver
* @param int $referenceType
*/
public function filter(
$path,
Expand Down

0 comments on commit f61e936

Please sign in to comment.