Skip to content

Fixes for TYPO3 13, PHP 8.4 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: issue_81
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Command/DeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DeleteCommand extends AbstractCommand

protected LanguageService $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);

Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ResetCommand extends AbstractCommand

protected FileRepository $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);

Expand Down
8 changes: 7 additions & 1 deletion Classes/Form/Element/ShowDeleteFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
*/

use IchHabRecht\Filefill\Repository\FileRepository;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;

#[Autoconfigure(public: true)]
class ShowDeleteFiles extends AbstractFormElement
{
protected LanguageService $languageService;

/**
* Container objects give $nodeFactory down to other containers.
*
Expand All @@ -34,8 +39,9 @@ class ShowDeleteFiles extends AbstractFormElement
*/
public function __construct(
protected readonly FileRepository $fileRepository,
protected readonly LanguageService $languageService
protected readonly LanguageServiceFactory $languageServiceFactory
) {
$this->languageService = $this->languageServiceFactory->createFromUserPreferences($GLOBALS['BE_USER']);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion Classes/Form/Element/ShowMissingFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,29 @@
*/

use Doctrine\DBAL\ParameterType;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;

#[Autoconfigure(public: true)]
class ShowMissingFiles extends AbstractFormElement
{
protected LanguageService $languageService;

/**
* Container objects give $nodeFactory down to other containers.
*
* @param LanguageService|null $languageService
* @throws \InvalidArgumentException
*/
public function __construct(protected readonly LanguageService $languageService)
public function __construct(protected readonly LanguageServiceFactory $languageServiceFactory)
{
$this->languageService = $this->languageServiceFactory->createFromUserPreferences($GLOBALS['BE_USER']);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/Repository/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class FileRepository
protected ResourceFactory $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);
Expand Down
6 changes: 3 additions & 3 deletions Classes/Resource/Handler/DomainResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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);
Expand All @@ -49,7 +49,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');
Expand All @@ -66,7 +66,7 @@ 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, '/');
Expand Down
2 changes: 1 addition & 1 deletion Classes/Resource/RemoteResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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);
Expand Down
4 changes: 2 additions & 2 deletions Classes/Resource/RemoteResourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ 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
* @param string $filePath
* @param FileInterface|null $fileObject
* @return resource|string
*/
public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null);
public function getFile($fileIdentifier, $filePath, ?FileInterface $fileObject = null);
}
3 changes: 3 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
autoconfigure: true
public: false

IchHabRecht\Filefill\:
resource: '../Classes/*'

IchHabRecht\Filefill\EventListener\ResourceStorageInitializationEventListener:
tags:
- name: psr.logger_aware
Expand Down