diff --git a/src/Controller/AbstractChunkedController.php b/src/Controller/AbstractChunkedController.php index c169915..3f78149 100644 --- a/src/Controller/AbstractChunkedController.php +++ b/src/Controller/AbstractChunkedController.php @@ -39,7 +39,7 @@ abstract protected function parseChunkedRequest(Request $request): array; * returned array to reassemble the uploaded chunks. * * @param UploadedFile $file - The uploaded chunk - * @param responseInterface $response - A response object + * @param ResponseInterface $response - A response object * @param Request $request - The request object */ protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $response, Request $request): void @@ -84,7 +84,7 @@ protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $re * This function is a helper function which dispatches post chunk upload event. * * @param mixed $uploaded - The uploaded chunk - * @param responseInterface $response - A response object + * @param ResponseInterface $response - A response object * @param Request $request - The request object * @param bool $isLast - True if this is the last chunk, false otherwise */ diff --git a/src/Controller/AbstractController.php b/src/Controller/AbstractController.php index 76ba042..7dbd5b6 100644 --- a/src/Controller/AbstractController.php +++ b/src/Controller/AbstractController.php @@ -164,7 +164,7 @@ protected function dispatchPostEvents(File $uploaded, ResponseInterface $respons } } - protected function validate(FileInterface $file, Request $request, ResponseInterface $response = null): void + protected function validate(FileInterface $file, Request $request, ?ResponseInterface $response = null): void { $event = new ValidationEvent($file, $request, $this->config, $this->type, $response); @@ -204,7 +204,7 @@ protected function getRequest(): Request /** * Event dispatch proxy that avoids using deprecated interfaces. */ - protected function dispatchEvent(Event $event, string $eventName = null): void + protected function dispatchEvent(Event $event, ?string $eventName = null): void { /** @var EventDispatcherInterface $dispatcher */ $dispatcher = $this->container->get('event_dispatcher'); diff --git a/src/DependencyInjection/OneupUploaderExtension.php b/src/DependencyInjection/OneupUploaderExtension.php index af23747..d2e4942 100644 --- a/src/DependencyInjection/OneupUploaderExtension.php +++ b/src/DependencyInjection/OneupUploaderExtension.php @@ -256,7 +256,7 @@ protected function createStorageService(array &$config, string $key, bool $orpha return $storageService; } - protected function registerFilesystem(string $type, string $key, string $class, string $filesystem, string $buffer, string $streamWrapper = null, string $prefix = ''): void + protected function registerFilesystem(string $type, string $key, string $class, string $filesystem, string $buffer, ?string $streamWrapper = null, string $prefix = ''): void { switch ($type) { case 'gaufrette': diff --git a/src/Routing/RouteLoader.php b/src/Routing/RouteLoader.php index 39279c0..cd7658b 100644 --- a/src/Routing/RouteLoader.php +++ b/src/Routing/RouteLoader.php @@ -15,12 +15,12 @@ public function __construct(protected array $controllers) parent::__construct(); } - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { return 'uploader' === $type; } - public function load(mixed $resource, string $type = null): RouteCollection + public function load(mixed $resource, ?string $type = null): RouteCollection { $routes = new RouteCollection(); $separator = '::'; diff --git a/src/Uploader/Chunk/Storage/FlysystemStorage.php b/src/Uploader/Chunk/Storage/FlysystemStorage.php index f28bd0c..5f75d47 100644 --- a/src/Uploader/Chunk/Storage/FlysystemStorage.php +++ b/src/Uploader/Chunk/Storage/FlysystemStorage.php @@ -37,7 +37,7 @@ public function addChunk(string $uuid, int $index, UploadedFile $chunk, string $ /** * @throws FilesystemException */ - public function clear(int $maxAge, string $prefix = null): void + public function clear(int $maxAge, ?string $prefix = null): void { $prefix = $prefix ?: $this->prefix; $matches = $this->filesystem->listContents($prefix, true); diff --git a/src/Uploader/Chunk/Storage/GaufretteStorage.php b/src/Uploader/Chunk/Storage/GaufretteStorage.php index 345f028..12bee41 100644 --- a/src/Uploader/Chunk/Storage/GaufretteStorage.php +++ b/src/Uploader/Chunk/Storage/GaufretteStorage.php @@ -42,7 +42,7 @@ public function __construct(FilesystemInterface $filesystem, int $bufferSize, pr * $prefix must be passable so it can clean the orphanage too * as it is forced to be the same filesystem. */ - public function clear(int $maxAge, string $prefix = null): void + public function clear(int $maxAge, ?string $prefix = null): void { $prefix = $prefix ?: $this->prefix; $matches = $this->filesystem->listKeys($prefix); diff --git a/src/Uploader/Response/FineUploaderResponse.php b/src/Uploader/Response/FineUploaderResponse.php index b37b310..34eb0bc 100644 --- a/src/Uploader/Response/FineUploaderResponse.php +++ b/src/Uploader/Response/FineUploaderResponse.php @@ -42,7 +42,7 @@ public function getSuccess(): bool return $this->success; } - public function setError(string $msg = null): self + public function setError(?string $msg = null): self { $this->error = $msg; diff --git a/src/Uploader/Response/MooUploadResponse.php b/src/Uploader/Response/MooUploadResponse.php index 3a5cad9..c273aa9 100644 --- a/src/Uploader/Response/MooUploadResponse.php +++ b/src/Uploader/Response/MooUploadResponse.php @@ -42,7 +42,7 @@ public function getId(): int|string|null return $this->id; } - public function setName(string $name = null): self + public function setName(?string $name = null): self { $this->name = $name; diff --git a/src/Uploader/Storage/FilesystemOrphanageStorage.php b/src/Uploader/Storage/FilesystemOrphanageStorage.php index 83cfaa1..8dfce6a 100644 --- a/src/Uploader/Storage/FilesystemOrphanageStorage.php +++ b/src/Uploader/Storage/FilesystemOrphanageStorage.php @@ -34,7 +34,7 @@ public function __construct(protected StorageInterface $storage, RequestStack $r * * @return FileInterface|File */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { if (!$this->session instanceof SessionInterface || !$this->session->isStarted()) { throw new \RuntimeException('You need a running session in order to run the Orphanage.'); @@ -43,7 +43,7 @@ public function upload($file, string $name, string $path = null) return parent::upload($file, $name, $this->getPath()); } - public function uploadFiles(array $files = null): array + public function uploadFiles(?array $files = null): array { try { if (null === $files) { diff --git a/src/Uploader/Storage/FilesystemStorage.php b/src/Uploader/Storage/FilesystemStorage.php index a67f7a2..d7cc420 100644 --- a/src/Uploader/Storage/FilesystemStorage.php +++ b/src/Uploader/Storage/FilesystemStorage.php @@ -19,7 +19,7 @@ public function __construct(protected string $directory) * * @return FileInterface|File */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { $path = null === $path ? $name : sprintf('%s/%s', $path, $name); $path = sprintf('%s/%s', $this->directory, $path); diff --git a/src/Uploader/Storage/FlysystemOrphanageStorage.php b/src/Uploader/Storage/FlysystemOrphanageStorage.php index 9f51f63..2d771c4 100644 --- a/src/Uploader/Storage/FlysystemOrphanageStorage.php +++ b/src/Uploader/Storage/FlysystemOrphanageStorage.php @@ -41,7 +41,7 @@ public function __construct(protected StorageInterface $storage, RequestStack $r * * @return FileInterface|SymfonyFile */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { if (!$this->session instanceof SessionInterface || !$this->session->isStarted()) { throw new \RuntimeException('You need a running session in order to run the Orphanage.'); @@ -53,7 +53,7 @@ public function upload($file, string $name, string $path = null) /** * @throws FilesystemException */ - public function uploadFiles(array $files = null): array + public function uploadFiles(?array $files = null): array { try { if (null === $files) { diff --git a/src/Uploader/Storage/FlysystemStorage.php b/src/Uploader/Storage/FlysystemStorage.php index c689587..4187b4f 100644 --- a/src/Uploader/Storage/FlysystemStorage.php +++ b/src/Uploader/Storage/FlysystemStorage.php @@ -25,7 +25,7 @@ public function __construct(private FilesystemOperator $filesystem, protected in * * @return FileInterface|SymfonyFile */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { $path = null === $path ? $name : sprintf('%s/%s', $path, $name); diff --git a/src/Uploader/Storage/GaufretteOrphanageStorage.php b/src/Uploader/Storage/GaufretteOrphanageStorage.php index bac1a92..2f4a2e7 100644 --- a/src/Uploader/Storage/GaufretteOrphanageStorage.php +++ b/src/Uploader/Storage/GaufretteOrphanageStorage.php @@ -37,7 +37,7 @@ public function __construct(protected StorageInterface $storage, RequestStack $r * * @return FileInterface|GaufretteFile */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { if (!$this->session instanceof SessionInterface || !$this->session->isStarted()) { throw new \RuntimeException('You need a running session in order to run the Orphanage.'); @@ -46,7 +46,7 @@ public function upload($file, string $name, string $path = null) return parent::upload($file, $name, $this->getPath()); } - public function uploadFiles(array $files = null): array + public function uploadFiles(?array $files = null): array { try { if (null === $files) { diff --git a/src/Uploader/Storage/GaufretteStorage.php b/src/Uploader/Storage/GaufretteStorage.php index ea2cd83..aea8128 100644 --- a/src/Uploader/Storage/GaufretteStorage.php +++ b/src/Uploader/Storage/GaufretteStorage.php @@ -33,7 +33,7 @@ public function __construct(FilesystemInterface $filesystem, int $bufferSize, pr * * @return FileInterface|GaufretteFile */ - public function upload($file, string $name, string $path = null) + public function upload($file, string $name, ?string $path = null) { $path = null === $path ? $name : sprintf('%s/%s', $path, $name); diff --git a/src/Uploader/Storage/OrphanageStorageInterface.php b/src/Uploader/Storage/OrphanageStorageInterface.php index 21c6c8d..b10b26a 100644 --- a/src/Uploader/Storage/OrphanageStorageInterface.php +++ b/src/Uploader/Storage/OrphanageStorageInterface.php @@ -6,5 +6,5 @@ interface OrphanageStorageInterface extends StorageInterface { - public function uploadFiles(array $files = null): array; + public function uploadFiles(?array $files = null): array; } diff --git a/src/Uploader/Storage/StorageInterface.php b/src/Uploader/Storage/StorageInterface.php index 0259db7..2c75db1 100644 --- a/src/Uploader/Storage/StorageInterface.php +++ b/src/Uploader/Storage/StorageInterface.php @@ -16,5 +16,5 @@ interface StorageInterface * * @return FileInterface|File */ - public function upload($file, string $name, string $path = null); + public function upload($file, string $name, ?string $path = null); } diff --git a/tests/Uploader/File/GaufretteFileTest.php b/tests/Uploader/File/GaufretteFileTest.php index 1febc13..a8fa2e0 100644 --- a/tests/Uploader/File/GaufretteFileTest.php +++ b/tests/Uploader/File/GaufretteFileTest.php @@ -16,7 +16,7 @@ class GaufretteFileTest extends FileTest protected function setUp(): void { $adapter = new Adapter(sys_get_temp_dir(), true); - $filesystem = new GaufretteFilesystem($adapter); + $filesystem = new GaufretteFileSystem($adapter); $map = StreamWrapper::getFilesystemMap(); $map->set('oneup', $filesystem);