refactor: code quality via Rector, strict types where safe

rector.php gets the codeQuality set: declare(strict_types=1) in the 85
files where Rector finds no call relying on scalar type juggling (mostly
TCA and configuration, models, the content feed API and the import
command), "or die" as "|| die", instanceof instead of null checks for
object types, early returns and self:: in final classes.

Hotel::setRooms() goes instead of getting the property Rector wanted to
declare: nothing calls it, and there is no rooms column any more.

Checked locally: cache warmup, the ep:* commands load, frontend crawl
(~1,900 URLs) and the backchannel APIs render the same as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-26 11:15:38 +01:00
1 parent f4556ee75c
commit 4fe06267c9
114 files changed
+278 -98

No files matched your search

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace EP\EpTheme\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace EP\EpTheme\Form;
use EP\EpProducts\MyEP\ApiClient;
@@ -47,7 +47,7 @@ final readonly class CdnImageMiddleware implements MiddlewareInterface
$cdnBaseUrl = rtrim((string)($this->extensionConfiguration->get('ep_theme', 'cdnBaseUrl') ?? ''), '/');
$contentType = $response->getHeaderLine('Content-Type');
if ($cdnBaseUrl === ''
|| !(str_starts_with($contentType, 'text/html') || str_starts_with($contentType, 'application/json'))
|| !str_starts_with($contentType, 'text/html') && !str_starts_with($contentType, 'application/json')
) {
return $response;
}
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace EP\EpTheme\Middleware;
use Psr\Http\Message\ResponseInterface;
@@ -48,18 +48,18 @@ class ContainerViewHelper extends AbstractViewHelper
$content = $this->renderChildren();
$content ??= $this->arguments['content'];
$classes = [];
if (\in_array($this->arguments['data']['colPos'] ?? null, static::$columnsWithoutContainers, false)) {
if (\in_array($this->arguments['data']['colPos'] ?? null, self::$columnsWithoutContainers, false)) {
$classes[] = 'container';
}
if ($this->arguments['cssClasses'] !== null) {
$classes[] = $this->arguments['cssClasses'];
}
if (!empty($this->arguments['data']['space_before_class'])) {
$scaleTop = static::$scale[$this->arguments['data']['space_before_class']];
$scaleTop = self::$scale[$this->arguments['data']['space_before_class']];
$classes[] = sprintf('pt-%d', $scaleTop);
}
if (!empty($this->arguments['data']['space_after_class'])) {
$scaleBottom = static::$scale[$this->arguments['data']['space_after_class']];
$scaleBottom = self::$scale[$this->arguments['data']['space_after_class']];
$classes[] = sprintf('pb-%d', $scaleBottom);
}
if ('default' !== ($this->arguments['data']['frame_class'] ?? null)) {
@@ -22,7 +22,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
public function render(): string
{
$imageService = self::getImageService();
$imageService = $this->getImageService();
$sprite = $imageService->getImage('EXT:ep_theme/Resources/Public/images/icons_sprite.svg', null, false);
$imageUrl = $sprite->getPublicUrl();
@@ -33,7 +33,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
return $this->tag->render();
}
private static function getImageService()
private function getImageService()
{
return GeneralUtility::makeInstance(ImageService::class);
}
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection;
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use EP\EpTheme\Middleware\CdnImageMiddleware;
use EP\EpTheme\Middleware\ReferrerMiddleware;
use EP\EpTheme\Middleware\HtmxRedirectMiddleware;
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function () {
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function () {
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function () {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
defined('TYPO3') || die();
call_user_func(function() {
$frontendLanguageFilePrefix = 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:';
@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
use EP\EpTheme\Preview\ContentPreviewRenderer;
defined('TYPO3') or die();
defined('TYPO3') || die();
// Page module previews (Templates/PreviewRenderer/<CType>.html); loads after tt_content_element_*.php
foreach (['teaser_country', 'teaser_region', 'teaser_city', 'teaser_hotel', 'teaser_concept', 'teaser_product',
@@ -1,3 +1,5 @@
<?php
declare(strict_types=1);
$GLOBALS['TCA']['tx_eptheme_domain_model_badge']['ctrl']['security']['ignorePageTypeRestriction'] = true;
@@ -1,3 +1,5 @@
<?php
declare(strict_types=1);
$GLOBALS['TCA']['tx_eptheme_domain_model_slide']['ctrl']['security']['ignorePageTypeRestriction'] = true;
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Resource\FileType;
return [
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Resource\FileType;
return [
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\Resource\FileType;
return [
+2
View File
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
$EM_CONF[$_EXTKEY] = [
'title' => 'E&P Theme',
'description' => 'Theme package for Ep Reisen TYPO3 website',
+1 -1
View File
@@ -5,7 +5,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use EP\EpTheme\MetaTag\OpenGraphMetaTagManager;
defined('TYPO3') or die();
defined('TYPO3') || die();
$boot = function () {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['ep'] = ['Ep\\EpTheme\\ViewHelpers'];