Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

chore: apply Rector 7.4 ruleset #94

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions config/application.config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$config = array(
'modules' => array(
$config = [
'modules' => [
'Dvsa\LaminasConfigCloudParameters',
'Laminas\Cache\Module',
'Laminas\Cache\Storage\Adapter\Redis',
Expand All @@ -24,24 +24,24 @@
'Olcs',
'LmcRbacMvc',
'Permits',
),
],
// These are various options for the listeners attached to the ModuleManager
'module_listener_options' => array(
'module_listener_options' => [
// This should be an array of paths in which modules reside.
// If a string key is provided, the listener will consider that a module
// namespace, the value of that key the specific path to that module's
// Module class.
'module_paths' => array(
'module_paths' => [
__DIR__ . '/../module',
__DIR__ . '/../vendor'
),
],

// An array of paths from which to glob configuration files after
// modules are loaded. These effectively override configuration
// provided by modules themselves. Paths may use GLOB_BRACE notation.
'config_glob_paths' => array(
'config_glob_paths' => [
realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php',
),
],

// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
Expand All @@ -66,8 +66,8 @@
// Enabled by default, prevents usage of modules that depend on other modules
// that weren't loaded.
// 'check_dependencies' => true,
),
);
],
];

if (file_exists(__DIR__ . '/../vendor/laminas/laminas-developer-tools/src/Module.php')) {
$config['modules'][] = 'Laminas\DeveloperTools';
Expand Down
2 changes: 1 addition & 1 deletion module/Application/config/authorization.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'guards' => [
'LmcRbacMvc\Guard\RoutePermissionsGuard' => [
\LmcRbacMvc\Guard\RoutePermissionsGuard::class => [
'lva-application/transport_manager*' => ['selfserve-tm'],
'lva-application' => ['selfserve-lva'],
'lva-application/*' => ['selfserve-lva'],
Expand Down
8 changes: 3 additions & 5 deletions module/Application/src/View/Model/ApplicationOverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class ApplicationOverview extends LvaOverview
* @param array $sections Sections array
* @param null $submissionForm Submission form
*/
public function __construct($data, array $sections = array(), $submissionForm = null)
public function __construct($data, array $sections = [], $submissionForm = null)
{
$this->setVariable('applicationId', $data['id']);
$this->setVariable('licNo', isset($data['licence']['licNo']) ? $data['licence']['licNo'] : '');
$this->setVariable('licNo', $data['licence']['licNo'] ?? '');
$this->setVariable('createdOn', date('d F Y', strtotime($data['createdOn'])));
$this->setVariable('status', $data['status']['id']);
$this->setVariable('submissionForm', $submissionForm);
Expand All @@ -40,9 +40,7 @@ public function __construct($data, array $sections = array(), $submissionForm =

$completedSections = array_filter(
$sections,
function ($section) {
return isset($section['complete']) && $section['complete'] == true;
}
fn($section) => isset($section['complete']) && $section['complete'] == true
);
$this->setVariable('progressX', count($completedSections));
$this->setVariable('progressY', count($sections));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public function __construct($ref, $data, $sectionDetails)
$filter = new \Laminas\Filter\Word\DashToCamelCase();
$index = lcfirst($filter->filter(str_replace('_', '-', $ref)));

$status = isset($data['applicationCompletion'][$index . 'Status'])
? $data['applicationCompletion'][$index . 'Status']
: null;
$status = $data['applicationCompletion'][$index . 'Status'] ?? null;

switch ($status) {
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,7 @@ public function indexAction_WhenPosting_AndAUserSelectsReturnToOverview_AndYes_U
$this->sut->indexAction($request, $this->routeMatch());

// Assert
$this->commandSender()->shouldHaveReceived('send')->withArgs(function ($command) {
return $this->assertCommandUpdatesVehicleSectionToBeIncomplete($command);
});
$this->commandSender()->shouldHaveReceived('send')->withArgs(fn($command) => $this->assertCommandUpdatesVehicleSectionToBeIncomplete($command));
}

/**
Expand Down Expand Up @@ -771,9 +769,7 @@ public function indexAction_WhenPosting_WhenAUserSelectsNext_AndYes_UpdateVehicl
}

// Assert
$this->commandSender()->shouldHaveReceived('send')->withArgs(function ($command) {
return $this->assertCommandUpdatesVehicleSectionToBeIncomplete($command);
});
$this->commandSender()->shouldHaveReceived('send')->withArgs(fn($command) => $this->assertCommandUpdatesVehicleSectionToBeIncomplete($command));
}

/**
Expand Down Expand Up @@ -816,9 +812,7 @@ public function indexAction_WhenPosting_WhenAUserSelectsNext_AndNo_UpdateVehicle
$this->sut->indexAction($request, $this->routeMatch());

// Assert
$this->commandSender()->shouldHaveReceived('send')->withArgs(function ($command) {
return $this->assertCommandUpdatesVehicleSectionToBeCompleted($command);
});
$this->commandSender()->shouldHaveReceived('send')->withArgs(fn($command) => $this->assertCommandUpdatesVehicleSectionToBeCompleted($command));
}

/**
Expand All @@ -836,9 +830,7 @@ public function indexAction_WhenPosting_WhenAUserSelectsSaveAndReturnToOverview_
$this->sut->indexAction($request, $this->routeMatch());

// Assert
$this->commandSender()->shouldHaveReceived('send')->withArgs(function ($command) {
return $this->assertCommandUpdatesVehicleSectionToBeCompleted($command);
});
$this->commandSender()->shouldHaveReceived('send')->withArgs(fn($command) => $this->assertCommandUpdatesVehicleSectionToBeCompleted($command));
}

/**
Expand Down Expand Up @@ -1186,9 +1178,7 @@ protected function queryHandler(): MockInterface
return $response;
})->byDefault();

$instance->allows('__invoke')->with(IsInstanceOf::anInstanceOf(Application::class))->andReturnUsing(function () {
return $this->applicationCqrsResponse();
})->byDefault();
$instance->allows('__invoke')->with(IsInstanceOf::anInstanceOf(Application::class))->andReturnUsing(fn() => $this->applicationCqrsResponse())->byDefault();

$this->serviceManager->setService(HandleQuery::class, $instance);
}
Expand Down Expand Up @@ -1270,9 +1260,7 @@ protected function commandSender(): MockInterface
{
if (! $this->serviceManager->has(CommandSender::class)) {
$instance = $this->setUpMockService(CommandSender::class);
$instance->allows('send')->andReturnUsing(function () {
return $this->cqrsResponse();
})->byDefault();
$instance->allows('send')->andReturnUsing(fn() => $this->cqrsResponse())->byDefault();
$this->serviceManager->setService(CommandSender::class, $instance);
}
return $this->serviceManager->get(CommandSender::class);
Expand Down
12 changes: 6 additions & 6 deletions module/Olcs/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public function getConfig()
*/
public function getAutoloaderConfig()
{
return array(
'Laminas\Loader\StandardAutoloader' => array(
'namespaces' => array(
return [
\Laminas\Loader\StandardAutoloader::class => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/',
),
),
);
],
],
];
}

/**
Expand Down
Loading
Loading