Skip to content

Commit b0ffae9

Browse files
committed
[FEATURE] Ensure compatibility with TYPO3 14 and PHP 8.5, resolves #18
1 parent 3485bb8 commit b0ffae9

13 files changed

Lines changed: 81 additions & 124 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/Documentation-GENERATED-temp/
22
/.Build/
3+
/Build/rector/.Build/
34
/.cache/
45
composer.json.testing
56
composer.lock

Build/Scripts/runTests.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ handleDbmsOptions() {
6161
exit 1
6262
fi
6363
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.4"
64-
if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then
64+
if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1|11.2|11.3|11.4)$ ]]; then
6565
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
6666
echo >&2
6767
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -77,7 +77,7 @@ handleDbmsOptions() {
7777
exit 1
7878
fi
7979
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="8.0"
80-
if ! [[ ${DBMS_VERSION} =~ ^(8.0|8.1|8.2|8.3)$ ]]; then
80+
if ! [[ ${DBMS_VERSION} =~ ^(8.0|8.1|8.2|8.3|8.4)$ ]]; then
8181
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
8282
echo >&2
8383
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
@@ -187,12 +187,16 @@ Options:
187187
- 10.10 short-term, maintained until 2023-11
188188
- 10.11 long-term, maintained until 2028-02
189189
- 11.0 development series
190-
- 11.1 short-term development series
190+
- 11.1 short-term development series, maintained until 2024-08
191+
- 11.2 short-term development series, maintained until 2024-11
192+
- 11.3 short-term development series, rolling release
193+
- 11.4 long-term, maintained until 2029-05
191194
With "-d mysql":
192195
- 8.0 maintained until 2026-04 (default) LTS
193196
- 8.1 unmaintained since 2023-10
194197
- 8.2 unmaintained since 2024-01
195198
- 8.3 maintained until 2024-04
199+
- 8.4 maintained until 2032-04 LTS
196200
With "-d postgres":
197201
- 10 unmaintained since 2022-11-10 (default)
198202
- 11 unmaintained since 2023-11-09
@@ -202,12 +206,12 @@ Options:
202206
- 15 maintained until 2027-11-11
203207
- 16 maintained until 2028-11-09
204208
205-
-p <8.1|8.2|8.3|8.4>
209+
-p <8.2|8.3|8.4|8.5>
206210
Specifies the PHP minor version to be used
207-
- 8.1: (default) use PHP 8.1
208-
- 8.2: use PHP 8.2
211+
- 8.2 (default): use PHP 8.2
209212
- 8.3: use PHP 8.3
210213
- 8.4: use PHP 8.4
214+
- 8.5: use PHP 8.5
211215
212216
-x
213217
Only with -s functional|unit
@@ -255,7 +259,7 @@ TEST_SUITE="cgl"
255259
DATABASE_DRIVER=""
256260
DBMS="mysql"
257261
DBMS_VERSION=""
258-
PHP_VERSION="8.1"
262+
PHP_VERSION="8.2"
259263
PHP_XDEBUG_ON=0
260264
PHP_XDEBUG_PORT=9003
261265
CGLCHECK_DRY_RUN=0
@@ -292,7 +296,7 @@ while getopts "a:b:d:i:s:p:xy:nhu" OPT; do
292296
;;
293297
p)
294298
PHP_VERSION=${OPTARG}
295-
if ! [[ ${PHP_VERSION} =~ ^(8.1|8.2|8.3|8.4)$ ]]; then
299+
if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3|8.4|8.5)$ ]]; then
296300
INVALID_OPTIONS+=("p ${OPTARG}")
297301
fi
298302
;;

Build/phpstan/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
includes:
22
- phpstan-baseline.neon
33
parameters:
4-
level: 1
4+
level: 5
55

66
inferPrivatePropertyTypeFromConstructor: true
77
treatPhpDocTypesAsCertain: false

