diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 5ed6c21..39c0f69 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,6 +1,6 @@ name: 🏃 dev tests -on: [ push, pull_request ] +on: [ push, pull_request, workflow_dispatch ] jobs: compute: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3de262..f4bcb8e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: 🏃 tests -on: [ push, pull_request, workflow_call ] +on: [ push, pull_request, workflow_call, workflow_dispatch ] jobs: compute: diff --git a/Classes/Command/DeleteCommand.php b/Classes/Command/DeleteCommand.php index 614ee68..941f5a5 100644 --- a/Classes/Command/DeleteCommand.php +++ b/Classes/Command/DeleteCommand.php @@ -23,7 +23,7 @@ class DeleteCommand extends AbstractCommand */ protected $languageService; - public function __construct(string $name = null, FileRepository $fileRepository = null, $languageService = null) + public function __construct(?string $name = null, ?FileRepository $fileRepository = null, $languageService = null) { parent::__construct($name); diff --git a/Classes/Command/ResetCommand.php b/Classes/Command/ResetCommand.php index 62349c2..33904e2 100644 --- a/Classes/Command/ResetCommand.php +++ b/Classes/Command/ResetCommand.php @@ -24,7 +24,7 @@ class ResetCommand extends AbstractCommand */ protected $fileRepository; - public function __construct(string $name = null, Connection $connection = null, FileRepository $fileRepository = null) + public function __construct(?string $name = null, ?Connection $connection = null, ?FileRepository $fileRepository = null) { parent::__construct($name); diff --git a/Classes/Form/Element/ShowDeleteFiles.php b/Classes/Form/Element/ShowDeleteFiles.php index aefdff7..7c1e4ce 100644 --- a/Classes/Form/Element/ShowDeleteFiles.php +++ b/Classes/Form/Element/ShowDeleteFiles.php @@ -45,7 +45,7 @@ class ShowDeleteFiles extends AbstractFormElement * @param FileRepository|null $fileRepository * @param LanguageService|null $languageService */ - public function __construct(NodeFactory $nodeFactory, array $data, FileRepository $fileRepository = null, $languageService = null) + public function __construct(NodeFactory $nodeFactory, array $data, ?FileRepository $fileRepository = null, $languageService = null) { parent::__construct($nodeFactory, $data); $this->fileRepository = $fileRepository ?: GeneralUtility::makeInstance(FileRepository::class); diff --git a/Classes/Hooks/DeleteFiles.php b/Classes/Hooks/DeleteFiles.php index bbc8693..c7bf643 100644 --- a/Classes/Hooks/DeleteFiles.php +++ b/Classes/Hooks/DeleteFiles.php @@ -29,7 +29,7 @@ class DeleteFiles protected $fileRepository; public function __construct( - FileRepository $fileRepository = null + ?FileRepository $fileRepository = null ) { $this->fileRepository = $fileRepository ?: GeneralUtility::makeInstance(FileRepository::class); } diff --git a/Classes/Repository/FileRepository.php b/Classes/Repository/FileRepository.php index 060dccd..893212f 100644 --- a/Classes/Repository/FileRepository.php +++ b/Classes/Repository/FileRepository.php @@ -42,9 +42,9 @@ class FileRepository protected $resourceFactory; public function __construct( - Connection $connection = null, - ProcessedFileRepository $processedFileRepository = null, - ResourceFactory $resourceFactory = null + ?Connection $connection = null, + ?ProcessedFileRepository $processedFileRepository = null, + ?ResourceFactory $resourceFactory = null ) { $this->connection = $connection ?: GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('sys_file'); $this->processedFileRepository = $processedFileRepository ?: GeneralUtility::makeInstance(ProcessedFileRepository::class); diff --git a/Classes/Resource/Handler/DomainResource.php b/Classes/Resource/Handler/DomainResource.php index 5dfcdf5..70e5843 100644 --- a/Classes/Resource/Handler/DomainResource.php +++ b/Classes/Resource/Handler/DomainResource.php @@ -41,7 +41,7 @@ class DomainResource implements RemoteResourceInterface * @param string $configuration * @param RequestFactory $requestFactory */ - public function __construct($configuration, RequestFactory $requestFactory = null) + public function __construct($configuration, ?RequestFactory $requestFactory = null) { $this->requestFactory = $requestFactory ?: GeneralUtility::makeInstance(RequestFactory::class); $urlParts = parse_url((string)$configuration); @@ -55,7 +55,7 @@ public function __construct($configuration, RequestFactory $requestFactory = nul * @param FileInterface|null $fileObject * @return bool */ - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { try { $response = $this->requestFactory->request($this->url . ltrim($filePath, '/'), 'HEAD'); @@ -72,14 +72,14 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface|null $fileObject * @return resource|string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { try { $fileName = $this->url . ltrim($filePath, '/'); return @fopen($fileName, 'r') ?: $this->requestFactory->request($fileName)->getBody()->getContents(); } catch (RequestException $e) { - return false; + return ''; } } } diff --git a/Classes/Resource/Handler/ImageBuilderResource.php b/Classes/Resource/Handler/ImageBuilderResource.php index 423fe18..5eea828 100644 --- a/Classes/Resource/Handler/ImageBuilderResource.php +++ b/Classes/Resource/Handler/ImageBuilderResource.php @@ -61,7 +61,7 @@ public function __construct($configuration) * @param FileInterface $fileObject * @return bool */ - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { return $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'] && $fileObject instanceof FileInterface @@ -74,7 +74,7 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface $fileObject * @return string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { $content = ''; diff --git a/Classes/Resource/Handler/PlaceholdResource.php b/Classes/Resource/Handler/PlaceholdResource.php index c89ffa0..863892c 100644 --- a/Classes/Resource/Handler/PlaceholdResource.php +++ b/Classes/Resource/Handler/PlaceholdResource.php @@ -48,7 +48,7 @@ class PlaceholdResource implements RemoteResourceInterface */ protected $url = 'https://placehold.co/'; - public function __construct($_, RequestFactory $requestFactory = null) + public function __construct($_, ?RequestFactory $requestFactory = null) { $this->requestFactory = $requestFactory ?: GeneralUtility::makeInstance(RequestFactory::class); } @@ -59,7 +59,7 @@ public function __construct($_, RequestFactory $requestFactory = null) * @param FileInterface $fileObject * @return bool */ - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { return $fileObject instanceof FileInterface && in_array($fileObject->getExtension(), $this->allowedFileExtensions, true); @@ -71,7 +71,7 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface $fileObject * @return string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { try { $fileExtension = $fileObject->getExtension(); @@ -85,7 +85,7 @@ public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = return $response->getBody()->getContents(); } catch (RequestException $e) { - return false; + return ''; } } } diff --git a/Classes/Resource/Handler/PlaceholderResource.php b/Classes/Resource/Handler/PlaceholderResource.php index 082ee02..b0bc223 100644 --- a/Classes/Resource/Handler/PlaceholderResource.php +++ b/Classes/Resource/Handler/PlaceholderResource.php @@ -21,7 +21,7 @@ class PlaceholderResource extends PlaceholdResource { - public function __construct($_, RequestFactory $requestFactory = null) + public function __construct($_, ?RequestFactory $requestFactory = null) { trigger_error( 'As the service placeholder.com was closed down, using this class is deprecated. Please use the' . diff --git a/Classes/Resource/Handler/StaticFileResource.php b/Classes/Resource/Handler/StaticFileResource.php index d8d5469..9653241 100644 --- a/Classes/Resource/Handler/StaticFileResource.php +++ b/Classes/Resource/Handler/StaticFileResource.php @@ -52,7 +52,7 @@ public function __construct($configuration) $this->configuration = $this->prepareConfiguration($configuration); } - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { return true; } @@ -63,7 +63,7 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface $fileObject * @return string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { return $this->getFileContent($fileIdentifier, $this->configuration); } diff --git a/Classes/Resource/Handler/SysDomainResource.php b/Classes/Resource/Handler/SysDomainResource.php index 1980d48..2e2c13f 100644 --- a/Classes/Resource/Handler/SysDomainResource.php +++ b/Classes/Resource/Handler/SysDomainResource.php @@ -38,7 +38,7 @@ class SysDomainResource implements RemoteResourceInterface * @param string $configuration * @param DomainResourceRepository $domainResourceRepository */ - public function __construct($configuration, DomainResourceRepository $domainResourceRepository = null) + public function __construct($configuration, ?DomainResourceRepository $domainResourceRepository = null) { if ($domainResourceRepository === null) { $domainResourceRepository = GeneralUtility::makeInstance(DomainResourceRepository::class); @@ -52,7 +52,7 @@ public function __construct($configuration, DomainResourceRepository $domainReso * @param FileInterface|null $fileObject * @return bool */ - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { if (!isset(static::$fileIdentifierCache[$fileIdentifier])) { static::$fileIdentifierCache[$fileIdentifier] = null; @@ -73,7 +73,7 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface|null $fileObject * @return string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null) + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null) { return static::$fileIdentifierCache[$fileIdentifier]->getFile($fileIdentifier, $filePath); } diff --git a/Classes/Resource/RemoteResourceCollection.php b/Classes/Resource/RemoteResourceCollection.php index 0f552c9..d27556f 100644 --- a/Classes/Resource/RemoteResourceCollection.php +++ b/Classes/Resource/RemoteResourceCollection.php @@ -61,7 +61,7 @@ class RemoteResourceCollection implements LoggerAwareInterface * @param ResourceFactory|null $resourceFactory * @param FileRepository|null $fileRepository */ - public function __construct(array $resources, ResourceFactory $resourceFactory = null, FileRepository $fileRepository = null) + public function __construct(array $resources, ?ResourceFactory $resourceFactory = null, ?FileRepository $fileRepository = null) { $this->resources = $resources; $this->resourceFactory = $resourceFactory ?: GeneralUtility::makeInstance(ResourceFactory::class); diff --git a/Classes/Resource/RemoteResourceInterface.php b/Classes/Resource/RemoteResourceInterface.php index 6d1dd67..b72e206 100644 --- a/Classes/Resource/RemoteResourceInterface.php +++ b/Classes/Resource/RemoteResourceInterface.php @@ -27,7 +27,7 @@ interface RemoteResourceInterface * @param FileInterface|null $fileObject * @return bool */ - public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null); + public function hasFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null); /** * @param string $fileIdentifier @@ -35,5 +35,5 @@ public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = * @param FileInterface|null $fileObject * @return resource|string */ - public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null); + public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null); }