Skip to content

Commit

Permalink
[TASK] Adapt base code for higher PHP versions and TYPO3 13, references
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois Suter committed Dec 8, 2024
1 parent 0f9777a commit 97db1b9
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 80 deletions.
3 changes: 2 additions & 1 deletion Classes/Controller/LogAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class LogAjaxController
* @param ServerRequestInterface $request
* @param ResponseInterface|null $response
* @return ResponseInterface
* @throws \JsonException
*/
public function getAction(ServerRequestInterface $request, ResponseInterface $response = null): ResponseInterface
public function getAction(ServerRequestInterface $request, ?ResponseInterface $response): ResponseInterface
{
// Process query parameters
$queryParameters = GeneralUtility::makeInstance(
Expand Down
7 changes: 1 addition & 6 deletions Classes/Domain/Model/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ public function __construct()
$this->processedConfiguration = GeneralUtility::makeInstance(ProcessedConfiguration::class);
}

public function __toString()
{
return self::class;
}

/**
* Restructures part of the configuration for easier use during the import process.
*/
Expand Down Expand Up @@ -197,7 +192,7 @@ public function getGeneralConfiguration(): array
* @param array $generalConfiguration
* @param array|null $defaultSteps List of default steps (if null will be guessed by the repository)
*/
public function setGeneralConfiguration(array $generalConfiguration, array $defaultSteps = null): void
public function setGeneralConfiguration(array $generalConfiguration, ?array $defaultSteps): void
{
$this->generalConfiguration = $generalConfiguration;
$stepUtility = GeneralUtility::makeInstance(StepUtility::class);
Expand Down
7 changes: 1 addition & 6 deletions Classes/Domain/Model/Dto/QueryParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,13 @@ class QueryParameters
*
* @param array|null $parameters Query parameters from the AJAX query
*/
public function __construct(array $parameters = null)
public function __construct(?array $parameters)
{
if ($parameters !== null) {
$this->setAllParameters($parameters);
}
}

public function __toString()
{
return self::class;
}

/**
* Receives the raw parameters and set the various member variables after validation and sanitation.
*
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/ConfigurationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function findAllGroups(): array
* @return Configuration
* @throws \Cobweb\ExternalImport\Exception\NoConfigurationException
*/
public function findConfigurationObject(string $table, $index, array $defaultSteps = null): Configuration
public function findConfigurationObject(string $table, $index, ?array $defaultSteps): Configuration
{
$configuration = GeneralUtility::makeInstance(Configuration::class);
$externalConfiguration = $this->findByTableAndIndex($table, $index);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Handler/XmlHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function getXmlValue(\DOMNode $node): string
* @return \DOMNodeList List of found nodes
* @throws \Exception
*/
public function selectNodeWithXpath(\DOMXPath $xPathObject, string $xPath, \DOMNode $context = null): \DOMNodeList
public function selectNodeWithXpath(\DOMXPath $xPathObject, string $xPath, ?\DOMNode $context): \DOMNodeList
{
$resultNodes = $xPathObject->evaluate($xPath, $context);
if ($resultNodes->length > 0) {
Expand Down
17 changes: 9 additions & 8 deletions Classes/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

Expand All @@ -46,7 +47,7 @@ class Importer implements LoggerAwareInterface
/**
* @var array Extension configuration
*/
protected $extensionConfiguration = [];
protected array $extensionConfiguration = [];

/**
* @var array List of result messages
Expand Down Expand Up @@ -214,7 +215,7 @@ public function __toString()
* @param array|null $defaultSteps List of default steps (if null will be guessed by the Configuration object)
* @throws NoConfigurationException
*/
protected function initialize(string $table, $index, array $defaultSteps = null): void
protected function initialize(string $table, $index, ?array $defaultSteps): void
{
// Assign back-reference to reporting utility
$this->reportingUtility->setImporter($this);
Expand Down Expand Up @@ -265,7 +266,7 @@ public function synchronize(string $table, $index): array
$e->getMessage(),
]
),
AbstractMessage::WARNING
ContextualFeedbackSeverity::WARNING->value
);
} catch (NoConfigurationException $e) {
$this->addMessage(
Expand Down Expand Up @@ -401,7 +402,7 @@ public function runSteps(): void
'LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:importAborted',
'external_import'
),
AbstractMessage::WARNING
ContextualFeedbackSeverity::WARNING->value
);
}
$this->currentData = $step->getData();
Expand Down Expand Up @@ -534,7 +535,7 @@ public function debug(string $message, int $severity = 0, $data = null): void
* @param string $text The message itself
* @param int $status Status of the message. Expected is "success", "warning" or "error"
*/
public function addMessage(string $text, int $status = AbstractMessage::ERROR): void
public function addMessage(string $text, int $status = ContextualFeedbackSeverity::ERROR->value): void
{
if (!empty($text)) {
$this->messages[$status][] = $text;
Expand All @@ -557,9 +558,9 @@ public function getMessages(): array
public function resetMessages(): void
{
$this->messages = [
AbstractMessage::ERROR => [],
AbstractMessage::WARNING => [],
AbstractMessage::OK => [],
ContextualFeedbackSeverity::ERROR->value => [],
ContextualFeedbackSeverity::WARNING->value => [],
ContextualFeedbackSeverity::OK->value => [],
];
}

Expand Down
57 changes: 0 additions & 57 deletions ext_tables.php

This file was deleted.

0 comments on commit 97db1b9

Please sign in to comment.