Extension Upgrade to PHP 8.4
Compatibility: PHP 8.4+, TYPO3 v13.x and v14.x
Related Skills:
- typo3-extension-upgrade - Main extension upgrade guide
- php-modernization/SKILL-PHP84 - PHP 8.4 features
1. Extension Compatibility Check
composer.json Update
{
"require": {
"php": "^8.2",
"typo3/cms-core": "^13.0 || ^14.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"rector/rector": "^1.0"
}
}
ext_emconf.php
<?php
$EM_CONF[$_EXTKEY] = [
'title' => 'My Extension',
'version' => '3.0.0',
'constraints' => [
'depends' => [
'typo3' => '13.0.0-14.99.99',
],
],
];
2. Rector Configuration for PHP 8.4
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/Classes',
__DIR__ . '/Tests',
])
->withSets([
LevelSetList::UP_TO_PHP_84,
Typo3LevelSetList::UP_TO_TYPO3_14,
]);
3. Common PHP 8.4 Fixes
Implicit Nullable
# Find all occurrences
grep -rn "= null" Classes/ | grep -v "?.*= null"
// Fix pattern
// Before
public function setUser(User $user = null): void
// After
public function setUser(?User $user = null): void
Deprecated Functions
Check for deprecated function usage:
ddev exec vendor/bin/phpstan analyse --level=9
4. PHPStan for PHP 8.4
phpstan.neon
parameters:
phpVersion: 80400
level: 9
paths:
- Classes
excludePaths:
- Classes/Domain/Model/*
5. Testing Matrix
GitHub Actions
jobs:
test:
strategy:
matrix:
php: ['8.2', '8.3', '8.4']
typo3: ['^13.0', '^14.0']
exclude:
- php: '8.2'
typo3: '^14.0'
6. Upgrade Checklist
- Update composer.json PHP constraint
- Run Rector with PHP 8.4 rules
- Fix implicit nullable parameters
- Run PHPStan at level 9
- Test on PHP 8.4 environment
- Update CI matrix
References
Credits & Attribution
This skill is part of the webconsulting.at TYPO3 skills collection.