Skip to content

Commit 70087e1

Browse files
committed
Make phpstan happy
1 parent 76bf8e2 commit 70087e1

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
parameters:
22
level: 8
3+
checkGenericClassInNonGenericObjectType: false
34
treatPhpDocTypesAsCertain: false
45
paths:
56
- src

src/Filesystem/Symfony/HttpKernel/PendingFileValueResolverTrait.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1616
use Symfony\Component\HttpKernel\Exception\HttpException;
17+
use Symfony\Component\Validator\ConstraintViolationList;
1718
use Symfony\Component\Validator\Validator\ValidatorInterface;
1819
use Symfony\Contracts\Service\ServiceProviderInterface;
1920
use Zenstruck\Filesystem\Attribute\UploadedFile;
@@ -27,7 +28,6 @@
2728
trait PendingFileValueResolverTrait
2829
{
2930
public function __construct(
30-
/** @var ServiceProviderInterface<RequestFilesExtractor> $locator */
3131
private ServiceProviderInterface $locator
3232
) {
3333
}
@@ -41,9 +41,9 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
4141

4242
$files = $this->extractor()->extractFilesFromRequest(
4343
$request,
44-
$attribute->path,
45-
$attribute->multiple,
46-
$attribute->image,
44+
(string) $attribute->path,
45+
(bool) $attribute->multiple,
46+
(bool) $attribute->image,
4747
);
4848

4949
if ($files && $attribute->constraints) {
@@ -53,7 +53,9 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
5353
);
5454

5555
if (\count($errors)) {
56-
throw new HttpException($attribute->errorStatus, (string) $errors);
56+
\assert($errors instanceof ConstraintViolationList);
57+
58+
throw new HttpException((int) $attribute->errorStatus, (string) $errors);
5759
}
5860
}
5961

0 commit comments

Comments
 (0)