Fix controller argument type hints to avoid exceptions in frontend

This commit is contained in:
Björn Fromme
2022-03-21 20:23:42 +01:00
parent 00340fba1f
commit be07ec20a9
@@ -111,12 +111,15 @@ class AjaxTableController extends ActionController
* @param string $paCode * @param string $paCode
* @param string $dateFrom * @param string $dateFrom
* @param string $dateTo * @param string $dateTo
*
* @return string
* @throws \Doctrine\DBAL\DBALException
*/ */
public function datestableAction(Product $product, Hotel $hotel, $paCode = null, $dateFrom = null, $dateTo = null) public function datestableAction
{ (
Product $product,
Hotel $hotel,
string $paCode = null,
string $dateFrom = null,
string $dateTo = null
): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids); $filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
$filterSettings['dateFrom'] = $dateFrom; $filterSettings['dateFrom'] = $dateFrom;
@@ -198,19 +201,17 @@ class AjaxTableController extends ActionController
* @param Product $product * @param Product $product
* @param Hotel $hotel * @param Hotel $hotel
* @param Date $date * @param Date $date
* @param null $paCode * @param string $paCode
* @param bool $singleDate * @param bool $singleDate
* @return string
* @throws \Doctrine\DBAL\DBALException
*/ */
public function pricetableAction public function pricetableAction
( (
Product $product, Product $product,
Hotel $hotel, Hotel $hotel,
Date $date, Date $date,
$paCode = null, string $paCode = null,
bool $singleDate = false bool $singleDate = false
) { ): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true); $forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids); $filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -253,9 +254,8 @@ class AjaxTableController extends ActionController
/** /**
* @param Product $product * @param Product $product
* @param Hotel $hotel * @param Hotel $hotel
* @throws \Doctrine\DBAL\DBALException
*/ */
public function pricetableHtmlAction(Product $product, Hotel $hotel) public function pricetableHtmlAction(Product $product, Hotel $hotel): void
{ {
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) { if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
$paCode = $reseller['paCode']; $paCode = $reseller['paCode'];
@@ -269,13 +269,14 @@ class AjaxTableController extends ActionController
'template' => $this->settings['bpnBookingUrlTemplateCode'], 'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode, 'paCode' => $paCode,
]); ]);
$this->view->assign('pricetable', $pricetable); $this->view->assign('pricetable', $pricetable);
} }
/** /**
* @param Product $product * @param Product $product
*/ */
public function eventPricetableAction(Product $product) public function eventPricetableAction(Product $product): void
{ {
$roomTypes = GeneralUtility::trimExplode(',', $this->settings['priceTableRoomTypes']); $roomTypes = GeneralUtility::trimExplode(',', $this->settings['priceTableRoomTypes']);
$roomTypesPax = array_map(function ($type) { $roomTypesPax = array_map(function ($type) {
@@ -312,7 +313,7 @@ class AjaxTableController extends ActionController
* @param string $dateFrom * @param string $dateFrom
* @param string $dateTo * @param string $dateTo
*/ */
public function daytripRoomsAction(Hotel $hotel, Product $product, $dateFrom, $dateTo) public function daytripRoomsAction(Hotel $hotel, Product $product, string $dateFrom, string $dateTo): void
{ {
$period = new Period($dateFrom, $dateTo); $period = new Period($dateFrom, $dateTo);
$nights = $period->getDateInterval()->format('%a'); $nights = $period->getDateInterval()->format('%a');