refactor: apply TYPO3 13 Rector and Fractor migrations

Automated migrations from rector.php and fractor.php (TCA, Extbase
controllers and annotations, ViewHelpers, QueryBuilder, FlexForms,
TypoScript conditions).

Plugins stay list_type plugins: Rector switched them to content
element types, which needs a tt_content migration. That is deferred to
the TYPO3 14 step, where list_type is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-21 14:14:38 +02:00
1 parent 1b958a6084
commit 41b9302d9b
119 files changed
+2211 -2581

No files matched your search

@@ -19,9 +19,7 @@ class ProductRatingProcessor implements DataProcessorInterface
$qb = $this->getDbConnection()->createQueryBuilder();
$result = $qb
->selectLiteral('SUM(product.rating_votes_count) as totalCount', 'SUM(product.rating_average) as totalAverage')
->from('tx_epproducts_domain_model_product', 'product')
->execute()
->selectLiteral('SUM(product.rating_votes_count) as totalCount', 'SUM(product.rating_average) as totalAverage')->from('tx_epproducts_domain_model_product', 'product')->executeQuery()
->fetchAssociative()
;
@@ -30,9 +28,7 @@ class ProductRatingProcessor implements DataProcessorInterface
$result = $qb
->selectLiteral('COUNT(*) as ratedCount')
->from('tx_epproducts_domain_model_product', 'product')
->where($qb->expr()->gt('product.rating_average', 0))
->execute()
->from('tx_epproducts_domain_model_product', 'product')->where($qb->expr()->gt('product.rating_average', 0))->executeQuery()
->fetchAssociative()
;
@@ -101,7 +101,7 @@ class SliderProcessor implements DataProcessorInterface
*/
protected function getParentPageWithSlides()
{
$rootlineUtility = new RootlineUtility($GLOBALS['TSFE']->id);
$rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
$rootline = $rootlineUtility->get();
foreach ($rootline as $parentPage) {
@@ -26,8 +26,10 @@ namespace EP\EpTheme\DataProcessing;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\FilterSettings;
use EP\EpProducts\Domain\Model\City;
use EP\EpProducts\Domain\Model\Region;
use EP\EpProducts\Domain\Model\Country;
use EP\EpProducts\Domain\Model\Concept;
use EP\EpProducts\Domain\Repository\CityRepository;
use EP\EpProducts\Domain\Repository\ConceptRepository;
use EP\EpProducts\Domain\Repository\CountryRepository;
@@ -60,37 +62,37 @@ class TeaserProcessor implements DataProcessorInterface
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
if ((int) $processedData['data']['tx_eptheme_context_city'] > 0) {
/** @var \EP\EpProducts\Domain\Repository\CityRepository $repository */
/** @var CityRepository $repository */
$repository = $objectManager->get(CityRepository::class);
/** @var \EP\EpProducts\Domain\Model\City $city */
/** @var City $city */
$city = $repository->findByIdentifier($processedData['data']['tx_eptheme_context_city']);
$processedData['city'] = $city;
}
if ((int) $processedData['data']['tx_eptheme_context_region'] > 0) {
/** @var \EP\EpProducts\Domain\Repository\RegionRepository $repository */
/** @var RegionRepository $repository */
$repository = $objectManager->get(RegionRepository::class);
/** @var \EP\EpProducts\Domain\Model\Region $region */
/** @var Region $region */
$region = $repository->findByIdentifier($processedData['data']['tx_eptheme_context_region']);
$processedData['region'] = $region;
}
if ((int) $processedData['data']['tx_eptheme_context_country'] > 0) {
/** @var \EP\EpProducts\Domain\Repository\CountryRepository $repository */
/** @var CountryRepository $repository */
$repository = $objectManager->get(CountryRepository::class);
/** @var \EP\EpProducts\Domain\Model\Country $country */
/** @var Country $country */
$country = $repository->findByIdentifier($processedData['data']['tx_eptheme_context_country']);
$processedData['country'] = $country;
}
if ((int) $processedData['data']['tx_eptheme_context_hotel'] > 0) {
/** @var \EP\EpProducts\Service\HotelDataService $service */
/** @var HotelDataService $service */
$service = $objectManager->get(HotelDataService::class);
/** @var array $hotel */
$hotel = $service->getTeaser($processedData['data']['tx_eptheme_context_hotel']);
$processedData['hotel'] = $hotel;
}
if ((int) $processedData['data']['tx_eptheme_context_concept'] > 0) {
/** @var \EP\EpProducts\Domain\Repository\ConceptRepository $repository */
/** @var ConceptRepository $repository */
$repository = $objectManager->get(ConceptRepository::class);
/** @var \EP\EpProducts\Domain\Model\Concept $concept */
/** @var Concept $concept */
$concept = $repository->findByIdentifier($processedData['data']['tx_eptheme_context_concept']);
$processedData['concept'] = $concept;
}
@@ -116,13 +118,13 @@ class TeaserProcessor implements DataProcessorInterface
$filterSettings['dateTo'] = $dateTo->format('Y-m-d');
}
/** @var \EP\EpProducts\Service\ProductDataService $productDataService */
/** @var ProductDataService $productDataService */
$productDataService = $objectManager->get(ProductDataService::class);
$processedData['teaser'] = $productDataService->getTeaser($filterSettings);
$processedData['teaser']['forceHotelUid'] = $hotelUid;
}
$processedData['referringPageUid'] = $GLOBALS['TSFE']->id;
$processedData['referringPageUid'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId();
return $processedData;
}
@@ -9,12 +9,12 @@ class Page extends AbstractEntity
/**
* @var int
*/
protected $uid;
protected ?int $uid = null;
/**
* @var int
*/
protected $pid;
protected ?int $pid = null;
/**
* @var bool
@@ -55,7 +55,7 @@ class OpenGraphMetaTagManager extends \TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagMan
*/
protected function getPageWithImage()
{
$rootLineUtility = new RootlineUtility($GLOBALS['TSFE']->id);
$rootLineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
$rootLine = $rootLineUtility->get();
foreach ($rootLine as $page) {
@@ -29,12 +29,9 @@ namespace EP\EpTheme\ViewHelpers;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class ContainerViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var int[]
*/
@@ -70,48 +67,36 @@ class ContainerViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
$content = $renderChildrenClosure();
public function render()
{
$content = $this->renderChildren();
if ($content === null) {
$content = $arguments['content'];
$content = $this->arguments['content'];
}
$classes = [];
if (\in_array($arguments['data']['colPos'], static::$columnsWithoutContainers, false)) {
if (\in_array($this->arguments['data']['colPos'], static::$columnsWithoutContainers, false)) {
$classes[] = 'container';
}
if ($arguments['cssClasses'] !== null) {
$classes[] = $arguments['cssClasses'];
if ($this->arguments['cssClasses'] !== null) {
$classes[] = $this->arguments['cssClasses'];
}
if (!empty($arguments['data']['space_before_class'])) {
$scaleTop = static::$scale[$arguments['data']['space_before_class']];
if (!empty($this->arguments['data']['space_before_class'])) {
$scaleTop = static::$scale[$this->arguments['data']['space_before_class']];
$classes[] = sprintf('pt-%d', $scaleTop);
}
if (!empty($arguments['data']['space_after_class'])) {
$scaleBottom = static::$scale[$arguments['data']['space_after_class']];
if (!empty($this->arguments['data']['space_after_class'])) {
$scaleBottom = static::$scale[$this->arguments['data']['space_after_class']];
$classes[] = sprintf('pb-%d', $scaleBottom);
}
if ('default' !== $arguments['data']['frame_class']) {
$classes[] = $arguments['data']['frame_class'];
if ('default' !== $this->arguments['data']['frame_class']) {
$classes[] = $this->arguments['data']['frame_class'];
}
if (count($classes) > 0) {
return sprintf('<div class="%s"%s>%s</div>', implode(' ', $classes), $arguments['rteContent'] ? ' data-rte-content' : '', $content);
return sprintf('<div class="%s"%s>%s</div>', implode(' ', $classes), $this->arguments['rteContent'] ? ' data-rte-content' : '', $content);
}
if ($arguments['rteContent']) {
if ($this->arguments['rteContent']) {
return sprintf('<div data-rte-content>%s</div>', $content);
}
return $content;
}
}
@@ -30,12 +30,9 @@ namespace EP\EpTheme\ViewHelpers;
use EP\EpProducts\Service\FilterSettingsEncoder;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class FilterSettingsEncoderViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var bool
*/
@@ -54,22 +51,16 @@ class FilterSettingsEncoderViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
$argument = $renderChildrenClosure();
$argument = $this->renderChildren();
if ($argument === null) {
$argument = $arguments['argument'];
$argument = $this->arguments['argument'];
}
if ($argument === null) {
return '';
}
$encoder = new FilterSettingsEncoder();
return $encoder->encode($argument);
}
}
@@ -31,12 +31,9 @@ use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Model\Region;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class GmapsUrlViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var bool
*/
@@ -60,14 +57,10 @@ class GmapsUrlViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
$hotel = $arguments['hotel'];
$region = $arguments['region'];
$hotel = $this->arguments['hotel'];
$region = $this->arguments['region'];
if ($hotel !== null && $hotel->getLatitude() && $hotel->getLongitude()) {
$source = $hotel;
} elseif ($hotel !== null && $hotel->getRegion()->getLatitude() && $hotel->getRegion()->getLongitude()) {
@@ -77,7 +70,7 @@ class GmapsUrlViewHelper extends AbstractViewHelper
} else {
return 'http://www.google.de/maps';
}
return sprintf(static::URLBASE, $source->getLatitude(), $source->getLongitude(), $arguments['type'], $arguments['zoom']);
return sprintf(static::URLBASE, $source->getLatitude(), $source->getLongitude(), $this->arguments['type'], $this->arguments['zoom']);
}
}
@@ -16,8 +16,6 @@ class IconViewHelper extends AbstractTagBasedViewHelper
public function initializeArguments()
{
parent::initializeArguments();
$this->registerUniversalTagAttributes();
$this->registerArgument('icon', 'string', 'Icon name', true);
}
@@ -6,23 +6,17 @@ use EP\EpProducts\Service\MyEpUrlResolverService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class MyEpUrlViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return string
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
): string {
public function render(): string
{
return GeneralUtility::makeInstance(MyEpUrlResolverService::class)->resolve();
}
}
@@ -29,12 +29,9 @@ namespace EP\EpTheme\ViewHelpers;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class NightsOptionsViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
public function initializeArguments()
{
parent::initializeArguments();
@@ -49,16 +46,12 @@ class NightsOptionsViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
if ($arguments['daytrip']) {
if ($this->arguments['daytrip']) {
return 'Tageweise buchbar';
}
$options = $arguments['options'];
$options = $this->arguments['options'];
if ($options === null) {
return '';
}
@@ -74,7 +67,6 @@ class NightsOptionsViewHelper extends AbstractViewHelper
$output = $lastOption;
}
$output .= (int) $lastOption > 1 ? ' Nächte' : ' Nacht';
return $output;
}
@@ -30,12 +30,9 @@ namespace EP\EpTheme\ViewHelpers;
use EP\EpProducts\Domain\Model\Product;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class RatingViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var bool
*/
@@ -54,22 +51,17 @@ class RatingViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
$product = $renderChildrenClosure();
$product = $this->renderChildren();
if ($product === null) {
$product = $arguments['product'];
$product = $this->arguments['product'];
}
$ratingAverage = $product->getRatingAverage();
$ratingVotesCount = $product->getRatingVotesCount();
$fullStars = floor($ratingAverage);
$halfStar = ($ratingAverage - $fullStars) > 0;
$ratingAverageLabel = number_format($ratingAverage, 1, ',', '.');
$content = '';
for ($i = 1; $i <= $fullStars; $i++)
{
@@ -79,7 +71,6 @@ class RatingViewHelper extends AbstractViewHelper
$content .= '<i class="fa fa-star-half-o" aria-hidden="true"></i>';
}
$content .= sprintf('%s Sterne (%d)', $ratingAverageLabel, $ratingVotesCount);
return $content;
}
@@ -29,12 +29,9 @@ namespace EP\EpTheme\ViewHelpers;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class ThemeClassesViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
public function initializeArguments()
{
parent::initializeArguments();
@@ -49,18 +46,12 @@ class ThemeClassesViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
$themeKey = $arguments['key'];
if (!array_key_exists($themeKey, $arguments['classes'])) {
$themeKey = $this->arguments['key'];
if (!array_key_exists($themeKey, $this->arguments['classes'])) {
return '';
}
return $arguments['classes'][$themeKey];
return $this->arguments['classes'][$themeKey];
}
}
@@ -70,7 +70,7 @@ class AjaxViewHelper extends ActionViewHelper
// Use root page uid as target unless provided
if ($arguments['pageUid'] === null) {
$rootlineUtility = new RootlineUtility($GLOBALS['TSFE']->id);
$rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
$rootline = $rootlineUtility->get();
$rootPage = array_pop($rootline);
$arguments['pageUid'] = $rootPage['uid'];
@@ -29,12 +29,9 @@ namespace EP\EpTheme\ViewHelpers\Uri;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class ProductViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
public function initializeArguments()
{
parent::initializeArguments();
@@ -53,25 +50,21 @@ class ProductViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
$product = $arguments['product'];
$hotel = $arguments['hotel'];
if ($arguments['forceHotelUid']) {
public function render()
{
$product = $this->arguments['product'];
$hotel = $this->arguments['hotel'];
if ($this->arguments['forceHotelUid']) {
// Product detail page with forced hotel
$linkArguments = [
'product' => is_array($product) ? $product['uid'] : $product,
'hotel' => is_array($hotel) ? $hotel['uid'] : $hotel,
];
} elseif ($arguments['dateFrom'] || $arguments['dateTo']) {
} elseif ($this->arguments['dateFrom'] || $this->arguments['dateTo']) {
// Product detail page with forced date range
$linkArguments = [
'dateFrom' => $arguments['dateFrom'],
'dateTo' => $arguments['dateTo'],
'dateFrom' => $this->arguments['dateFrom'],
'dateTo' => $this->arguments['dateTo'],
];
} else {
// Default product detail page by product uid
@@ -79,24 +72,20 @@ class ProductViewHelper extends AbstractViewHelper
'product' => is_array($product) ? $product['uid'] : $product,
];
}
$targetPageUid = is_array($product) ? (int)$product['detailPage'] : $product->getDetailPage();
$uri = $renderingContext
$uri = $this->renderingContext
->getControllerContext()
->getUriBuilder()
->reset()
->setTargetPageUid($targetPageUid)
->uriFor('detail', $linkArguments, 'Product', 'epproducts', 'product_detail')
;
if ($arguments['ref']) {
$referringPageUri = urlencode($arguments['ref']);
if ($this->arguments['ref']) {
$referringPageUri = urlencode($this->arguments['ref']);
$hasQuery = null !== parse_url($uri, PHP_URL_QUERY);
$separator = $hasQuery ? '&' : '?';
$uri .= $separator . 'ref=' . $referringPageUri;
}
return $uri;
}
@@ -29,12 +29,9 @@ namespace EP\EpTheme\ViewHelpers\Uri;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class VideoViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;
/**
* @var bool
*/
@@ -54,21 +51,16 @@ class VideoViewHelper extends AbstractViewHelper
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
public function render()
{
// YouTube
if ((int) $arguments['layout'] === 0) {
return $arguments['value'] . '?rel=0&amp;controls=0&amp;showinfo=0';
if ((int) $this->arguments['layout'] === 0) {
return $this->arguments['value'] . '?rel=0&amp;controls=0&amp;showinfo=0';
}
// Vimeo
if ((int) $arguments['layout'] === 1) {
return sprintf('https://player.vimeo.com/video/%d?html5=1', $arguments['value']);
if ((int) $this->arguments['layout'] === 1) {
return sprintf('https://player.vimeo.com/video/%d?html5=1', $this->arguments['value']);
}
return '';
}