Skip to content

Commit d963741

Browse files
#60 Fix PHP 8.1 restrictions
1 parent c91aed9 commit d963741

11 files changed

+64
-29
lines changed

src/Entity/ProcessSchedule.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ public function setContext(array $context): void
8787
$this->context = $context;
8888
}
8989

90-
public function getNextExecution(): null
90+
/**
91+
* PHP 8.1 Fatal error: Null can not be used as a standalone type.
92+
*
93+
* @phpstan-ignore missingType.return
94+
*/
95+
public function getNextExecution()
9196
{
9297
return null;
9398
}

src/EventSubscriber/ProcessEventSubscriber.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2323
use Symfony\Component\Uid\Uuid;
2424

25-
final readonly class ProcessEventSubscriber implements EventSubscriberInterface
25+
/**
26+
* PHP 8.2 : Replace by readonly class.
27+
*/
28+
final class ProcessEventSubscriber implements EventSubscriberInterface
2629
{
2730
public function __construct(
28-
private ProcessHandler $processHandler,
29-
private DoctrineProcessHandler $doctrineProcessHandler,
30-
private ProcessExecutionManager $processExecutionManager,
31+
private readonly ProcessHandler $processHandler,
32+
private readonly DoctrineProcessHandler $doctrineProcessHandler,
33+
private readonly ProcessExecutionManager $processExecutionManager,
3134
) {
3235
}
3336

src/Http/Model/HttpProcessExecution.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@
2020
use Symfony\Component\Validator\Constraints\Sequentially;
2121
use Symfony\Component\Validator\Constraints\Type;
2222

23-
final readonly class HttpProcessExecution
23+
/**
24+
* PHP 8.2 : Replace by readonly class.
25+
*/
26+
final class HttpProcessExecution
2427
{
2528
/**
2629
* @param string|array<string|int, mixed> $context
2730
*/
2831
public function __construct(
2932
#[Sequentially(constraints: [new NotNull(message: 'Process code is required.'), new IsValidProcessCode()])]
30-
public ?string $code = null,
31-
public ?string $input = null,
33+
public readonly ?string $code = null,
34+
public readonly ?string $input = null,
3235
#[AtLeastOneOf(constraints: [new Json(), new Type('array')])]
33-
public string|array $context = [],
34-
public bool $queue = true,
36+
public readonly string|array $context = [],
37+
public readonly bool $queue = true,
3538
) {
3639
}
3740
}

src/Http/ValueResolver/HttpProcessExecuteValueResolver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2323
use Symfony\Component\Serializer\SerializerInterface;
2424

25+
/**
26+
* PHP 8.2 : Replace by readonly class.
27+
*/
2528
#[AsTargetedValueResolver('http_process_execution')]
26-
readonly class HttpProcessExecuteValueResolver implements ValueResolverInterface
29+
class HttpProcessExecuteValueResolver implements ValueResolverInterface
2730
{
28-
public function __construct(private string $storageDir, private SerializerInterface $serializer)
31+
public function __construct(private readonly string $storageDir, private readonly SerializerInterface $serializer)
2932
{
3033
}
3134

src/Http/ValueResolver/ProcessConfigurationValueResolver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
2121
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2222

23+
/**
24+
* PHP 8.2 : Replace by readonly class.
25+
*/
2326
#[AsTargetedValueResolver('process')]
24-
readonly class ProcessConfigurationValueResolver implements ValueResolverInterface
27+
class ProcessConfigurationValueResolver implements ValueResolverInterface
2528
{
26-
public function __construct(private ProcessConfigurationRegistry $registry)
29+
public function __construct(private readonly ProcessConfigurationRegistry $registry)
2730
{
2831
}
2932

src/Manager/ProcessConfigurationsManager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
use Symfony\Component\OptionsResolver\OptionsResolver;
2121
use Symfony\Component\Validator\Constraint;
2222

23+
/**
24+
* PHP 8.2 : Replace by readonly class.
25+
*/
2326
/**
2427
* @phpstan-type UiOptions array{
2528
* 'source': ?string,
@@ -32,9 +35,9 @@
3235
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
3336
* }
3437
*/
35-
final readonly class ProcessConfigurationsManager
38+
final class ProcessConfigurationsManager
3639
{
37-
public function __construct(private ProcessConfigurationRegistry $registry)
40+
public function __construct(private readonly ProcessConfigurationRegistry $registry)
3841
{
3942
}
4043

src/Message/CronProcessMessage.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515

1616
use CleverAge\UiProcessBundle\Entity\ProcessSchedule;
1717

18-
final readonly class CronProcessMessage
18+
/**
19+
* PHP 8.2 : Replace by readonly class.
20+
*/
21+
final class CronProcessMessage
1922
{
20-
public function __construct(public ProcessSchedule $processSchedule)
23+
public function __construct(public readonly ProcessSchedule $processSchedule)
2124
{
2225
}
2326
}

src/Message/CronProcessMessageHandler.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
1717
use Symfony\Component\Messenger\MessageBusInterface;
1818

19+
/**
20+
* PHP 8.2 : Replace by readonly class.
21+
*/
1922
#[AsMessageHandler]
20-
final readonly class CronProcessMessageHandler
23+
final class CronProcessMessageHandler
2124
{
22-
public function __construct(private MessageBusInterface $bus)
25+
public function __construct(private readonly MessageBusInterface $bus)
2326
{
2427
}
2528

src/Message/ProcessExecuteHandler.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
use CleverAge\UiProcessBundle\Monolog\Handler\ProcessHandler;
1818
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
1919

20+
/**
21+
* PHP 8.2 : Replace by readonly class.
22+
*/
2023
#[AsMessageHandler]
21-
readonly class ProcessExecuteHandler
24+
class ProcessExecuteHandler
2225
{
23-
public function __construct(private ProcessManager $manager, private readonly ProcessHandler $processHandler)
26+
public function __construct(private readonly ProcessManager $manager, private readonly ProcessHandler $processHandler)
2427
{
2528
}
2629

src/Scheduler/CronScheduler.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
use Symfony\Component\Scheduler\ScheduleProviderInterface;
2323
use Symfony\Component\Validator\Validator\ValidatorInterface;
2424

25-
readonly class CronScheduler implements ScheduleProviderInterface
25+
/**
26+
* PHP 8.2 : Replace by readonly class.
27+
*/
28+
class CronScheduler implements ScheduleProviderInterface
2629
{
2730
public function __construct(
28-
private ProcessScheduleRepository $repository,
29-
private ValidatorInterface $validator,
30-
private LoggerInterface $logger,
31+
private readonly ProcessScheduleRepository $repository,
32+
private readonly ValidatorInterface $validator,
33+
private readonly LoggerInterface $logger,
3134
) {
3235
}
3336

0 commit comments

Comments
 (0)