Skip to content

Commit

Permalink
[TASK] Install and Apply TYPO3 coding guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed May 30, 2024
1 parent 31aeaf3 commit 1088044
Show file tree
Hide file tree
Showing 133 changed files with 1,914 additions and 2,237 deletions.
4 changes: 2 additions & 2 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ fi
case ${TEST_SUITE} in
cgl)
if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then
COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --dry-run --diff --config=.php-cs-fixer.dist.php --using-cache=no ."
COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --dry-run --diff --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ."
else
COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --config=.php-cs-fixer.dist.php --using-cache=no ."
COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ."
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name cgl-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
Expand Down
12 changes: 12 additions & 0 deletions Build/cgl/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use TYPO3\CodingStandards\CsFixerConfig;

$config = CsFixerConfig::create();
$config->getFinder()->in(__DIR__ . '/../../Classes');
$config->getFinder()->in(__DIR__ . '/../../Configuration');
$config->getFinder()->exclude('node_modules');
$config->setCacheFile(__DIR__ . '/../../.Build/.cache/.php_cs.cache');
return $config;
17 changes: 5 additions & 12 deletions Classes/Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

/**
* Runs the External Import process from the command line.
*
* @package Cobweb\ExternalImport\Command
*/
class ImportCommand extends Command
{
Expand All @@ -54,8 +52,6 @@ class ImportCommand extends Command

/**
* Configures the command by setting its name, description and options.
*
* @return void
*/
public function configure()
{
Expand Down Expand Up @@ -185,9 +181,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
Importer::DEFAULT_PRIORITY => [
[
'table' => $table,
'index' => $index
]
]
'index' => $index,
],
],
];
$this->runSynchronization($configurations);
} else {
Expand All @@ -212,8 +208,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

/**
* Prints the list of synchronizable configurations as a table.
*
* @return void
*/
protected function printConfigurationList(): void
{
Expand All @@ -225,7 +219,7 @@ protected function printConfigurationList(): void
$priority,
$configuration['table'],
$configuration['index'],
$configuration['group']
$configuration['group'],
];
}
}
Expand All @@ -239,7 +233,6 @@ protected function printConfigurationList(): void
* Runs the synchronization of the given list of configurations.
*
* @param array $configurations List of External Import configurations
* @return void
*/
protected function runSynchronization(array $configurations): void
{
Expand Down Expand Up @@ -290,4 +283,4 @@ protected function reportResults(array $messages): void
}
}
}
}
}
5 changes: 1 addition & 4 deletions Classes/Context/AbstractCallContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
* Call contexts are used to react to some output from the Importer class which needs some special handling
* depending on the context in which the call happens (command-line, scheduler, etc.). This offloads the
* responsibility of all these contexts from the Importer class itself.
*
* @package Cobweb\ExternalImport\Step
*/
abstract class AbstractCallContext
{
Expand All @@ -46,7 +44,6 @@ public function __construct(Importer $importer)
* @param string $message Message to display
* @param int $severity Degree of severity
* @param mixed $data Additional data to display
* @return void
*/
abstract public function outputDebug(string $message, int $severity, $data): void;
}
}
5 changes: 1 addition & 4 deletions Classes/Context/CommandLineCallContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

/**
* This is a concrete implementation of the call context for the CLI context.
*
* @package Cobweb\ExternalImport\Step
*/
class CommandLineCallContext extends AbstractCallContext
{
Expand All @@ -47,7 +45,6 @@ public function setInputOutput(SymfonyStyle $io): void
* @param string $message Message to display
* @param int $severity Degree of severity
* @param mixed $data Additional data to display
* @return void
*/
public function outputDebug(string $message, int $severity, $data): void
{
Expand All @@ -74,4 +71,4 @@ public function outputDebug(string $message, int $severity, $data): void
$this->io->writeln('-------------------------------------------------------------------');
}
}
}
}
30 changes: 12 additions & 18 deletions Classes/Controller/DataModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
*/
class DataModuleController extends ActionController
{

protected ModuleTemplateFactory $moduleTemplateFactory;

protected ?ModuleTemplate $moduleTemplate = null;
Expand Down Expand Up @@ -122,8 +121,8 @@ public function listSynchronizableAction(): ResponseInterface
'scheduler' => $this->getBackendUser()->check(
'custom_options',
'tx_externalimport_bemodule_actions:scheduler'
)
]
),
],
]
);

Expand Down Expand Up @@ -158,7 +157,7 @@ public function listNonSynchronizableAction(): ResponseInterface
}
$this->view->assignMultiple(
[
'configurations' => $configurations
'configurations' => $configurations,
]
);

Expand Down Expand Up @@ -230,7 +229,7 @@ public function previewAction(string $table, string $index, string $stepClass =
'external_import',
[
$e->getMessage(),
$e->getCode()
$e->getCode(),
]
),
'',
Expand All @@ -244,7 +243,7 @@ public function previewAction(string $table, string $index, string $stepClass =
'steps' => $stepList,
'stepClass' => $stepClass,
'previewData' => $previewData,
'downloadable' => $downloadable
'downloadable' => $downloadable,
]
);

