Skip to content

Commit

Permalink
Use style linter with PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ipf committed Mar 11, 2024
1 parent cd02414 commit f73d9e4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ jobs:
run: |
sudo composer self-update
composer --version
- name: Validate composer.json and composer.lock
run: composer validate
if: ${{ matrix.env.php == "8.1" }}

- name: Cache dependencies
uses: actions/cache@v1
Expand Down
68 changes: 33 additions & 35 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

class SearchController extends ActionController
{
public $response;

protected array $requestArguments = [];

protected ?object $searchProvider = null;
Expand All @@ -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();
Expand All @@ -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']);

Expand Down Expand Up @@ -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(
Expand All @@ -166,7 +164,7 @@ protected function addStandardAssignments()
/**
* @param string $activeConnection
*/
protected function initializeConnection($activeConnection)
protected function initializeConnection($activeConnection): void
{
$connectionConfiguration = $this->settings['connections'][$activeConnection];

Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/ViewHelpers/Find/PathExistsViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function setUp(): void
/**
* @test
*/
public function returnFalseIfAPathDoesNotExist()
public function returnFalseIfAPathDoesNotExist(): void
{
$this->fixture->setArguments(
[
Expand All @@ -63,7 +63,7 @@ public function returnFalseIfAPathDoesNotExist()
/**
* @test
*/
public function returnTrueIfAPathExists()
public function returnTrueIfAPathExists(): void
{
$this->fixture->setArguments(
[
Expand Down

0 comments on commit f73d9e4

Please sign in to comment.