Build/rector/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"ssch/typo3-rector": "^2.6"
13+
"ssch/typo3-rector": "^3.11"
1414
},
1515
"config": {
1616
"bin-dir": ".Build/bin",

Build/rector/rector.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
*/
1717

1818
use Rector\Config\RectorConfig;
19-
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
2019
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
21-
use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector;
2220
use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector;
2321
use Ssch\TYPO3Rector\Configuration\Typo3Option;
2422
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
@@ -30,11 +28,11 @@
3028
__DIR__ . '/../../Configuration',
3129
__DIR__ . '/../../*.php',
3230
])
33-
->withPhpSets(php74: true)
31+
->withPhpSets(php82: true)
3432
->withSets([
3533
Typo3SetList::CODE_QUALITY,
3634
Typo3SetList::GENERAL,
37-
Typo3LevelSetList::UP_TO_TYPO3_12,
35+
Typo3LevelSetList::UP_TO_TYPO3_13,
3836
])
3937
->withImportNames(importShortClasses: false, removeUnusedImports: true)
4038
// To have a better analysis from PHPStan, we teach it here some more things
@@ -43,16 +41,12 @@
4341
])
4442
->withRules([
4543
AddVoidReturnTypeWhereNoReturnRector::class,
46-
ConvertImplicitVariablesToExplicitGlobalsRector::class,
4744
])
4845
->withConfiguredRule(ExtEmConfRector::class, [
49-
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '12.4.0-13.1.99',
46+
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.0-14.1.99',
47+
ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.5.99',
5048
ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [],
5149
])
5250
// If you use importNames(), you should consider excluding some TYPO3 files.
53-
->withSkip([
54-
// AddLiteralSeparatorToNumberRector would make the exception codes more readable.
55-
// But as they are just timestamps this is not needed/wanted.
56-
AddLiteralSeparatorToNumberRector::class,
57-
])
51+
// ->withSkip([])
5852
;

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2026-02-08 Francois Suter (Idéative) <typo3@ideative.ch>
2+
3+
* Ensure compatibility with TYPO3 14 and PHP 8.5, resolves #18
4+
15
2024-12-08 Francois Suter (Idéative) <typo3@ideative.ch>
26

37
* Release version 5.0.0

Classes/Service/ConnectorSql.php

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Cobweb\SvconnectorSql\Database\DoctrineDbalConnection;
2727
use Cobweb\SvconnectorSql\Exception\DatabaseConnectionException;
2828
use Cobweb\SvconnectorSql\Exception\QueryErrorException;
29+
use Doctrine\DBAL\Exception;
2930
use TYPO3\CMS\Core\Utility\GeneralUtility;
3031

