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 17ed08d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 44 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.env.php }}
tools: composer
tools: composer:2
extensions: pdo, sqlite3

# composer
- name: Update Composer
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 17ed08d

Please sign in to comment.