Skip to content

Commit 8565be5

Browse files
[Task] add EXT:container to dev-requirements, fix some php-stan complaints
1 parent b7fa4b3 commit 8565be5

4 files changed

Lines changed: 9 additions & 39 deletions

File tree

Classes/DataHandler/ProcessCmdmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public function execute_processCmdmap(
5454
): void {
5555

5656
$this->init($table, $id, $parentObj);
57-
/** @var ServerRequestInterface $request */
5857
$request = $GLOBALS['TYPO3_REQUEST'] ?? null;
5958
if (!($request instanceof ServerRequestInterface)) {
6059
return;

Classes/Domain/Repository/TtContentRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct()
6666
* @todo: move this in a repository
6767
*
6868
* @param string $shortcutItem The single page to be used as the tree root
69-
* @param array<int, array<non-empty-string, mixed>> $collectedItems The collected item data rows ordered by parent position, column position and sorting
69+
* @param-out array<int, array<non-empty-string, mixed>> $collectedItems The collected item data rows ordered by parent position, column position and sorting
7070
* @param int $recursive The number of levels for the recursion
7171
* @param int $parentUid uid of the referencing tt_content record
7272
* @param int $language sys_language_uid of the referencing tt_content record
@@ -133,7 +133,7 @@ public function collectContentDataFromPages(
133133
* @todo: move this in a repository
134134
*
135135
* @param string $shortcutItem The tt_content element to fetch the data from
136-
* @param array<int, array<non-empty-string, mixed>> $collectedItems The collected item data row
136+
* @param-out array<int, array<non-empty-string, mixed>> $collectedItems The collected item data row
137137
* @param int $parentUid uid of the referencing tt_content record
138138
* @param int $language sys_language_uid of the referencing tt_content record
139139
* @throws DBALException
@@ -206,8 +206,8 @@ public function getPidFromUid(int $uid = 0): int
206206
)
207207
->executeQuery()
208208
->fetchAssociative();
209-
$pid = (int)($contentElement['pid'] ?? 0);
210-
return is_array($contentElement) && $pid ? $pid : 0;
209+
210+
return $contentElement['pid'] ? (int)$contentElement['pid'] : 0;
211211
}
212212

213213
/**

Tests/Functional/ApiCompatibilityTest.php

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,6 @@ public function connectionPoolApiIsCompatible(): void
114114
{
115115
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
116116
$queryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
117-
118-
// Test that ConnectionPool API works consistently across versions
119-
self::assertInstanceOf(\TYPO3\CMS\Core\Database\Query\QueryBuilder::class, $queryBuilder);
120-
121-
// Test query builder methods that are used by the extension
122-
$connection = $connectionPool->getConnectionForTable('tt_content');
123-
self::assertInstanceOf(\TYPO3\CMS\Core\Database\Connection::class, $connection);
124-
125117
// Test restrictions API
126118
$restrictions = $queryBuilder->getRestrictions();
127119
self::assertInstanceOf(\TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface::class, $restrictions);
@@ -134,28 +126,6 @@ public function dataHandlerApiIsCompatible(): void
134126

135127
// Test DataHandler properties and methods used by extension
136128
self::assertObjectHasProperty('isImporting', $dataHandler);
137-
138-
// Test method signatures that are used by ProcessCmdmap
139-
self::assertTrue(method_exists($dataHandler, 'start'));
140-
self::assertTrue(method_exists($dataHandler, 'process_datamap'));
141-
self::assertTrue(method_exists($dataHandler, 'process_cmdmap'));
142-
}
143-
144-
#[Test]
145-
public function BackendHelperClassUsesCompatibleApis(): void
146-
{
147-
$backendHelper = GeneralUtility::makeInstance(BackendHelper::class);
148-
149-
// Test that BackendHelper class can be instantiated and uses compatible APIs
150-
self::assertInstanceOf(BackendHelper::class, $backendHelper);
151-
152-
// Test backend user access
153-
$backendUser = $backendHelper->getBackendUser();
154-
// Backend user might be null in testing context, but method should exist
155-
self::assertTrue(method_exists($backendHelper, 'getBackendUser'));
156-
157-
// Test language service access
158-
self::assertTrue(method_exists($backendHelper, 'getLanguageService'));
159129
}
160130

161131
#[Test]
@@ -165,7 +135,7 @@ public function TtContentRepositoryUsesCompatibleApis(): void
165135

166136
// Test database query methods
167137
$queryBuilder = $ttContentRepository->getQueryBuilder('tt_content');
168-
self::assertInstanceOf(\TYPO3\CMS\Core\Database\Query\QueryBuilder::class, $queryBuilder);
138+
self::assertTrue($queryBuilder, 'QueryBuilder can be retrieved from TtContentRepository');
169139
}
170140

171141
#[Test]
@@ -232,15 +202,15 @@ public function globalVariablesAreAccessibleAcrossVersions(): void
232202
$request = $GLOBALS['TYPO3_REQUEST'] ?? null;
233203

234204
// The extension should handle null request gracefully
235-
self::assertTrue(true, 'Global variables access pattern is compatible');
205+
self::assertTrue($request, 'Global variables access pattern is compatible');
236206

237207
// Test BE_USER global access pattern
238208
$backendUser = $GLOBALS['BE_USER'] ?? null;
239-
self::assertTrue(true, 'Backend user global access pattern is compatible');
209+
self::assertTrue($backendUser, 'Backend user global access pattern is compatible');
240210

241211
// Test LANG global access pattern
242212
$languageService = $GLOBALS['LANG'] ?? null;
243-
self::assertTrue(true, 'Language service global access pattern is compatible');
213+
self::assertTrue($languageService, 'Language service global access pattern is compatible');
244214
}
245215

246216
#[Test]

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"typo3/cms-core": "^13.4 || ^14.0 < 14.2"
3535
},
3636
"require-dev": {
37+
"b13/container": "^3.2",
3738
"ergebnis/composer-normalize": "^2.31",
3839
"friendsofphp/php-cs-fixer": "^3.64.0",
3940
"phpstan/phpstan": "^1.12.5 || ^2.0.2",

0 commit comments

Comments
 (0)