3132
/**
@@ -50,32 +51,13 @@ public function isAvailable(): bool
5051
* This method calls the fetchArray() method and returns the result as is,
5152
* i.e. the SQL record set, but without any additional work performed on it
5253
*
53-
* @param array $parameters Parameters for the call
54-
* @return mixed Server response
5554
* @throws \Exception
5655
*/
57-
public function fetchRaw(array $parameters = [])
56+
public function fetchRaw(): mixed
5857
{
59-
// Call to parent is used only to raise flag about argument deprecation
60-
// TODO: remove once method signature is changed in next major version
61-
parent::fetchRaw(...func_get_args());
62-
6358
// Get the data as an array
6459
// NOTE: this may throw an exception, but we let it bubble up
6560
$result = $this->fetchArray();
66-
// Implement post-processing hook
67-
$hooks = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processRaw'] ?? null;
68-
if (is_array($hooks) && count($hooks) > 0) {
69-
trigger_error(
70-
'Using the processRaw hook is deprecated. Use the ProcessRawDataEvent instead',
71-
E_USER_DEPRECATED
72-
);
73-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processRaw'] as $className) {
74-
$processor = GeneralUtility::makeInstance($className);
75-
$result = $processor->processRaw($result, $this);
76-
}
77-
}
78-
/** @var ProcessRawDataEvent $event */
7961
$event = $this->eventDispatcher->dispatch(
8062
new ProcessRawDataEvent($result, $this)
8163
);
@@ -85,34 +67,15 @@ public function fetchRaw(array $parameters = [])
8567
/**
8668
* This method calls the query and returns the results from the response as an XML structure
8769
*
88-
* @param array $parameters Parameters for the call
89-
* @return string XML structure
9070
* @throws \Exception
9171
*/
92-
public function fetchXML(array $parameters = []): string
72+
public function fetchXML(): string
9373
{
94-
// Call to parent is used only to raise flag about argument deprecation
95-
// TODO: remove once method signature is changed in next major version
96-
parent::fetchXML(...func_get_args());
97-
9874
// Get the data as an array
9975
// NOTE: this may throw an exception, but we let it bubble up
10076
$result = $this->fetchArray();
10177
// Transform result to XML
10278
$xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . "\n" . GeneralUtility::array2xml($result);
103-
// Implement post-processing hook
104-
$hooks = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processXML'] ?? null;
105-
if (is_array($hooks) && count($hooks) > 0) {
106-
trigger_error(
107-
'Using the processXML hook is deprecated. Use the ProcessXmlDataEvent instead',
108-
E_USER_DEPRECATED
109-
);
110-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processXML'] as $className) {
111-
$processor = GeneralUtility::makeInstance($className);
112-
$xml = $processor->processXML($xml, $this);
113-
}
114-
}
115-
/** @var ProcessXmlDataEvent $event */
11679
$event = $this->eventDispatcher->dispatch(
11780
new ProcessXmlDataEvent($xml, $this)
11881
);
@@ -123,38 +86,20 @@ public function fetchXML(array $parameters = []): string
12386
/**
12487
* This method calls the query and returns the results from the response as a PHP array
12588
*
126-
* @param array $parameters Parameters for the call
127-
* @throws \Exception
12889
* @return array PHP array
90+
* @throws DatabaseConnectionException
91+
* @throws QueryErrorException
12992
*/
130-
public function fetchArray(array $parameters = []): array
93+
public function fetchArray(): array
13194
{
132-
// Call to parent is used only to raise flag about argument deprecation
133-
// TODO: remove once method signature is changed in next major version
134-
parent::fetchArray(...func_get_args());
135-
13695
try {
13796
$data = $this->query();
13897
$this->logger->info('Structured data', $data);
139-
140-
// Implement post-processing hook
141-
$hooks = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processArray'] ?? null;
142-
if (is_array($hooks) && count($hooks) > 0) {
143-
trigger_error(
144-
'Using the processArray hook is deprecated. Use the ProcessArrayDataEvent instead',
145-
E_USER_DEPRECATED
146-
);
147-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processArray'] as $className) {
148-
$processor = GeneralUtility::makeInstance($className);
149-
$data = $processor->processArray($data, $this);
150-
}
151-
}
15298
} catch (\Exception $e) {
15399
// Log exception and throw it further
154100
$this->logger->error('An error occurred: ' . $e->getMessage());
155101
throw $e;
156102
}
157-
/** @var ProcessArrayDataEvent $event */
158103
$event = $this->eventDispatcher->dispatch(
159104
new ProcessArrayDataEvent($data, $this)
160105
);
@@ -164,20 +109,13 @@ public function fetchArray(array $parameters = []): array
164109
/**
165110
* This method connects to the designated database, executes the given query and returns the data an an array
166111
*
167-
* NOTE: this method does not implement the "processParameters" hook,
168-
* as it does not make sense in this case
169-
*
170-
* @param array $parameters Parameters for the call
112+
* @return mixed Result of the SQL query
171113
* @throws DatabaseConnectionException
172114
* @throws QueryErrorException
173-
* @return mixed Result of the SQL query
115+
* @throws Exception
174116
*/
175-
protected function query(array $parameters = [])
117+
protected function query(): mixed
176118
{
177-
// Call to parent is used only to raise flag about argument deprecation
178-
// TODO: remove once method signature is changed in next major version
179-
parent::query(...func_get_args());
180-
181119
// Connect to the database and execute the query
182120
// NOTE: this may throw exceptions, but we let them bubble up
183121
$databaseConnection = GeneralUtility::makeInstance(DoctrineDbalConnection::class);
@@ -187,19 +125,6 @@ protected function query(array $parameters = [])
187125
(int)($this->parameters['fetchMode'] ?? 0)
188126
);
189127

