Skip to content

Commit

Permalink
chore: update brotkrueml/coding-standards to 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Aug 29, 2024
1 parent 0f6deb0 commit c7cfecb
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Classes/Command/CleanUpTransfersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function getAgeInDays(InputInterface $input): int
);
}

$ageInDays = (int)$ageInDays;
$ageInDays = (int) $ageInDays;
if ($ageInDays < 0) {
throw new \InvalidArgumentException(
\sprintf(
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controller/TableListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ private function configureDocHeader(string $requestUri): void
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();

$newButton = $buttonBar->makeLinkButton()
->setHref((string)$this->uriBuilder->buildUriFromRoute(
->setHref((string) $this->uriBuilder->buildUriFromRoute(
'record_edit',
[
'edit' => [
'tx_jobrouterdata_domain_model_table' => ['new'],
],
'returnUrl' => (string)$this->uriBuilder->buildUriFromRoute(Extension::MODULE_NAME),
'returnUrl' => (string) $this->uriBuilder->buildUriFromRoute(Extension::MODULE_NAME),
],
))
->setTitle($this->getLanguageService()->sL(Extension::LANGUAGE_PATH_BACKEND_MODULE . ':action.add_table'))
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/TableTestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __invoke(ServerRequestInterface $request): ResponseInterface
return $this->buildResponse('Request has no valid body!');
}

$tableId = (int)$body['tableId'];
$tableId = (int) $body['tableId'];
try {
try {
$table = $this->tableRepository->findByUidWithHidden($tableId);
Expand Down
4 changes: 2 additions & 2 deletions Classes/DataProcessing/TableProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function process(
$this->processedData = $processedData;

$flexForm = $this->flexFormService->convertFlexFormContentToArray($cObj->data['pi_flexform']);
$tableUid = (int)($flexForm['table'] ?? 0);
$tableUid = (int) ($flexForm['table'] ?? 0);
if ($tableUid > 0) {
$this->enrichProcessedDataWithTableInformation($tableUid);
}
Expand All @@ -67,7 +67,7 @@ private function enrichProcessedDataWithTableInformation(int $tableUid): void

// locale is casted to a string as in v12 the locale is an object with a __toString() method (in v11 it is a string)
// @todo Remove the cast when compatibility with TYPO3 v11 is dropped
$locale = (string)$this->cObj->getRequest()->getAttribute('language')->getLocale();
$locale = (string) $this->cObj->getRequest()->getAttribute('language')->getLocale();
$this->processedData['table'] = $tableDemand;
$this->processedData['rows'] = $this->datasetConverter->convertFromJsonToArray($table, $locale);
$this->addCacheTag($tableUid);
Expand Down
10 changes: 5 additions & 5 deletions Classes/Domain/Entity/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function __construct(
public static function fromArray(array $data): self
{
return new self(
(int)$data['uid'],
(int) $data['uid'],
$data['name'],
$data['label'],
(int)$data['type'],
(int)$data['decimal_places'],
(int)$data['field_size'],
(int) $data['type'],
(int) $data['decimal_places'],
(int) $data['field_size'],
$data['alignment'],
(int)$data['sorting_priority'],
(int) $data['sorting_priority'],
$data['sorting_order'],
);
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Domain/Entity/Dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ private function __construct(
public static function fromArray(array $data): self
{
return new self(
(int)$data['uid'],
(int)$data['table_uid'],
(int)$data['jrid'],
(string)$data['dataset'],
(int) $data['uid'],
(int) $data['table_uid'],
(int) $data['jrid'],
(string) $data['dataset'],
);
}
}
10 changes: 5 additions & 5 deletions Classes/Domain/Entity/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ private function __construct(
*/
public static function fromArray(array $data): self
{
$lastSyncDate = (int)$data['last_sync_date'];
$lastSyncDate = (int) $data['last_sync_date'];

return new self(
(int)$data['uid'],
(int)$data['connection'],
(int) $data['uid'],
(int) $data['connection'],
TableType::from($data['type']),
$data['handle'],
$data['name'],
$data['table_guid'],
$data['custom_table'],
$data['datasets_sync_hash'],
$lastSyncDate > 0 ? (new \DateTimeImmutable())->setTimestamp($lastSyncDate) : null,
(string)$data['last_sync_error'],
(bool)$data['disabled'],
(string) $data['last_sync_error'],
(bool) $data['disabled'],
);
}
}
14 changes: 7 additions & 7 deletions Classes/Domain/Entity/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ public function __construct(
*/
public static function fromArray(array $data): self
{
$transmitDate = (int)$data['transmit_date'];
$transmitDate = (int) $data['transmit_date'];

return new self(
(int)$data['uid'],
(int)$data['crdate'],
(int)$data['table_uid'],
(int) $data['uid'],
(int) $data['crdate'],
(int) $data['table_uid'],
$data['correlation_id'],
(string)$data['data'],
(bool)($data['transmit_success'] ?? false),
(string) $data['data'],
(bool) ($data['transmit_success'] ?? false),
$transmitDate > 0 ? (new \DateTimeImmutable())->setTimestamp($transmitDate) : null,
(string)$data['transmit_message'],
(string) $data['transmit_message'],
);
}
}
8 changes: 4 additions & 4 deletions Classes/Domain/Finishers/TransmitDataFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function prepareData(TableDemand $tableDemand): array
$value,
);

$value = $this->resolveFormFields($formValues, (string)$value);
$value = $this->resolveFormFields($formValues, (string) $value);

$data[$column] = $this->considerTypeForFieldValue(
$value,
Expand Down Expand Up @@ -137,9 +137,9 @@ private function getTableColumns(TableDemand $table): array
private function considerTypeForFieldValue(mixed $value, FieldType $type, int $fieldSize): string|int|float
{
return match ($type) {
FieldType::Text => $this->cutStringValueToLength((string)$value, $fieldSize),
FieldType::Integer => $value === '' ? '' : (int)$value,
FieldType::Decimal => $value === '' ? '' : (float)$value,
FieldType::Text => $this->cutStringValueToLength((string) $value, $fieldSize),
FieldType::Integer => $value === '' ? '' : (int) $value,
FieldType::Decimal => $value === '' ? '' : (float) $value,
FieldType::Date,
FieldType::DateTime => throw new InvalidFieldTypeException(
\sprintf('The field type "%d" is not implemented in the form finisher', $type->name),
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/TransferRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function updateTransmitData(int $uid, bool $success, \DateTimeImmutable $
->update(
self::TABLE_NAME,
[
'transmit_success' => (int)$success,
'transmit_success' => (int) $success,
'transmit_date' => $date->getTimestamp(),
'transmit_message' => $message,
],
Expand Down
2 changes: 1 addition & 1 deletion Classes/EventListener/DateFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(ModifyColumnContentEvent $event): void
}

$formatter = new \IntlDateFormatter($event->getLocale(), \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE);
$formattedDate = $formatter->format(new \DateTimeImmutable((string)$event->getContent()));
$formattedDate = $formatter->format(new \DateTimeImmutable((string) $event->getContent()));
if ($formattedDate !== false) {
$event->setContent($formattedDate);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/EventListener/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(ModifyColumnContentEvent $event): void
}

$formatter = new \IntlDateFormatter($event->getLocale(), \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT);
$formattedDateTime = $formatter->format(new \DateTimeImmutable((string)$event->getContent()));
$formattedDateTime = $formatter->format(new \DateTimeImmutable((string) $event->getContent()));
if ($formattedDateTime !== false) {
$event->setContent($formattedDateTime);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/EventListener/DecimalFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __invoke(ModifyColumnContentEvent $event): void
}

if (\is_string($content) && \is_numeric($content)) {
$content = (float)$content;
$content = (float) $content;
}

if (\is_string($content)) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/EventListener/IntegerFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __invoke(ModifyColumnContentEvent $event): void
}

if (\is_string($content) && \is_numeric($content)) {
$content = (int)$content;
$content = (int) $content;
}

if (\is_string($content)) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/TableUpdateHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function processCmdmap_postProcess(string $command, string $table, string
return;
}

$this->datasetRepository->deleteByTableUid((int)$recordId);
$this->datasetRepository->deleteByTableUid((int) $recordId);
}
}
4 changes: 2 additions & 2 deletions Classes/Preview/ContentElementPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
$record = $item->getRecord();

$flexForm = GeneralUtility::xml2array($record['pi_flexform']);
$tableId = (int)$this->getValueFromFlexform($flexForm, 'table');
$tableId = (int) $this->getValueFromFlexform($flexForm, 'table');

try {
$table = $this->tableRepository->findByUid($tableId);
$site = $this->siteFinder->getSiteByPageId($record['pid']);
// locale is casted to a string as in v12 the locale is an object with a __toString() method (in v11 it is a string)
// @todo Remove the cast when compatibility with TYPO3 v11 is dropped
$locale = (string)$site->getLanguageById($record['sys_language_uid'])->getLocale();
$locale = (string) $site->getLanguageById($record['sys_language_uid'])->getLocale();

$view->assignMultiple([
'tableDemand' => $this->tableDemandFactory->create($table),
Expand Down
2 changes: 1 addition & 1 deletion Classes/Transfer/Transmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private function transmitTransfer(Transfer $transfer): int
\json_decode($transfer->data, true, flags: \JSON_THROW_ON_ERROR),
);

return (int)($result[0]['jrid'] ?? 0);
return (int) ($result[0]['jrid'] ?? 0);
}

private function getTable(int $tableUid): Table
Expand Down
2 changes: 1 addition & 1 deletion Classes/UserFunctions/TCA/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class Column
*/
public function getLabel(array &$parameters): void
{
$label = (string)($parameters['row']['label'] ?? '');
$label = (string) ($parameters['row']['label'] ?? '');
if (\str_starts_with($label, 'LLL:')) {
$label = $this->getLanguageService()->sL($label);
}
Expand Down
8 changes: 4 additions & 4 deletions Configuration/TCA/tx_jobrouterdata_domain_model_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
],
],
'types' => [
(string)TableType::Simple->value => [
(string) TableType::Simple->value => [
'columnsOverrides' => [
'columns' => [
'config' => [
Expand Down Expand Up @@ -202,7 +202,7 @@
description,
',
],
(string)TableType::CustomTable->value => [
(string) TableType::CustomTable->value => [
'showitem' => '
type, connection, name, handle, table_guid, custom_table,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
Expand All @@ -213,7 +213,7 @@
description,
',
],
(string)TableType::FormFinisher->value => [
(string) TableType::FormFinisher->value => [
'showitem' => '
type, connection, name, handle, table_guid, columns,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
Expand All @@ -222,7 +222,7 @@
description,
',
],
(string)TableType::OtherUsage->value => [
(string) TableType::OtherUsage->value => [
'showitem' => '
type, connection, name, handle, table_guid,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function deleteOldSuccessfulTransfers(): void
)
->fetchAllAssociative();

$availableUids = \array_map(static fn(array $row): int => (int)$row['uid'], $rows);
$availableUids = \array_map(static fn(array $row): int => (int) $row['uid'], $rows);

self::assertNotContains(1, $availableUids);
self::assertNotContains(3, $availableUids);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"typo3/cms-frontend": "^11.5.4 || ^12.4"
},
"require-dev": {
"brotkrueml/coding-standards": "~5.1.0",
"brotkrueml/coding-standards": "~6.0.0",
"codeception/codeception": "^5.1",
"codeception/module-asserts": "^3.0",
"codeception/module-webdriver": "^4.0",
Expand Down

0 comments on commit c7cfecb

Please sign in to comment.