Skip to content

Commit db8c915

Browse files
committed
[TASK] phpstan rules
1 parent bb8834b commit db8c915

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

Build/phpstan12.neon

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ parameters:
99
- %currentWorkingDirectory%/Tests
1010

1111
excludePaths:
12-
- %currentWorkingDirectory%/Classes/Hooks/TableConfigurationPostProcessing.php
1312
- %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php
1413
- %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php
1514
- %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php

Build/phpstan13.neon

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ parameters:
99
- %currentWorkingDirectory%/Tests
1010

1111
excludePaths:
12-
- %currentWorkingDirectory%/Classes/ContentDefender
13-
- %currentWorkingDirectory%/Tests/Functional/Datahandler/ContentDefender
14-
- %currentWorkingDirectory%/Classes/Hooks/TableConfigurationPostProcessing.php
1512
- %currentWorkingDirectory%/Classes/Hooks/UsedRecords.php
1613
- %currentWorkingDirectory%/Tests/Functional/Hooks/UsedRecordsTest.php
1714
- %currentWorkingDirectory%/Tests/Unit/Hooks/UsedRecordsTest.php

Classes/ContentDefender/Xclasses/CommandMapHook.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use IchHabRecht\ContentDefender\Hooks\CmdmapDataHandlerHook;
1818
use IchHabRecht\ContentDefender\Repository\ContentRepository;
1919
use TYPO3\CMS\Core\DataHandling\DataHandler;
20+
use TYPO3\CMS\Core\Information\Typo3Version;
2021
use TYPO3\CMS\Core\Utility\GeneralUtility;
2122
use TYPO3\CMS\Core\Utility\MathUtility;
2223

@@ -72,14 +73,20 @@ public function processCmdmap_beforeStart(DataHandler $dataHandler): void
7273

7374
if ($this->containerColumnConfigurationService->isMaxitemsReachedByContainenrId((int)$data['update']['tx_container_parent'], (int)$data['update']['colPos'], $useChildId)) {
7475
unset($dataHandler->cmdmap['tt_content'][$id]);
76+
$recpid = null;
77+
$detailsNumber = null;
78+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) {
79+
$recpid = 0;
80+
$detailsNumber = 28;
81+
}
7582
$dataHandler->log(
7683
'tt_content',
7784
$id,
7885
1,
79-
0,
86+
$recpid,
8087
1,
8188
'The command couldn\'t be executed due to reached maxitems configuration',
82-
28
89+
$detailsNumber
8390
);
8491
}
8592
}

Classes/ContentDefender/Xclasses/DatamapHook.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use IchHabRecht\ContentDefender\Hooks\DatamapDataHandlerHook;
1919
use IchHabRecht\ContentDefender\Repository\ContentRepository;
2020
use TYPO3\CMS\Core\DataHandling\DataHandler;
21+
use TYPO3\CMS\Core\Information\Typo3Version;
2122
use TYPO3\CMS\Core\Utility\GeneralUtility;
2223
use TYPO3\CMS\Core\Utility\MathUtility;
2324

@@ -60,14 +61,20 @@ public function processDatamap_beforeStart(DataHandler $dataHandler): void
6061

6162
if ($this->containerColumnConfigurationService->isMaxitemsReachedByContainenrId($containerId, (int)$values['colPos'])) {
6263
unset($dataHandler->datamap['tt_content'][$id]);
64+
$recpid = null;
65+
$detailsNumber = null;
66+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) {
67+
$recpid = 0;
68+
$detailsNumber = 28;
69+
}
6370
$dataHandler->log(
6471
'tt_content',
6572
$id,
6673
1,
67-
0,
74+
$recpid,
6875
1,
6976
'The command couldn\'t be executed due to reached maxitems configuration',
70-
28
77+
$detailsNumber
7178
);
7279
}
7380
}

Classes/Hooks/Datahandler/CommandMapBeforeStartHook.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ protected function dataFromContainerIdColPos(array $data): array
303303
protected function logAndUnsetCmd(int $id, string $cmd, string $message, DataHandler $dataHandler): void
304304
{
305305
$recpid = null;
306-
$details = null;
306+
$detailsNumber = null;
307307
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 13) {
308308
$recpid = 0;
309-
$details = 28;
309+
$detailsNumber = 28;
310310
}
311311
$dataHandler->log(
312312
'tt_content',
@@ -315,7 +315,7 @@ protected function logAndUnsetCmd(int $id, string $cmd, string $message, DataHan
315315
$recpid,
316316
1,
317317
$cmd . ' ' . $message,
318-
$details
318+
$detailsNumber
319319
);
320320
unset($dataHandler->cmdmap['tt_content'][$id][$cmd]);
321321
if (!empty($dataHandler->cmdmap['tt_content'][$id])) {

0 commit comments

Comments
 (0)