Skip to content

Commit f61e936

Browse files
committed
Fix PHP Stan and PHP MD
1 parent 144f56e commit f61e936

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/Controller/BrowserController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use MonsieurBiz\SyliusMediaManagerPlugin\Exception\InvalidTypeException;
2727
use MonsieurBiz\SyliusMediaManagerPlugin\Helper\FileHelperInterface;
2828
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
29+
use Symfony\Component\HttpFoundation\File\UploadedFile;
2930
use Symfony\Component\HttpFoundation\JsonResponse;
3031
use Symfony\Component\HttpFoundation\Request;
3132
use Symfony\Component\HttpFoundation\Response;
@@ -90,6 +91,9 @@ public function chooseAction(
9091
return new JsonResponse(['path' => $fileHelper->cleanPath($path)]);
9192
}
9293

94+
/**
95+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
96+
*/
9397
public function uploadAction(
9498
FileHelperInterface $fileHelper,
9599
Request $request,
@@ -99,7 +103,7 @@ public function uploadAction(
99103
$folder = (string) $request->request->get('folder', '');
100104
$file = $request->files->get('file');
101105

102-
if (null === $file) {
106+
if (null === $file || !($file instanceof UploadedFile)) {
103107
return new JsonResponse([
104108
'error' => $translator->trans('monsieurbiz_sylius_media_manager.error.cannot_upload_file'),
105109
], Response::HTTP_BAD_REQUEST);

src/Twig/Extension/FilterExtensionDecorator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function __construct(
3636
/**
3737
* Allow us to have multiple data roots for svg images.
3838
*
39-
* @param mixed $path
40-
* @param mixed $filter
41-
* @param mixed|null $resolver
42-
* @param mixed $referenceType
39+
* @param string $path
40+
* @param string $filter
41+
* @param string|null $resolver
42+
* @param int $referenceType
4343
*/
4444
public function filter(
4545
$path,

0 commit comments

Comments
 (0)