diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27447c29..24a0a5b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,8 @@ jobs: - name: Check coding style run: composer lint + with: + php-version: 8.1 - name: Run Unit Tests run: | diff --git a/Classes/Controller/SearchController.php b/Classes/Controller/SearchController.php index b0f879eb..80d303ee 100644 --- a/Classes/Controller/SearchController.php +++ b/Classes/Controller/SearchController.php @@ -43,8 +43,6 @@ class SearchController extends ActionController { - public $response; - protected array $requestArguments = []; protected ?object $searchProvider = null; @@ -64,17 +62,15 @@ public function detailAction(string $id): ResponseInterface { $arguments = $this->searchProvider->getRequestArguments(); $detail = $this->searchProvider->getDocumentById($id); - + $response = $this->responseFactory->createResponse(); if ($this->request->hasArgument('underlyingQuery')) { $underlyingQueryInfo = $this->request->getArgument('underlyingQuery'); - $this->response->addAdditionalHeaderData( - FrontendUtility::addQueryInformationAsJavaScript( - $underlyingQueryInfo['q'], - $this->settings, - (int) $underlyingQueryInfo['position'], - $arguments - ) - ); + $response->withAddedHeader('detail', FrontendUtility::addQueryInformationAsJavaScript( + $underlyingQueryInfo['q'], + $this->settings, + (int) $underlyingQueryInfo['position'], + $arguments + )); } $this->addStandardAssignments(); @@ -95,36 +91,38 @@ public function indexAction(): ResponseInterface { if (array_key_exists('id', $this->requestArguments)) { return new ForwardResponse('detail'); - } else { - $this->searchProvider->setCounter(); - $this->response->addAdditionalHeaderData( - FrontendUtility::addQueryInformationAsJavaScript( - $this->searchProvider->getRequestArguments()['q'], - $this->settings, - null, - $this->searchProvider->getRequestArguments() - ) - ); - - $this->addStandardAssignments(); - $defaultQuery = $this->searchProvider->getDefaultQuery(); - - $viewValues = [ - 'arguments' => $this->searchProvider->getRequestArguments(), - 'config' => $this->searchProvider->getConfiguration(), - ]; - - CoreArrayUtility::mergeRecursiveWithOverrule($viewValues, $defaultQuery); - $this->view->assignMultiple($viewValues); } + $this->searchProvider->setCounter(); + $response = $this->responseFactory->createResponse(); + + $response->withAddedHeader('index', + FrontendUtility::addQueryInformationAsJavaScript( + $this->searchProvider->getRequestArguments()['q'], + $this->settings, + null, + $this->searchProvider->getRequestArguments() + ) + ); + + $this->addStandardAssignments(); + $defaultQuery = $this->searchProvider->getDefaultQuery(); + + $viewValues = [ + 'arguments' => $this->searchProvider->getRequestArguments(), + 'config' => $this->searchProvider->getConfiguration(), + ]; + + CoreArrayUtility::mergeRecursiveWithOverrule($viewValues, $defaultQuery); + $this->view->assignMultiple($viewValues); + return $this->htmlResponse(); } /** * Initialisation and setup. */ - protected function initializeAction() + protected function initializeAction(): void { ksort($this->settings['queryFields']); @@ -152,7 +150,7 @@ public function suggestAction(): ResponseInterface /** * Assigns standard variables to the view. */ - protected function addStandardAssignments() + protected function addStandardAssignments(): void { $this->searchProvider->setConfigurationValue('extendedSearch', $this->searchProvider->isExtendedSearch()); $this->searchProvider->setConfigurationValue( @@ -166,7 +164,7 @@ protected function addStandardAssignments() /** * @param string $activeConnection */ - protected function initializeConnection($activeConnection) + protected function initializeConnection($activeConnection): void { $connectionConfiguration = $this->settings['connections'][$activeConnection]; diff --git a/Tests/Unit/ViewHelpers/Find/PathExistsViewHelperTest.php b/Tests/Unit/ViewHelpers/Find/PathExistsViewHelperTest.php index 00d1b292..c075b691 100644 --- a/Tests/Unit/ViewHelpers/Find/PathExistsViewHelperTest.php +++ b/Tests/Unit/ViewHelpers/Find/PathExistsViewHelperTest.php @@ -49,7 +49,7 @@ protected function setUp(): void /** * @test */ - public function returnFalseIfAPathDoesNotExist() + public function returnFalseIfAPathDoesNotExist(): void { $this->fixture->setArguments( [ @@ -63,7 +63,7 @@ public function returnFalseIfAPathDoesNotExist() /** * @test */ - public function returnTrueIfAPathExists() + public function returnTrueIfAPathExists(): void { $this->fixture->setArguments( [