Skip to content

Commit

Permalink
[REFACTOR] Run typo3 rector for TYPO3 v12
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Dec 19, 2024
1 parent 7c9736e commit 3fe2096
Show file tree
Hide file tree
Showing 58 changed files with 133 additions and 151 deletions.
4 changes: 2 additions & 2 deletions Classes/Command/Foreign/Status/AllCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class AllCommand extends Command
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectCommandRegistry(CommandRegistry $commandRegistry): void
public function __construct(\TYPO3\CMS\Core\Console\CommandRegistry $cmdRegistry)
{
$this->cmdRegistry = $commandRegistry;
$this->cmdRegistry = $cmdRegistry;
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
{
$pageId = $input->getArgument(self::ARG_PAGE_ID);
if (null !== $pageId && $pageId !== (string)(int)$pageId) {
throw new InvalidPageIdArgumentTypeException($pageId);
throw new InvalidPageIdArgumentTypeException($pageId, 7622214463);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/Component/ConfigContainer/Node/AbstractNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function merge(AbstractNode $node): void
} elseif (is_array($this->default) && is_array($node->default)) {
$this->default = $this->mergeArrays($this->default, $node->default);
} else {
throw new In2publishCoreException('Can not merge properties');
throw new In2publishCoreException('Can not merge properties', 4831975042);
}
}
foreach ($node->getNodePath('') as $key => $newNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function hasDynamicValueProviderForKey(string $key): bool
public function getDynamicValueProviderByKey(string $key): DynamicValueProviderInterface
{
if (!$this->hasDynamicValueProviderForKey($key)) {
throw new InvalidDynamicValueProviderKeyException($key);
throw new InvalidDynamicValueProviderKeyException($key, 3286615330);
}
return $this->providers[$key];
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/Component/ConfigContainer/Provider/FileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class FileProvider implements ProviderServiceInterface, LoggerAwareInterface
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectExtensionConfiguration(ExtensionConfiguration $extensionConfiguration): void
public function __construct(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration $extConf)
{
$this->extConf = $extensionConfiguration->get('in2publish_core');
$this->extConf = $extConf->get('in2publish_core');
}

public function isAvailable(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FalDriverService
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectDriverRegistry(DriverRegistry $driverRegistry): void
public function __construct(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry $driverRegistry)
{
$this->driverRegistry = $driverRegistry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractProcessor implements TcaPreProcessor
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectContainer(ContainerInterface $container): void
public function __construct(\Psr\Container\ContainerInterface $container)
{
$this->container = $container;
}
Expand Down Expand Up @@ -63,7 +63,7 @@ public function injectContainer(ContainerInterface $container): void
public function getType(): string
{
if (!isset($this->type)) {
throw new MissingPreProcessorTypeException($this);
throw new MissingPreProcessorTypeException($this, 6254937462);
}
return $this->type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function finish(): void
$configuration = json_encode($instruction->getConfiguration(), JSON_THROW_ON_ERROR);
$data[] = [
'request_token' => $requestToken,
'crdate' => $GLOBALS['EXEC_TIME'],
'tstamp' => $GLOBALS['EXEC_TIME'],
'crdate' => \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('date', 'timestamp'),
'tstamp' => \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('date', 'timestamp'),
'instruction' => $class,
'configuration' => $configuration,
];
Expand All @@ -72,7 +72,7 @@ public function finish(): void
$request = new RemoteCommandRequest('in2publish_core:core:falpublisher', [], [implode(',', $requestTokens)]);
$response = $this->remoteCommandDispatcher->dispatch($request);
if (!$response->isSuccessful()) {
throw new FalPublisherExecutionFailedException($response);
throw new FalPublisherExecutionFailedException($response, 1818232345);
}
}
}
2 changes: 1 addition & 1 deletion Classes/Component/Core/Publisher/PublisherCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function publish(Record $record): void
}
}

throw new PublisherNotFoundException($record);
throw new PublisherNotFoundException($record, 4303904258);
}

public function finish(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function createFactoryForTable(string $table): DatabaseRecordFactory
}
}
}
throw new MissingDatabaseRecordFactoryException($table);
throw new MissingDatabaseRecordFactoryException($table, 2448336290);
}
}
2 changes: 1 addition & 1 deletion Classes/Component/Core/Record/Factory/RecordFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RecordFactory
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectDatabaseRecordFactoryFactory(DatabaseRecordFactoryFactory $databaseRecordFactoryFactory): void
public function __construct(\In2code\In2publishCore\Component\Core\Record\Factory\DatabaseRecordFactoryFactory $databaseRecordFactoryFactory)
{
$this->databaseRecordFactoryFactory = $databaseRecordFactoryFactory;
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/Component/Core/Record/Model/AbstractRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function getPropsBySide(string $side): array
case Record::FOREIGN:
return $this->foreignProps;
}
throw new LogicException("Side $side is unknown");
throw new LogicException("Side $side is unknown", 7470106618);
}

