Skip to content

Commit 2b577ca

Browse files
authored
Updated codebase to PHP 8.0 (#53)
1 parent 2e8add2 commit 2b577ca

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

src/DispatchMessageJobLauncher.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@
1616
*/
1717
final class DispatchMessageJobLauncher implements JobLauncherInterface
1818
{
19-
private JobExecutionFactory $jobExecutionFactory;
20-
private JobExecutionStorageInterface $jobExecutionStorage;
21-
private MessageBusInterface $messageBus;
22-
2319
public function __construct(
24-
JobExecutionFactory $jobExecutionFactory,
25-
JobExecutionStorageInterface $jobExecutionStorage,
26-
MessageBusInterface $messageBus
20+
private JobExecutionFactory $jobExecutionFactory,
21+
private JobExecutionStorageInterface $jobExecutionStorage,
22+
private MessageBusInterface $messageBus,
2723
) {
28-
$this->jobExecutionFactory = $jobExecutionFactory;
29-
$this->messageBus = $messageBus;
30-
$this->jobExecutionStorage = $jobExecutionStorage;
3124
}
3225

3326
/**
@@ -38,7 +31,7 @@ public function launch(string $name, array $configuration = []): JobExecution
3831
// create and store execution before dispatching message
3932
// guarantee job execution exists if message bus transport is asynchronous
4033
$jobExecution = $this->jobExecutionFactory->create($name, $configuration);
41-
$configuration['_id'] = $configuration['_id'] ?? $jobExecution->getId();
34+
$configuration['_id'] ??= $jobExecution->getId();
4235
$jobExecution->setStatus(BatchStatus::PENDING);
4336
$this->jobExecutionStorage->store($jobExecution);
4437

src/LaunchJobMessage.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@
99
*/
1010
final class LaunchJobMessage
1111
{
12-
private string $jobName;
13-
14-
/**
15-
* @phpstan-var array<string, mixed>
16-
*/
17-
private array $configuration;
18-
19-
/**
20-
* @phpstan-param array<string, mixed> $configuration
21-
*/
22-
public function __construct(string $jobName, array $configuration = [])
23-
{
24-
$this->jobName = $jobName;
25-
$this->configuration = $configuration;
12+
public function __construct(
13+
private string $jobName,
14+
/**
15+
* @phpstan-var array<string, mixed>
16+
*/
17+
private array $configuration = [],
18+
) {
2619
}
2720

2821
public function getJobName(): string

src/LaunchJobMessageHandler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
*/
1313
final class LaunchJobMessageHandler implements MessageHandlerInterface
1414
{
15-
private JobLauncherInterface $jobLauncher;
16-
17-
public function __construct(JobLauncherInterface $jobLauncher)
18-
{
19-
$this->jobLauncher = $jobLauncher;
15+
public function __construct(
16+
private JobLauncherInterface $jobLauncher,
17+
) {
2018
}
2119

2220
public function __invoke(LaunchJobMessage $message): void

0 commit comments

Comments
 (0)