Expand Down Expand Up @@ -348,7 +347,7 @@ public function viewConfigurationAction(string $table, string $index): ResponseI
'external_import',
[
$e->getMessage(),
$e->getCode()
$e->getCode(),
]
),
'',
Expand All @@ -370,7 +369,7 @@ public function viewConfigurationAction(string $table, string $index): ResponseI
'table' => $table,
'index' => $index,
'configuration' => $configuration,
'storageRecord' => BackendUtility::getRecord('pages', $configuration->getStoragePid())
'storageRecord' => BackendUtility::getRecord('pages', $configuration->getStoragePid()),
],
);

Expand Down Expand Up @@ -440,7 +439,7 @@ public function createTaskAction(
'autosync_save_failed',
'external_import',
[
$e->getMessage()
$e->getMessage(),
]
),
'',
Expand Down Expand Up @@ -519,7 +518,7 @@ public function updateTaskAction(int $uid, string $frequency, int $group): Respo
'autosync_save_failed',
'external_import',
[
$e->getMessage()
$e->getMessage(),
]
),
'',
Expand Down Expand Up @@ -551,7 +550,7 @@ public function deleteTaskAction(int $uid): ResponseInterface
'delete_failed',
'external_import',
[
$e->getMessage()
$e->getMessage(),
]
),
'',
Expand All @@ -568,7 +567,6 @@ public function deleteTaskAction(int $uid): ResponseInterface
*
* @param string $menuAction
* @param string $closeButtonAction
* @return void
*/
protected function prepareView(string $menuAction = '', string $closeButtonAction = ''): void
{
Expand All @@ -585,8 +583,6 @@ protected function prepareView(string $menuAction = '', string $closeButtonActio

/**
* Loads the resources (JS, CSS) needed by some action views.
*
* @return void
*/
protected function loadResources(): void
{
Expand All @@ -597,8 +593,8 @@ protected function loadResources(): void
$this->pageRenderer->addRequireJsConfiguration(
[
'paths' => [
'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables'
]
'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables',
],
]
);
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/ExternalImport/DataModule');
Expand All @@ -613,7 +609,6 @@ protected function loadResources(): void
* Defines the menu items in the docheader.
*
* @param string $action
* @return void
*/
protected function prepareMainMenu(string $action): void
{
Expand Down Expand Up @@ -644,7 +639,6 @@ protected function prepareMainMenu(string $action): void
* Adds a close button to the docheader.
*
* @param string $returnAction Name of the action to return to
* @return void
*/
protected function prepareCloseButton(string $returnAction): void
{
Expand Down
9 changes: 3 additions & 6 deletions Classes/Controller/LogAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@

/**
* Controller for the AJAX calls of the "Log" module
*
* @package Cobweb\ExternalImport\Controller
*/
class LogAjaxController
{

/**
* Returns the list of all log entries, in JSON format.
*
Expand Down Expand Up @@ -69,7 +66,7 @@ public function getAction(ServerRequestInterface $request, ResponseInterface $re
'configuration' => $logEntry->getConfiguration(),
'context' => $logEntry->getContext(),
'message' => $logEntry->getMessage(),
'duration' => $logEntry->getDuration()
'duration' => $logEntry->getDuration(),
];
}
} catch (\Exception $e) {
Expand All @@ -85,12 +82,12 @@ public function getAction(ServerRequestInterface $request, ResponseInterface $re
'data' => $logs,
'recordsTotal' => $totalEntries,
'recordsFiltered' => $logCount,
'error' => $error
'error' => $error,
];
if ($response === null) {
$response = GeneralUtility::makeInstance(JsonResponse::class);
}
$response->getBody()->write(json_encode($fullResponse, JSON_THROW_ON_ERROR));
return $response;
}
}
}
9 changes: 3 additions & 6 deletions Classes/Controller/LogModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*/
class LogModuleController extends ActionController
{

protected ModuleTemplateFactory $moduleTemplateFactory;

protected ?ModuleTemplate $moduleTemplate = null;
Expand Down Expand Up @@ -63,8 +62,6 @@ public function initializeAction(): void

/**
* Loads the resources (JS, CSS) needed by some action views.
*
* @return void
*/
protected function loadResources(): void
{
Expand All @@ -80,7 +77,7 @@ protected function loadResources(): void
[
'paths' => [
'datatables' => $publicResourcesPath . 'JavaScript/Contrib/datatables',
]
],
]
);
// TODO: remove and replace with Luxon when compatibility with v11 is dropped
Expand All @@ -89,8 +86,8 @@ protected function loadResources(): void
$this->pageRenderer->addRequireJsConfiguration(
[
'paths' => [
'moment' => $publicResourcesPath . 'JavaScript/Contrib/moment'
]
'moment' => $publicResourcesPath . 'JavaScript/Contrib/moment',
],
]
);
}
Expand Down
1 change: 0 additions & 1 deletion Classes/DataHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* Interface which defines the method to implement when creating a custom data handler for External Import
*
* Interface DataHandlerInterface
* @package Cobweb\ExternalImport
*/
interface DataHandlerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/BackendUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public function setUserName(string $userName): void
{
$this->userName = $userName;
}
}
}
3 changes: 1 addition & 2 deletions Classes/Domain/Model/ChildrenConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public function setControlColumnsForDelete(array $controlColumnsForDelete): void
*
* @param string $operation
* @param bool $flag
* @return void
*/
public function setAllowedOperation(string $operation, bool $flag): void
{
Expand Down Expand Up @@ -190,4 +189,4 @@ public function setSorting(array $sorting): void
{
$this->sorting = $sorting;
}
}
}
Loading

0 comments on commit 1088044

Please sign in to comment.