Skip to content

Commit

Permalink
Widen typehint (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
bytehead committed Apr 4, 2024
1 parent de4fb37 commit 470b11e
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Controller/AbstractController.php
Expand Up @@ -100,10 +100,8 @@ protected function getFiles(FileBag $bag): array
* function in the implemented Controller.
*
* Note: The return value differs when
*
* @param File $file The file to upload
*/
protected function handleUpload(File $file, ResponseInterface $response, Request $request): void
protected function handleUpload(FileInterface|File $file, ResponseInterface $response, Request $request): void
{
// wrap the file if it is not done yet which can only happen
// if it wasn't a chunked upload, in which case it is definitely
Expand All @@ -130,12 +128,8 @@ protected function handleUpload(File $file, ResponseInterface $response, Request

/**
* This function is a helper function which dispatches pre upload event.
*
* @param FileInterface $uploaded the uploaded file
* @param ResponseInterface $response a response object
* @param Request $request the request object
*/
protected function dispatchPreUploadEvent(FileInterface $uploaded, ResponseInterface $response, Request $request): void
protected function dispatchPreUploadEvent(FileInterface|File $uploaded, ResponseInterface $response, Request $request): void
{
// dispatch pre upload event (both the specific and the general)
$preUploadEvent = new PreUploadEvent($uploaded, $response, $request, $this->type, $this->config);
Expand All @@ -146,10 +140,8 @@ protected function dispatchPreUploadEvent(FileInterface $uploaded, ResponseInter
/**
* This function is a helper function which dispatches post upload
* and post persist events.
*
* @param File $uploaded the uploaded file
*/
protected function dispatchPostEvents(File $uploaded, ResponseInterface $response, Request $request): void
protected function dispatchPostEvents(FileInterface|File $uploaded, ResponseInterface $response, Request $request): void
{
// dispatch post upload event (both the specific and the general)
$postUploadEvent = new PostUploadEvent($uploaded, $response, $request, $this->type, $this->config);
Expand All @@ -164,7 +156,7 @@ protected function dispatchPostEvents(File $uploaded, ResponseInterface $respons
}
}

protected function validate(FileInterface $file, Request $request, ?ResponseInterface $response = null): void
protected function validate(FileInterface|File $file, Request $request, ?ResponseInterface $response = null): void
{
$event = new ValidationEvent($file, $request, $this->config, $this->type, $response);

Expand Down

0 comments on commit 470b11e

Please sign in to comment.