Skip to content

Commit a036dd4

Browse files
committed
!!![TASK] drop TYPO3 < 13 Support
1 parent 14fc247 commit a036dd4

File tree

25 files changed

+144
-292
lines changed

25 files changed

+144
-292
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
TYPO3: [ '12', '13', '14' ]
11+
TYPO3: [ '13', '14' ]
12+
php: [ '8.2', '8.5']
1213

1314
steps:
1415
- name: Checkout
@@ -17,7 +18,7 @@ jobs:
1718
- name: Set up PHP Version
1819
uses: shivammathur/setup-php@v2
1920
with:
20-
php-version: 8.3
21+
php-version: ${{ matrix.php }}
2122
tools: composer:v2
2223

2324
- name: Start MySQL
@@ -40,19 +41,12 @@ jobs:
4041
if: matrix.TYPO3 == '13'
4142
run: |
4243
composer require typo3/cms-core:^13.4 --no-progress --no-interaction --dev -W
43-
- name: Install composer dependencies TYPO3 12
44-
if: matrix.TYPO3 == '12'
45-
run: |
46-
composer require typo3/cms-core:^12.4 --no-progress --no-interaction --dev -W
4744
- name: Phpstan 13
4845
if: matrix.TYPO3 == '13'
4946
run: .Build/bin/phpstan analyze -c Build/phpstan13.neon
5047
- name: Phpstan 14
5148
if: matrix.TYPO3 == '14'
5249
run: .Build/bin/phpstan analyze -c Build/phpstan.neon
53-
- name: Phpstan 12
54-
if: matrix.TYPO3 == '12'
55-
run: .Build/bin/phpstan analyze -c Build/phpstan12.neon
5650
- name: Phpcsfix
5751
run: .Build/bin/php-cs-fixer fix --config=Build/php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no
5852
- name: Functional Tests

Build/phpstan-baseline.neon

Lines changed: 0 additions & 21 deletions
This file was deleted.

Build/phpstan.neon

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
includes:
2-
- phpstan-baseline.neon
31
parameters:
42
level: 5
53
paths:
64
- %currentWorkingDirectory%/Classes
75
excludePaths:
8-
- %currentWorkingDirectory%/Classes/Hooks/DrawItem.php
6+
- %currentWorkingDirectory%/Classes/Listener/PageContentPreviewRendering.php

Build/phpstan11.neon

Lines changed: 0 additions & 9 deletions
This file was deleted.

Build/phpstan12.neon

Lines changed: 0 additions & 9 deletions
This file was deleted.

Build/phpstan13.neon

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
parameters:
22
level: 5
33
paths:
4-
- %currentWorkingDirectory%/Classes
5-
excludePaths:
6-
- %currentWorkingDirectory%/Classes/Hooks/DrawItem.php
4+
- %currentWorkingDirectory%/Classes

Classes/DataProcessing/ListItemsDataProcessor.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@
1313
*/
1414

1515
use B13\Listelements\Service\ListService;
16+
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
1617
use TYPO3\CMS\Core\Utility\GeneralUtility;
1718
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;
1819
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
1920
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
2021

22+
#[Autoconfigure(public: true)]
2123
class ListItemsDataProcessor implements DataProcessorInterface
2224
{
23-
protected ListService $listService;
24-
protected ContentDataProcessor $contentDataProcessor;
25-
26-
public function __construct(ListService $listService, ContentDataProcessor $contentDataProcessor)
25+
public function __construct(protected ListService $listService, protected ContentDataProcessor $contentDataProcessor)
2726
{
28-
$this->listService = $listService;
29-
$this->contentDataProcessor = $contentDataProcessor;
3027
}
3128

3229
public function process(

Classes/Hooks/DrawItem.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

Classes/Listener/PageContentPreviewRendering.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
use B13\Listelements\Service\ListService;
1616
use TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent;
17+
use TYPO3\CMS\Core\Attribute\AsEventListener;
1718
use TYPO3\CMS\Core\Information\Typo3Version;
1819

20+
#[AsEventListener(identifier: 'b13-listelements-page-content-preview-rendering')]
1921
class PageContentPreviewRendering
2022
{
21-
protected ListService $listService;
22-
23-
public function __construct(ListService $listService)
23+
public function __construct(protected ListService $listService)
2424
{
25-
$this->listService = $listService;
2625
}
2726

2827
public function __invoke(PageContentPreviewRenderingEvent $event): void

Classes/Service/ListService.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
use TYPO3\CMS\Core\Database\ConnectionPool;
1818
use TYPO3\CMS\Core\Database\RelationHandler;
1919
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
20-
use TYPO3\CMS\Core\Information\Typo3Version;
2120
use TYPO3\CMS\Core\Resource\FileRepository;
22-
use TYPO3\CMS\Core\SingletonInterface;
2321
use TYPO3\CMS\Core\Utility\GeneralUtility;
2422
use TYPO3\CMS\Core\Versioning\VersionState;
2523

26-
class ListService implements SingletonInterface
24+
class ListService
2725
{
2826
private const TABLE = 'tx_listelements_item';
2927

@@ -79,9 +77,6 @@ public function resolveListitems(array $row, string $field = 'tx_listelements_li
7977

8078
protected function isDeletePlaceHolder(array $item): bool
8179
{
82-
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
83-
return VersionState::cast($item['t3ver_state'] ?? 0)->equals(VersionState::DELETE_PLACEHOLDER);
84-
}
8580
return VersionState::tryFrom($item['t3ver_state'] ?? 0) === VersionState::DELETE_PLACEHOLDER;
8681
}
8782

@@ -91,18 +86,14 @@ public function resolveItemsForFrontend(int $uid, string $table = 'tt_content',
9186
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
9287
$relationHandler = GeneralUtility::makeInstance(RelationHandler::class);
9388
$relationHandler->setWorkspaceId($workspaceId);
94-
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
95-
$additionalWhere = $pageRepository->enableFields(self::TABLE);
89+
$constraints = $pageRepository->getDefaultConstraints(self::TABLE);
90+
if ($constraints === []) {
91+
$additionalWhere = '';
9692
} else {
97-
$constraints = $pageRepository->getDefaultConstraints(self::TABLE);
98-
if ($constraints === []) {
99-
$additionalWhere = '';
100-
} else {
101-
$expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
102-
->getQueryBuilderForTable($table)
103-
->expr();
104-
$additionalWhere = ' AND ' . $expressionBuilder->and(...$constraints);
105-
}
93+
$expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
94+
->getQueryBuilderForTable($table)
95+
->expr();
96+
$additionalWhere = ' AND ' . $expressionBuilder->and(...$constraints);
10697
}
10798
$relationHandler->additionalWhere[self::TABLE] = $additionalWhere;
10899
$relationHandler->start(

0 commit comments

Comments
 (0)