190-
// Process the result if any hook is registered
191-
$hooks = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processResponse'] ?? null;
192-
if (is_array($hooks) && count($hooks) > 0) {
193-
trigger_error(
194-
'Using the processResponse hook is deprecated. Use the ProcessResponseEvent instead',
195-
E_USER_DEPRECATED
196-
);
197-
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][$this->extensionKey]['processResponse'] as $className) {
198-
$processor = GeneralUtility::makeInstance($className);
199-
$data = $processor->processResponse($data, $this);
200-
}
201-
}
202-
/** @var ProcessResponseEvent $event */
203128
$event = $this->eventDispatcher->dispatch(
204129
new ProcessResponseEvent($data, $this)
205130
);

Documentation/Index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ SQL Connector Service
2121
|release|
2222

2323
:Description:
24-
Connector service for any SQL-based database via ADODB.
24+
Connector service for any SQL-based database via PDO.
2525

2626
:Keywords:
27-
sql, database, adodb, data import, fetch data
27+
sql, database, pdo, data import, fetch data
2828

2929
:Copyright:
30-
2009-2025
30+
2009-2026
3131

3232
:Author:
3333
François Suter (Idéative)

Documentation/guides.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<project
1414
title="SQL Connector Service"
1515
release="5.0.0"
16-
copyright="2009-2025"
16+
copyright="2009-2026"
1717
/>
1818
<inventory id="svconnector" url="https://docs.typo3.org/p/cobweb/svconnector/main/en-us/"/>
1919
</guides>

Makefile

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,28 @@ fix: fix-cgl## Run all fixes
3030
test-cgl: ## Fix PHP coding styles
3131
Build/Scripts/runTests.sh -s cgl
3232

33+
.PHONY: test-unit-8-2
34+
test-unit-8-2: ## Run unit tests with PHP 8.2 (lowest)
35+
Build/Scripts/runTests.sh -s unit -p 8.2
36+
37+
.PHONY: test-unit-8-5
38+
test-unit-8-5: ## Run unit tests with PHP 8.4 (highest supported by TYPO3 13)
39+
Build/Scripts/runTests.sh -s unit -p 8.5
40+
41+
.PHONY: test-unit
42+
test-unit: test-unit-8-2 test-unit-8-5## Run unit tests with PHP 8.2 and 8.5
43+
44+
.PHONY: test-functional-8-2
45+
test-functional-8-2: ## Run functional tests with PHP 8.2 and mariadb (lowest)
46+
Build/Scripts/runTests.sh -s functional -p 8.2 -d mysql
47+
48+
.PHONY: test-functional-8-5
49+
test-functional-8-5: ## Run functional tests with PHP 8.5 and mariadb (highest supported by TYPO3 13)
50+
Build/Scripts/runTests.sh -s functional -p 8.5 -d mysql
51+
52+
.PHONY: test-functional
53+
test-functional: test-functional-8-2 test-functional-8-5## Run functional tests with PHP 8.2 and 8.5
54+
3355
.PHONY: phpstan
3456
phpstan: ## Run phpstan tests
3557
Build/Scripts/runTests.sh -s phpstan
@@ -38,5 +60,10 @@ phpstan: ## Run phpstan tests
3860
phpstan-baseline: ## Update the phpstan baseline
3961
Build/Scripts/runTests.sh -s phpstanBaseline
4062

63+
.PHONY: rector
64+
rector: ## Run rector
65+
Build/Scripts/runTests.sh -s composerUpdateRector; Build/Scripts/runTests.sh -s rector
66+
4167
.PHONY: test
42-
test: test-cgl phpstan test-docs ## Run all tests
68+
#test: test-cgl phpstan rector test-docs test-unit test-functional## Run all tests
69+
test: test-cgl phpstan rector test-docs## SQL connector has no tests so far

0 commit comments

Comments
 (0)