Skip to content

Commit

Permalink
Make phpstan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lustmored committed Mar 3, 2023
1 parent 76bf8e2 commit 70087e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
level: 8
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
paths:
- src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Service\ServiceProviderInterface;
use Zenstruck\Filesystem\Attribute\UploadedFile;
Expand All @@ -27,7 +28,6 @@
trait PendingFileValueResolverTrait
{
public function __construct(
/** @var ServiceProviderInterface<RequestFilesExtractor> $locator */
private ServiceProviderInterface $locator
) {
}
Expand All @@ -41,9 +41,9 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable

$files = $this->extractor()->extractFilesFromRequest(
$request,
$attribute->path,
$attribute->multiple,
$attribute->image,
(string) $attribute->path,
(bool) $attribute->multiple,
(bool) $attribute->image,
);

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

if (\count($errors)) {
throw new HttpException($attribute->errorStatus, (string) $errors);
\assert($errors instanceof ConstraintViolationList);

throw new HttpException((int) $attribute->errorStatus, (string) $errors);
}
}

Expand Down

0 comments on commit 70087e1

Please sign in to comment.