public function addChild(Record $record): void
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getParents(): array
public function setTranslationParent(Record $translationParent): void
{
if (null !== $this->translationParent) {
throw new LogicException('Can not add more than one translation parent');
throw new LogicException('Can not add more than one translation parent', 2232766893);
}
$this->translationParent = $translationParent;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Component/Core/Record/Model/FolderRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getId(): string

public function getForeignIdentificationProps(): array
{
throw new LogicException('NOT IMPLEMENTED');
throw new LogicException('NOT IMPLEMENTED', 3424165576);
return $this->getId();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class ExcludedTablesService
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectConfigContainer(ConfigContainer $configContainer): void
public function __construct(\In2code\In2publishCore\Component\ConfigContainer\ConfigContainer $excludeRelatedTables)
{
$this->excludeRelatedTables = $configContainer->get('excludeRelatedTables');
$this->excludeRelatedTables = $excludeRelatedTables;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Component/Core/Service/RelevantTablesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RelevantTablesService
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectTableContentService(TableContentService $tableContentService): void
public function __construct(\In2code\In2publishCore\Component\Core\Service\Database\TableContentService $tableContentService)
{
$this->tableContentService = $tableContentService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ class TaskRepository
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectTaskFactory(TaskFactory $taskFactory): void
{
$this->taskFactory = $taskFactory;
}

public function __construct()
public function __construct(\In2code\In2publishCore\Component\PostPublishTaskExecution\Domain\Factory\TaskFactory $taskFactory)
{
$this->creationDate = (new DateTime('now'))->format('Y-m-d H:i:s');
$this->taskFactory = $taskFactory;
}

public function add(AbstractTask $task): void
Expand Down Expand Up @@ -94,10 +90,7 @@ public function findByExecutionBegin(DateTime $executionBegin = null): array
$formattedExecutionBegin = $query->createNamedParameter($executionBegin->format('Y-m-d H:i:s'));
$predicates = $query->expr()->like('execution_begin', $formattedExecutionBegin);
} else {
$predicates = $query->expr()->orX(
$query->expr()->isNull('execution_begin'),
$query->expr()->like('execution_begin', $query->createNamedParameter('0000-00-00 00:00:00')),
);
$predicates = $query->expr()->or($query->expr()->isNull('execution_begin'), $query->expr()->like('execution_begin', $query->createNamedParameter('0000-00-00 00:00:00')));
}

$taskObjects = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function runTasks(): void
'exit_status' => $response->getExitStatus(),
],
);
throw new TaskExecutionFailedException($response);
throw new TaskExecutionFailedException($response, 9541522580);
}
$this->logger->info('Task execution results', ['output' => $response->getOutput()]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ExecuteCommand extends Command implements LoggerAwareInterface
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectEnvelopeDispatcher(EnvelopeDispatcher $envelopeDispatcher): void
public function __construct(\In2code\In2publishCore\Component\RemoteProcedureCall\EnvelopeDispatcher $envelopeDispatcher)
{
$this->envelopeDispatcher = $envelopeDispatcher;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function getStorageDriver(array $request): DriverInterface
{
$storage = $this->resourceFactory->getStorageObject($request['storage']);
if (!$storage->isOnline()) {
throw new StorageIsOfflineException((int)$request['storage']);
throw new StorageIsOfflineException((int)$request['storage'], 4307401617);
}
$driverReflection = new ReflectionProperty(get_class($storage), 'driver');
$driverReflection->setAccessible(true);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Component/RemoteProcedureCall/Letterbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Letterbox implements LoggerAwareInterface, SingletonInterface
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectConfigContainer(ConfigContainer $configContainer): void
public function __construct(\In2code\In2publishCore\Component\ConfigContainer\ConfigContainer $keepEnvelopes)
{
// Type cast this value because this class is also used on foreign and there's no such setting.
$this->keepEnvelopes = (bool)$configContainer->get('debug.keepEnvelopes');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ class AssetTransmitter implements SingletonInterface, LoggerAwareInterface
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectConfigContainer(ConfigContainer $configContainer): void
public function __construct(\In2code\In2publishCore\Component\ConfigContainer\ConfigContainer $foreignVarPath)
{
$this->foreignVarPath = rtrim($configContainer->get('foreign.varPath'), '/');
$this->fileTransmissionTimeout = (int)$configContainer->get('adapter.local.fileTransmissionTimeout');
$this->foreignVarPath = $foreignVarPath;
}

/**
Expand All @@ -72,7 +71,7 @@ public function transmitTemporaryFile(string $source): string

if (!file_exists($source)) {
$this->logger->error('File does not exist', ['source' => $source]);
throw new FileMissingException($source);
throw new FileMissingException($source, 3239271462);
}

$identifierHash = hash('sha1', $source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SshAdapter extends SshBaseAdapter implements AdapterInterface
* @codeCoverageIgnore
* @noinspection PhpUnused
*/
public function injectForeignEnvironmentService(ForeignEnvironmentService $foreignEnvironmentService): void
public function __construct(\In2code\In2publishCore\Service\Environment\ForeignEnvironmentService $foreignEnvironmentService)
{
$this->foreignEnvironmentService = $foreignEnvironmentService;
}
Expand Down
24 changes: 12 additions & 12 deletions Classes/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function indexAction(): ResponseInterface
parse_str($uri->getQuery(), $queryParts);
$queryParts['id'] = $e->getRootLevelCombinedIdentifier();
$uri = $uri->withQuery(http_build_query($queryParts));
$this->redirectToUri($uri);
return $this->redirectToUri($uri);
}

if (null !== $recordTree) {
Expand Down Expand Up @@ -139,20 +139,20 @@ public function publishFolderAction(string $combinedIdentifier, bool $skipNotifi
$this->publisherService->publish($publishingContext);
if (!$skipNotification) {
$this->addFlashMessage(
LocalizationUtility::translate('file_publishing.folder', 'in2publish_core', [$combinedIdentifier]),
LocalizationUtility::translate('file_publishing.success', 'in2publish_core'),
LocalizationUtility::translate('file_publishing.folder', 'In2publishCore', [$combinedIdentifier]),
LocalizationUtility::translate('file_publishing.success', 'In2publishCore'),
);
}
} catch (Throwable $exception) {
if (!$skipNotification) {
$this->addFlashMessage(
LocalizationUtility::translate(
'file_publishing.failure.folder',
'in2publish_core',
'In2publishCore',
[$combinedIdentifier],
),
LocalizationUtility::translate('file_publishing.failure', 'in2publish_core'),
AbstractMessage::ERROR,
LocalizationUtility::translate('file_publishing.failure', 'In2publishCore'),
\TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR,
);
}
}
Expand All @@ -175,23 +175,23 @@ public function publishFileAction(string $combinedIdentifier, bool $skipNotifica
$this->addFlashMessage(
LocalizationUtility::translate(
'file_publishing.file',
'in2publish_core',
'In2publishCore',
[$combinedIdentifier],
),
LocalizationUtility::translate('file_publishing.success', 'in2publish_core'),
LocalizationUtility::translate('file_publishing.success', 'In2publishCore'),
);
}
} catch (Throwable $e) {
if (!$skipNotification) {
$this->addFlashMessage(
LocalizationUtility::translate(
'file_publishing.failure.file',
'in2publish_core',
'In2publishCore',
[$combinedIdentifier],
)
. $e->getMessage(),
LocalizationUtility::translate('file_publishing.failure', 'in2publish_core'),
AbstractMessage::ERROR,
LocalizationUtility::translate('file_publishing.failure', 'In2publishCore'),
\TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR,
);
}
}
Expand All @@ -200,7 +200,7 @@ public function publishFileAction(string $combinedIdentifier, bool $skipNotifica
$failures = $this->failureCollector->getFailures();
if (!empty($failures)) {
$message = '"' . implode('"; "', array_keys($failures)) . '"';
$title = LocalizationUtility::translate('record_publishing_failure', 'in2publish_core');
$title = LocalizationUtility::translate('record_publishing_failure', 'In2publishCore');
$mostCriticalLogLevel = $this->failureCollector->getMostCriticalLogLevel();
$severity = LogUtility::translateLogLevelToSeverity($mostCriticalLogLevel);
$this->addFlashMessage($message, $title, $severity);
Expand Down
12 changes: 6 additions & 6 deletions Classes/Controller/RecordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ public function initializeIndexAction(): void
$menuRegistry = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry();
$menu = $menuRegistry->makeMenu();
$menu->setIdentifier('depth');
$menu->setLabel(LocalizationUtility::translate('m1.page_recursion', 'in2publish_core'));
$menu->setLabel(LocalizationUtility::translate('m1.page_recursion', 'In2publishCore'));
for ($i = 0; $i <= 10; $i++) {
$menuItem = $menu->makeMenuItem();
$menuItem->setActive($i === $data['pageRecursionLimit']);
if ($i > 1) {
$title = LocalizationUtility::translate('m1.page_recursion.depths', 'in2publish_core', [$i]);
$title = LocalizationUtility::translate('m1.page_recursion.depths', 'In2publishCore', [$i]);
} else {
$title = LocalizationUtility::translate('m1.page_recursion.depth', 'in2publish_core', [$i]);
$title = LocalizationUtility::translate('m1.page_recursion.depth', 'In2publishCore', [$i]);
}
$menuItem->setTitle($title);
$menuItem->setHref($this->uriBuilder->uriFor('index', ['pageRecursionLimit' => $i]));
Expand Down Expand Up @@ -218,11 +218,11 @@ protected function addFlashMessagesAndRedirectToIndex(): ResponseInterface
}
if (empty($failures)) {
$message = '';
$title = LocalizationUtility::translate('record_published', 'in2publish_core', [$executionTime]);
$severity = AbstractMessage::OK;
$title = LocalizationUtility::translate('record_published', 'In2publishCore', [$executionTime]);
$severity = \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::OK;
} else {
$message = '"' . implode('"; "', array_keys($failures)) . '"';
$title = LocalizationUtility::translate('record_publishing_failure', 'in2publish_core', [$executionTime]);
$title = LocalizationUtility::translate('record_publishing_failure', 'In2publishCore', [$executionTime]);
$mostCriticalLogLevel = $this->failureCollector->getMostCriticalLogLevel();
$severity = LogUtility::translateLogLevelToSeverity($mostCriticalLogLevel);
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/Factory/ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function createLocalConnection(): Connection
{
$connection = DatabaseUtility::buildLocalDatabaseConnection();
if (null === $connection) {
throw new ConnectionUnavailableException('local');
throw new ConnectionUnavailableException('local', 4798752258);
}
return $connection;
}
Expand All @@ -57,7 +57,7 @@ public function createForeignConnection(): Connection
{
$connection = DatabaseUtility::buildForeignDatabaseConnection();
if (null === $connection) {
throw new ConnectionUnavailableException('foreign');
throw new ConnectionUnavailableException('foreign', 3805732109);
}
return $connection;
}
Expand Down
Loading

0 comments on commit 3fe2096

Please sign in to comment.