refactor: private instead of protected where nothing relies on it, constructor promotion

Members (properties, methods, constants) become private when they are
declared in the class itself, no parent class or interface declares them,
no ancestor in packages/ uses them and the class has no subclass in
packages/: 115 members in 36 files. Extbase domain objects keep protected
properties, AbstractDomainObject sets them from the parent class.

With the properties private, Rector's constructor promotion now also
applies to the controllers and services that still assigned their
dependencies by hand (26 files).

Checked locally: 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:05:45 +01:00
1 parent b51fa4ddad
commit 9347112d6b
38 files changed
+140 -462

No files matched your search

@@ -14,28 +14,15 @@ class DateCommandController extends Command
{
/**
* @var DateImportService
*/
protected $dateImportService;
/**
* @var ProductImportSource
*/
protected $importSource;
/**
* @param DateImportService $importService
* @param DateImportService $dateImportService
* @param ProductImportSource $importSource
*/
public function __construct
(
DateImportService $importService,
ProductImportSource $importSource
private readonly DateImportService $dateImportService,
private readonly ProductImportSource $importSource
)
{
$this->dateImportService = $importService;
$this->importSource = $importSource;
parent::__construct();
}
@@ -13,7 +13,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class AjaxCalendarController extends ActionController
{
public function __construct(protected MyEpClient $myEpClient)
public function __construct(private readonly MyEpClient $myEpClient)
{
}
@@ -14,17 +14,11 @@ class AjaxFilterPanelController extends ActionController
use RequestArgumentTypeConversionTrait;
/**
* @var FilterService
*/
protected $filterService;
/**
* @param FilterService $filterService
*/
public function __construct(FilterService $filterService, private SearchResultService $searchResultService)
public function __construct(private FilterService $filterService, private SearchResultService $searchResultService)
{
$this->filterService = $filterService;
}
public function initializeAction(): void
@@ -15,24 +15,12 @@ class AjaxSearchController extends ActionController
use RequestArgumentTypeConversionTrait;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var SearchResultService
*/
protected $searchResultService;
/**
* @param FilterService $filterService
* @param SearchResultService $searchResultService
*/
public function __construct(FilterService $filterService, SearchResultService $searchResultService)
public function __construct(private FilterService $filterService, private SearchResultService $searchResultService)
{
$this->filterService = $filterService;
$this->searchResultService = $searchResultService;
}
public function initializeSearchresultAction()
@@ -24,36 +24,6 @@ class AjaxTableController extends ActionController
use RequestArgumentTypeConversionTrait;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var InfoboxRepository
*/
protected $infoboxRepository;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var DateService
*/
protected $dateService;
/**
* @var ResellerDataService
*/
protected $resellerDataService;
/**
* @var MyEpUrlResolverService
*/
protected $myEpUrlResolverService;
/**
* @param ProductRepository $productRepository
* @param InfoboxRepository $infoboxRepository
@@ -63,19 +33,13 @@ class AjaxTableController extends ActionController
* @param MyEpUrlResolverService $myEpUrlResolverService
*/
public function __construct(
ProductRepository $productRepository,
InfoboxRepository $infoboxRepository,
DateService $dateService,
FilterService $filterService,
ResellerDataService $resellerDataService,
MyEpUrlResolverService $myEpUrlResolverService
private ProductRepository $productRepository,
private InfoboxRepository $infoboxRepository,
private DateService $dateService,
private FilterService $filterService,
private ResellerDataService $resellerDataService,
private MyEpUrlResolverService $myEpUrlResolverService,
) {
$this->productRepository = $productRepository;
$this->infoboxRepository = $infoboxRepository;
$this->dateService = $dateService;
$this->filterService = $filterService;
$this->resellerDataService = $resellerDataService;
$this->myEpUrlResolverService = $myEpUrlResolverService;
}
public function initializeDatesAction()
@@ -309,7 +273,7 @@ class AjaxTableController extends ActionController
* @param Product $product
* @return Infobox
*/
protected function getNonBookableInfobox(Product $product)
private function getNonBookableInfobox(Product $product)
{
if (null !== $nonBookableInfo = $product->getNonBookableInfo()) {
return $nonBookableInfo;
@@ -12,36 +12,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class AjaxWatchlistController extends ActionController
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var SearchResultService
*/
protected $searchResultService;
/**
* @var FilterService
*/
protected $filterService;
/**
* @param ProductRepository $productRepository
* @param SearchResultService $searchResultService
* @param FilterService $filterService
*/
public function __construct
(
ProductRepository $productRepository,
SearchResultService $searchResultService,
FilterService $filterService
)
{
$this->productRepository = $productRepository;
$this->searchResultService = $searchResultService;
$this->filterService = $filterService;
public function __construct(
private readonly ProductRepository $productRepository,
private readonly SearchResultService $searchResultService,
private readonly FilterService $filterService,
) {
}
public function initializeAction(): void
@@ -11,18 +11,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class CityController extends ActionController
{
/**
* @var CityRepository
*/
protected $cityRepository;
/**
* @param CityRepository $cityRepository
* @param ProductDataService $productDataService
*/
public function __construct(CityRepository $cityRepository, private readonly ProductDataService $productDataService)
{
$this->cityRepository = $cityRepository;
public function __construct(
private readonly CityRepository $cityRepository,
private readonly ProductDataService $productDataService,
) {
}
/**
@@ -13,28 +13,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ConceptController extends ActionController
{
/**
* @var ConceptRepository
*/
protected $conceptRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/**
* @param ConceptRepository $conceptRepository
* @param ProductDataService $productDataService
* @param PageRepository $pageRepository
*/
public function __construct(
ConceptRepository $conceptRepository,
ProductDataService $productDataService,
private readonly ConceptRepository $conceptRepository,
private readonly ProductDataService $productDataService,
private readonly PageRepository $pageRepository,
) {
$this->conceptRepository = $conceptRepository;
$this->productDataService = $productDataService;
}
/**
@@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class CountryController extends ActionController
{
/**
* @var CountryRepository
*/
protected $countryRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/**
* @param CountryRepository $countryRepository
* @param ProductDataService $productDataService
*/
public function __construct(CountryRepository $countryRepository, ProductDataService $productDataService)
{
$this->countryRepository = $countryRepository;
$this->productDataService = $productDataService;
public function __construct(
private readonly CountryRepository $countryRepository,
private readonly ProductDataService $productDataService,
) {
}
/**
@@ -9,17 +9,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class FaqController extends ActionController
{
/**
* @var FaqRepository
*/
protected $faqRepository;
/**
* @param FaqRepository $faqRepository
*/
public function __construct(FaqRepository $faqRepository)
public function __construct(private readonly FaqRepository $faqRepository)
{
$this->faqRepository = $faqRepository;
}
public function detailAction(): ResponseInterface
@@ -15,44 +15,18 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class HotelController extends ActionController
{
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var HotelDataService
*/
protected $hotelDataService;
/**
* @var ProductDataService
*/
protected $productDataService;
/**
* @param HotelDataService $hotelDataService
* @param HotelRepository $hotelRepository
* @param ProductRepository $productRepository
* @param ProductDataService $productDataService
*/
public function __construct
(
HotelDataService $hotelDataService,
HotelRepository $hotelRepository,
ProductRepository $productRepository,
ProductDataService $productDataService
)
{
$this->hotelRepository = $hotelRepository;
$this->productRepository = $productRepository;
$this->hotelDataService = $hotelDataService;
$this->productDataService = $productDataService;
public function __construct(
private readonly HotelDataService $hotelDataService,
private readonly HotelRepository $hotelRepository,
private readonly ProductRepository $productRepository,
private readonly ProductDataService $productDataService,
) {
}
/**
@@ -14,27 +14,14 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
class MapController extends ActionController
{
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @param HotelRepository $hotelRepository
* @param ProductRepository $productRepository
*/
public function __construct(
HotelRepository $hotelRepository,
ProductRepository $productRepository
)
{
$this->hotelRepository = $hotelRepository;
$this->productRepository = $productRepository;
private readonly HotelRepository $hotelRepository,
private readonly ProductRepository $productRepository,
) {
}
public function generalAction(): ResponseInterface
@@ -89,7 +76,7 @@ class MapController extends ActionController
* @param int $pageUid
* @return string
*/
protected function getUriForPageUid($pageUid)
private function getUriForPageUid($pageUid)
{
/** @var ContentObjectRenderer $contentObject */
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
@@ -20,36 +20,6 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ProductController extends ActionController
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var ProductDataService
*/
protected $productDataService;
/**
* @var DateService
*/
protected $dateService;
/**
* @var HotelDataService
*/
protected $hotelDataService;
/**
* @param ProductRepository $productRepository
* @param ProductDataService $productDataService
@@ -61,21 +31,15 @@ class ProductController extends ActionController
* @param PickupOverviewService $pickupOverviewService
*/
public function __construct(
ProductRepository $productRepository,
ProductDataService $productDataService,
HotelRepository $hotelRepository,
HotelDataService $hotelDataService,
DateService $dateService,
FilterService $filterService,
private readonly ProductRepository $productRepository,
private readonly ProductDataService $productDataService,
private readonly HotelRepository $hotelRepository,
private readonly HotelDataService $hotelDataService,
private readonly DateService $dateService,
private readonly FilterService $filterService,
private readonly InfoboxRepository $infoboxRepository,
private readonly PickupOverviewService $pickupOverviewService
private readonly PickupOverviewService $pickupOverviewService,
) {
$this->productRepository = $productRepository;
$this->productDataService = $productDataService;
$this->hotelRepository = $hotelRepository;
$this->hotelDataService = $hotelDataService;
$this->dateService = $dateService;
$this->filterService = $filterService;
}
/**
@@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class RegionController extends ActionController
{
/**
* @var RegionRepository
*/
protected $regionRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/**
* @param RegionRepository $regionRepository
* @param ProductDataService $productDataService
*/
public function __construct(RegionRepository $regionRepository, ProductDataService $productDataService)
{
$this->regionRepository = $regionRepository;
$this->productDataService = $productDataService;
public function __construct(
private readonly RegionRepository $regionRepository,
private readonly ProductDataService $productDataService,
) {
}
/**
@@ -22,17 +22,11 @@ class SearchController extends ActionController
*/
public const SEARCHBAR_PARAMETERS = ['dateFrom', 'dateTo', 'pax', 'destinationType', 'destinationUid', 'priceRange'];
/**
* @var FilterService
*/
protected $filterService;
/**
* @param FilterService $filterService
*/
public function __construct(FilterService $filterService, private SearchResultService $searchResultService)
public function __construct(private FilterService $filterService, private SearchResultService $searchResultService)
{
$this->filterService = $filterService;
}
public function initializeSearchresultAction()
@@ -10,17 +10,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class TeamController extends ActionController
{
/**
* @var TeammemberRepository
*/
protected $teammemberRepository;
/**
* @param TeammemberRepository $teammemberRepository
*/
public function __construct(TeammemberRepository $teammemberRepository)
public function __construct(private readonly TeammemberRepository $teammemberRepository)
{
$this->teammemberRepository = $teammemberRepository;
}
public function listAction(): ResponseInterface
@@ -70,7 +70,7 @@ class TravelinfoController extends ActionController
// fetch travel data via API call
try {
$travelData = $this->apiClient->getTravel($travelCode);
} catch (ApiException $e) {
} catch (ApiException) {
$travelData = [];
}
@@ -19,67 +19,67 @@ class FilterOptions implements \JsonSerializable
/**
* @var array
*/
protected $priceRanges = [];
private $priceRanges = [];
/**
* @var array
*/
protected $destinations = [];
private $destinations = [];
/**
* @var array
*/
protected $concepts = [];
private $concepts = [];
/**
* @var array
*/
protected $pax = [];
private $pax = [];
/**
* @var array
*/
protected $nights = [];
private $nights = [];
/**
* @var array
*/
protected $hotelTypes = [];
private $hotelTypes = [];
/**
* @var array
*/
protected $boardTypes = [];
private $boardTypes = [];
/**
* @var array
*/
protected $roomTypes = [];
private $roomTypes = [];
/**
* @var \DateTime
*/
protected $dateFrom;
private $dateFrom;
/**
* @var \DateTime
*/
protected $dateTo;
private $dateTo;
/**
* @var bool
*/
protected $busAvailable;
private $busAvailable;
/**
* @var int
*/
protected $resultCount;
private $resultCount;
/**
* @var string
*/
protected $resultsUri;
private $resultsUri;
public function __construct()
{
@@ -5,18 +5,12 @@ namespace EP\EpProducts\Domain\Model;
class SearchResult
{
/**
* @var array
*/
protected $data = [];
/**
* @param array $data
* @param int $total
*/
public function __construct(array $data = [], protected $total = 0)
public function __construct(private array $data = [], private $total = 0)
{
$this->data = $data;
}
/**
@@ -201,7 +201,7 @@ class HotelRepository extends AbstractRepository
* @return QueryBuilder
* @throws \Doctrine\DBAL\DBALException
*/
protected function getQueryBuilder($excludeNonSearchable = true)
private function getQueryBuilder($excludeNonSearchable = true)
{
$qb = $this->getDbConnection()->createQueryBuilder();
@@ -6,7 +6,7 @@ class Services
/**
* @var array
*/
protected static $categoryLabels = [
private static $categoryLabels = [
'BUS' => 'Anreise',
'VPF' => 'Verpflegung',
'SPA' => 'Skipass',
@@ -63,37 +63,22 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
/**
* @var int
*/
protected $pid = 0;
private $pid = 0;
/**
* @var array
*/
protected $hotelMappings = [];
private $hotelMappings = [];
/**
* @var Connection
*/
protected $db;
/**
* @var CacheService
*/
protected $cacheService;
/**
* @var ProductImportSource
*/
protected $importSource;
/**
* @var RoomTypeResolver
*/
protected $roomTypeResolver;
private $db;
/**
* @var array
*/
static protected $cache = [
static private $cache = [
'datesAdded' => [],
];
@@ -105,14 +90,10 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
*/
public function __construct(
ExtensionConfiguration $extensionConfiguration,
CacheService $cacheService,
ProductImportSource $importSource,
RoomTypeResolver $roomTypeResolver
private CacheService $cacheService,
private ProductImportSource $importSource,
private RoomTypeResolver $roomTypeResolver
) {
$this->cacheService = $cacheService;
$this->importSource = $importSource;
$this->roomTypeResolver = $roomTypeResolver;
// Extension configuration rather than TypoScript: the import runs on the CLI, where
// TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid)
$this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid');
@@ -152,7 +133,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param iterable<array> $rows
* @return int
*/
protected function importProducts(iterable $rows): int
private function importProducts(iterable $rows): int
{
$products = [];
foreach ($rows as $row) {
@@ -206,7 +187,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[][] $dates rows grouped by travel date
* @return int
*/
protected function importProduct(string $code, int $busProId, array $dates): int
private function importProduct(string $code, int $busProId, array $dates): int
{
$dateCount = 0;
@@ -258,7 +239,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $product
* @return int
*/
protected function importDate(array $rows, array $product): int
private function importDate(array $rows, array $product): int
{
$dateCount = 0;
@@ -306,7 +287,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $row
* @return array
*/
protected function createDateRecord(array $product, array $row): array
private function createDateRecord(array $product, array $row): array
{
$dateStart = \DateTime::createFromFormat('Y-m-d', $row['date']['from']);
$dateEnd = \DateTime::createFromFormat('Y-m-d', $row['date']['to']);
@@ -477,7 +458,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $date
* @return bool
*/
protected function parseHotel(array $row, array &$date): bool
private function parseHotel(array $row, array &$date): bool
{
$code = $row['hotel']['code'];
$busProId = (int) $row['hotel']['busProId'];
@@ -526,7 +507,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $date
* @param array $services
*/
protected function parseRooms(array $row, $hotelUid, array &$date, array $services): void
private function parseRooms(array $row, $hotelUid, array &$date, array $services): void
{
$minPriceOverall = 0.0;
$minPriceAvailable = 0.0;
@@ -630,7 +611,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services
* @return float
*/
protected function determineDiscount(array $services): float
private function determineDiscount(array $services): float
{
foreach ($services as $key => $section) {
foreach ($section as $service) {
@@ -649,7 +630,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param bool $skipWithoutPrice
* @return array
*/
protected function parseService(array $services, bool $skipWithoutPrice = false): array
private function parseService(array $services, bool $skipWithoutPrice = false): array
{
$data = [];
foreach ($services as $service) {
@@ -709,7 +690,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param int $busProId
* @return array
*/
protected function parseSelectionGroup(array $selectionGroups, int $busProId): array
private function parseSelectionGroup(array $selectionGroups, int $busProId): array
{
$data = [];
foreach ($selectionGroups as $group) {
@@ -727,7 +708,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[] $selectionGroups
* @return array
*/
protected function parsePersonnelSelectionGroup(array $selectionGroups): array
private function parsePersonnelSelectionGroup(array $selectionGroups): array
{
$data = [];
foreach ($selectionGroups as $group) {
@@ -753,7 +734,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $row
* @return bool
*/
protected function isGroupTravel(array $row): bool
private function isGroupTravel(array $row): bool
{
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
@@ -771,7 +752,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
*
* @param array $row
*/
protected function checkCustomerSelection(array $row): void
private function checkCustomerSelection(array $row): void
{
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
@@ -793,7 +774,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[] $selections
* @param array $data
*/
protected function addSelections(array $selections, array &$data): void
private function addSelections(array $selections, array &$data): void
{
foreach ($selections as $selection) {
$data[(int) $selection['busProId']] = $selection['label'];
@@ -804,7 +785,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services
* @param array $date
*/
protected function processBusConditions(array $services, array &$date): void
private function processBusConditions(array $services, array &$date): void
{
if (!array_key_exists('BUS', $services)) {
return;
@@ -827,7 +808,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param string $datetime
* @return string[] date as d.m.Y and time as H:i
*/
protected function parsePickupDateTime(string $datetime): array
private function parsePickupDateTime(string $datetime): array
{
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/', $datetime, $parts)) {
return [$parts[3] . '.' . $parts[2] . '.' . $parts[1], $parts[4] . ':' . $parts[5]];
@@ -844,12 +825,12 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param string $price
* @return float
*/
protected function parseFormattedPrice(string $price): float
private function parseFormattedPrice(string $price): float
{
return (float) str_replace(['.', ','], ['', '.'], $price);
}
protected function getHotelMappings(): void
private function getHotelMappings(): void
{
$sql = '
SELECT u.code code, u.uid uid, h.name name, h.type type,
@@ -893,7 +874,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param int $uid
* @return string
*/
protected function getTopFactForRecord($table, $uid): string
private function getTopFactForRecord($table, $uid): string
{
$sql = '
SELECT f.name
@@ -911,7 +892,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services
* @param array $list
*/
protected function addServices(array $services, array &$list): void
private function addServices(array $services, array &$list): void
{
foreach ($services as $key => $section) {
if (!array_key_exists($key, $list)) {
@@ -14,30 +14,10 @@ use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
class DateService implements SingletonInterface
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var DateRepository
*/
protected $dateRepository;
/**
* @var UriBuilder
*/
protected $uriBuilder;
/**
* @var string[]
*/
protected $serviceSections = [
private $serviceSections = [
'BUS' => 'Anreise',
'VPF' => 'Verpflegung',
'SPA' => 'Skipass',
@@ -64,18 +44,12 @@ class DateService implements SingletonInterface
* @param FilterService $filterService
* @param UriBuilder $uriBuilder
*/
public function __construct
(
ProductRepository $productRepository,
DateRepository $dateRepository,
FilterService $filterService,
UriBuilder $uriBuilder
)
{
$this->productRepository = $productRepository;
$this->filterService = $filterService;
$this->dateRepository = $dateRepository;
$this->uriBuilder = $uriBuilder;
public function __construct(
private readonly ProductRepository $productRepository,
private readonly DateRepository $dateRepository,
private readonly FilterService $filterService,
private readonly UriBuilder $uriBuilder,
) {
}
/**
@@ -110,7 +84,7 @@ class DateService implements SingletonInterface
]);
}
protected function configurePriceTableOptions(OptionsResolver $resolver)
private function configurePriceTableOptions(OptionsResolver $resolver)
{
$resolver->setRequired(['product', 'hotel', 'myEpUrl']);
$resolver->setDefined(['filterSettings', 'date', 'paCode']);
@@ -143,7 +117,7 @@ class DateService implements SingletonInterface
/**
* @param OptionsResolver $resolver
*/
protected function configureDatesTableOptions(OptionsResolver $resolver)
private function configureDatesTableOptions(OptionsResolver $resolver)
{
$resolver->setDefined(['filterSettings']);
$resolver->setRequired(['product', 'hotel']);
@@ -321,7 +321,7 @@ class FilterService implements SingletonInterface
return $this->getNormalizedFilterSettings($filterSettings);
}
protected function getTypoScriptSettings(): ?array
private function getTypoScriptSettings(): ?array
{
/** @var ConfigurationManager $configurationManager */
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
@@ -9,7 +9,7 @@ class FilterSettingsEncoder
/**
* @return array
*/
protected function getMapping()
private function getMapping()
{
return [
[ 'countryUids', 'array' ],
@@ -10,24 +10,14 @@ use TYPO3\CMS\Core\SingletonInterface;
class HotelDataService implements SingletonInterface
{
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var HotelImageService
*/
protected $hotelImageService;
/**
* @param HotelRepository $hotelRepository
* @param HotelImageService $hotelImageService
*/
public function __construct(HotelRepository $hotelRepository, HotelImageService $hotelImageService)
{
$this->hotelRepository = $hotelRepository;
$this->hotelImageService = $hotelImageService;
public function __construct(
private readonly HotelRepository $hotelRepository,
private readonly HotelImageService $hotelImageService,
) {
}
/**
@@ -107,7 +97,7 @@ class HotelDataService implements SingletonInterface
* @param array $teaserData
* @return array
*/
protected function preprocessTeaserData(array $teaserData)
private function preprocessTeaserData(array $teaserData)
{
$teasers = [];
foreach ($teaserData as $row)
@@ -8,26 +8,6 @@ use TYPO3\CMS\Core\SingletonInterface;
class ProductDataService implements SingletonInterface
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var ProductImageService
*/
protected $productImageService;
/**
* @var HotelImageService
*/
protected $hotelImageService;
/**
* @param ProductRepository $productRepository
* @param HotelRepository $hotelRepository
@@ -35,15 +15,11 @@ class ProductDataService implements SingletonInterface
* @param ProductImageService $productImageService
*/
public function __construct(
ProductRepository $productRepository,
HotelRepository $hotelRepository,
HotelImageService $hotelImageService,
ProductImageService $productImageService
private readonly ProductRepository $productRepository,
private readonly HotelRepository $hotelRepository,
private readonly HotelImageService $hotelImageService,
private readonly ProductImageService $productImageService,
) {
$this->productRepository = $productRepository;
$this->hotelRepository = $hotelRepository;
$this->productImageService = $productImageService;
$this->hotelImageService = $hotelImageService;
}
/**
@@ -19,17 +19,11 @@ class ResellerDataService implements SingletonInterface
{
use DbConnectionTrait;
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @param ProductRepository $productRepository
*/
public function __construct(ProductRepository $productRepository)
public function __construct(private ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}
/**
@@ -40,8 +34,12 @@ class ResellerDataService implements SingletonInterface
* @return array
* @throws \Doctrine\DBAL\DBALException
*/
public function preprocessAll(Reseller $reseller, string $myEpUrl, ?array $imageProcessingInstructions = null, $type = 'facebook')
{
public function preprocessAll(
Reseller $reseller,
string $myEpUrl,
?array $imageProcessingInstructions = null,
$type = 'facebook',
) {
$data = [];
$products = $reseller->getProducts();
@@ -91,7 +91,7 @@ class RoomTypeResolver
* @param array $patterns
* @return bool
*/
protected function matchesAny(string $label, array $patterns): bool
private function matchesAny(string $label, array $patterns): bool
{
return array_any($patterns, fn($pattern) => str_contains(mb_strtolower($label), mb_strtolower($pattern)));
}
@@ -15,35 +15,16 @@ class SearchResultService implements SingletonInterface
public const DESTINATION_TYPE_CITY = 'city';
public const DESTINATION_TYPE_CONCEPT = 'concept';
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var HotelImageService
*/
protected $hotelImageService;
/**
* @var ProductImageService
*/
protected $productImageService;
/**
* @param ProductRepository $productRepository
* @param HotelImageService $hotelImageService
* @param ProductImageService $productImageService
*/
public function __construct(
ProductRepository $productRepository,
HotelImageService $hotelImageService,
ProductImageService $productImageService
)
{
$this->productRepository = $productRepository;
$this->hotelImageService = $hotelImageService;
$this->productImageService = $productImageService;
private readonly ProductRepository $productRepository,
private readonly HotelImageService $hotelImageService,
private readonly ProductImageService $productImageService,
) {
}
public function getNormalizedSearchParams(array $searchParams = []): array
@@ -14,12 +14,12 @@ class SerializationUtility
/**
* @var ImageService
*/
protected static $imageService;
private static $imageService;
/**
* @var ContentObjectRenderer
*/
protected static $contentObject;
private static $contentObject;
/**
* @param $text
@@ -69,7 +69,7 @@ class SerializationUtility
/**
* @return ImageService
*/
protected static function getImageService()
private static function getImageService()
{
if (static::$imageService === null) {
static::$imageService = GeneralUtility::makeInstance(ImageService::class);
@@ -11,7 +11,7 @@ class SettingsUtility
/**
* @var array
*/
protected $settings = [];
private $settings = [];
public function __construct()
{
@@ -20,7 +20,7 @@ class TypeConversionUtility
return (int) $value;
}
if (\is_array($value)) {
return array_map(fn($item) => static::convertType($item), $value);
return array_map(static::convertType(...), $value);
}
if (empty($value)) {
return null;
@@ -74,7 +74,7 @@ class SliderProcessor implements DataProcessorInterface
/**
* @return null|int
*/
protected function getParentPageWithSlides()
private function getParentPageWithSlides()
{
$rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
$rootline = $rootlineUtility->get();
@@ -53,7 +53,7 @@ class OpenGraphMetaTagManager extends \TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagMan
/**
* @return null|int
*/
protected function getPageWithImage()
private function getPageWithImage()
{
// The manager is also asked to render in the backend, where there is no frontend page
$pageInformation = $GLOBALS['TYPO3_REQUEST']?->getAttribute('frontend.page.information');
@@ -25,7 +25,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
/**
* CType => [field holding the related uid, related table, template variable]
*/
protected const RELATED_RECORDS = [
private const array RELATED_RECORDS = [
'teaser_country' => ['tx_eptheme_context_country', 'tx_epproducts_domain_model_country', 'country'],
'teaser_region' => ['tx_eptheme_context_region', 'tx_epproducts_domain_model_region', 'region'],
'teaser_city' => ['tx_eptheme_context_city', 'tx_epproducts_domain_model_city', 'city'],
@@ -63,7 +63,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
return $view->render();
}
protected function getAssignmentsForTemplate(string $cType, array $row): array
private function getAssignmentsForTemplate(string $cType, array $row): array
{
if (isset(self::RELATED_RECORDS[$cType])) {
[$field, $table, $name] = self::RELATED_RECORDS[$cType];
@@ -110,7 +110,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
return [];
}
protected function getImages(int $uid, string $table, string $field): array
private function getImages(int $uid, string $table, string $field): array
{
if ($uid <= 0) {
return [];
@@ -10,7 +10,7 @@ class ContainerViewHelper extends AbstractViewHelper
/**
* @var int[]
*/
protected static $scale = [
private static $scale = [
'default' => 0,
'small' => 8,
'large' => 16,
@@ -25,7 +25,7 @@ class ContainerViewHelper extends AbstractViewHelper
/**
* @var array
*/
protected static $columnsWithoutContainers = [ 0, 1, 3 ];
private static $columnsWithoutContainers = [ 0, 1, 3 ];
public function initializeArguments()
{
@@ -33,7 +33,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
return $this->tag->render();
}
protected static function getImageService()
private static function getImageService()
{
return GeneralUtility::makeInstance(ImageService::class);
}