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 $dateFrom
* @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);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
$filterSettings['dateFrom'] = $dateFrom;
@@ -198,19 +201,17 @@ class AjaxTableController extends ActionController
* @param Product $product
* @param Hotel $hotel
* @param Date $date
* @param null $paCode
* @param string $paCode
* @param bool $singleDate
* @return string
* @throws \Doctrine\DBAL\DBALException
*/
public function pricetableAction
(
Product $product,
Hotel $hotel,
Date $date,
$paCode = null,
string $paCode = null,
bool $singleDate = false
) {
): void {
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
$filterSettings = $this->filterService->getNormalizedFilterSettings([], $forcedConceptUids);
@@ -253,9 +254,8 @@ class AjaxTableController extends ActionController
/**
* @param Product $product
* @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()) {
$paCode = $reseller['paCode'];
@@ -269,13 +269,14 @@ class AjaxTableController extends ActionController
'template' => $this->settings['bpnBookingUrlTemplateCode'],
'paCode' => $paCode,
]);
$this->view->assign('pricetable', $pricetable);
}
/**
* @param Product $product
*/
public function eventPricetableAction(Product $product)
public function eventPricetableAction(Product $product): void
{
$roomTypes = GeneralUtility::trimExplode(',', $this->settings['priceTableRoomTypes']);
$roomTypesPax = array_map(function ($type) {
@@ -312,7 +313,7 @@ class AjaxTableController extends ActionController
* @param string $dateFrom
* @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);
$nights = $period->getDateInterval()->format('%a');