Skip to content
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
2 changes: 1 addition & 1 deletion .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.2-fpm-alpine
FROM php:8.4-fpm-alpine

ARG UID
ARG GID
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
tools: composer:v2
- name: Install Composer dependencies (locked)
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
tools: composer:v2
- name: Install Composer dependencies (locked)
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
tools: composer:v2
- name: Install Composer dependencies (locked)
Expand All @@ -70,7 +70,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.4'
coverage: none
tools: composer:v2
- name: Install Composer dependencies (locked)
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ jobs:
php-version:
- '8.2'
- '8.3'
- '8.4'
dependencies: [highest]
allowed-to-fail: [false]
symfony-require: ['']
variant: [normal]
include:
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
Expand All @@ -35,8 +41,8 @@ jobs:
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.1.*
variant: symfony/symfony:"7.1.*"
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
Expand All @@ -45,8 +51,18 @@ jobs:
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.1.*
variant: symfony/symfony:"7.1.*"
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"

steps:
- name: Checkout
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
"doctrine/orm": "^2.9 || ^3.0",
"dragonmantank/cron-expression": "^3.4",
"easycorp/easyadmin-bundle": "^4.8",
"symfony/doctrine-messenger": "^6.4|^7.1",
"symfony/dotenv": "^6.4|^7.1",
"symfony/messenger": "^6.4|^7.1",
"symfony/runtime": "^6.4|^7.1",
"symfony/scheduler": "^6.4|^7.1",
"symfony/string": "^6.4|^7.1",
"symfony/uid": "^6.4|^7.1"
"symfony/doctrine-messenger": "^6.4|^7.3",
"symfony/dotenv": "^6.4|^7.3",
"symfony/messenger": "^6.4|^7.3",
"symfony/runtime": "^6.4|^7.3",
"symfony/scheduler": "^6.4|^7.3",
"symfony/string": "^6.4|^7.3",
"symfony/uid": "^6.4|^7.3"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
Expand All @@ -65,11 +65,11 @@
"phpunit/phpunit": "<10.0",
"rector/rector": "*",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^6.4|^7.1",
"symfony/css-selector": "^6.4|^7.1",
"symfony/debug-bundle": "^6.4|^7.1",
"symfony/browser-kit": "^6.4|^7.3",
"symfony/css-selector": "^6.4|^7.3",
"symfony/debug-bundle": "^6.4|^7.3",
"symfony/maker-bundle": "^1.31",
"symfony/web-profiler-bundle": "^6.4|^7.1",
"symfony/web-profiler-bundle": "^6.4|^7.3",
"vincentlanglet/twig-cs-fixer": "^3.3"
},
"conflict": {
Expand Down
18 changes: 6 additions & 12 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,25 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\ValueObject\PhpVersion;

return RectorConfig::configure()
->withPhpVersion(PhpVersion::PHP_82)
->withPhpVersion(PhpVersion::PHP_84)
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withPhpSets(php82: true)
->withPhpSets(php81: true)
// here we can define, what prepared sets of rules will be applied
->withPreparedSets(
deadCode: true,
codeQuality: true
)
->withComposerBased(doctrine: true)
->withPreparedSets(deadCode: true, codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true)
->withAttributesSets(symfony: true, doctrine: true)
->withSets([
LevelSetList::UP_TO_PHP_82,
LevelSetList::UP_TO_PHP_81,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_71,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
])
;
5 changes: 5 additions & 0 deletions src/Controller/Admin/LogRecordCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Http\Attribute\IsGranted;

/**
* @phpstan-template TEntity of AbstractCrudController
*
* @phpstan-extends AbstractCrudController<LogRecord>
*/
#[IsGranted('ROLE_USER')]
class LogRecordCrudController extends AbstractCrudController
{
Expand Down
9 changes: 8 additions & 1 deletion src/Controller/Admin/ProcessExecutionCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* @phpstan-template TEntity of AbstractCrudController
*
* @phpstan-extends AbstractCrudController<ProcessExecution>
*/
#[IsGranted('ROLE_USER')]
class ProcessExecutionCrudController extends AbstractCrudController
{
Expand Down Expand Up @@ -117,7 +122,9 @@ public function showLogs(AdminContext $adminContext): RedirectResponse
[
'process' => [
'comparison' => '=',
'value' => $this->getContext()?->getEntity()->getInstance()->getId(),
'value' => $this->getContext()?->getEntity()->getInstance() instanceof ProcessExecution
? $this->getContext()->getEntity()->getInstance()->getId()
: null,
],
]
)
Expand Down
5 changes: 5 additions & 0 deletions src/Controller/Admin/ProcessScheduleCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
use Symfony\Component\Process\Process;
use Symfony\Component\Scheduler\Trigger\CronExpressionTrigger;

/**
* @phpstan-template TEntity of AbstractCrudController
*
* @phpstan-extends AbstractCrudController<ProcessSchedule>
*/
class ProcessScheduleCrudController extends AbstractCrudController
{
public function __construct(private readonly ProcessConfigurationsManager $processConfigurationsManager)
Expand Down
5 changes: 5 additions & 0 deletions src/Controller/Admin/UserCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
use Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher;
use Symfony\Component\Security\Http\Attribute\IsGranted;

/**
* @phpstan-template TEntity of AbstractCrudController
*
* @phpstan-extends AbstractCrudController<User>
*/
#[IsGranted('ROLE_USER')]
class UserCrudController extends AbstractCrudController
{
Expand Down
7 changes: 6 additions & 1 deletion src/Entity/ProcessSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ public function setContext(array $context): void
$this->context = $context;
}

public function getNextExecution(): null
/**
* PHP 8.1 Fatal error: Null can not be used as a standalone type.
*
* @phpstan-ignore missingType.return
*/
public function getNextExecution()
{
return null;
}
Expand Down
11 changes: 7 additions & 4 deletions src/EventSubscriber/ProcessEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Uid\Uuid;

final readonly class ProcessEventSubscriber implements EventSubscriberInterface
/**
* PHP 8.2 : Replace by readonly class.
*/
final class ProcessEventSubscriber implements EventSubscriberInterface
{
public function __construct(
private ProcessHandler $processHandler,
private DoctrineProcessHandler $doctrineProcessHandler,
private ProcessExecutionManager $processExecutionManager,
private readonly ProcessHandler $processHandler,
private readonly DoctrineProcessHandler $doctrineProcessHandler,
private readonly ProcessExecutionManager $processExecutionManager,
) {
}

Expand Down
13 changes: 8 additions & 5 deletions src/Http/Model/HttpProcessExecution.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
use Symfony\Component\Validator\Constraints\Sequentially;
use Symfony\Component\Validator\Constraints\Type;

final readonly class HttpProcessExecution
/**
* PHP 8.2 : Replace by readonly class.
*/
final class HttpProcessExecution
{
/**
* @param string|array<string|int, mixed> $context
*/
public function __construct(
#[Sequentially(constraints: [new NotNull(message: 'Process code is required.'), new IsValidProcessCode()])]
public ?string $code = null,
public ?string $input = null,
public readonly ?string $code = null,
public readonly ?string $input = null,
#[AtLeastOneOf(constraints: [new Json(), new Type('array')])]
public string|array $context = [],
public bool $queue = true,
public readonly string|array $context = [],
public readonly bool $queue = true,
) {
}
}
7 changes: 5 additions & 2 deletions src/Http/ValueResolver/HttpProcessExecuteValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\Serializer\SerializerInterface;

/**
* PHP 8.2 : Replace by readonly class.
*/
#[AsTargetedValueResolver('http_process_execution')]
readonly class HttpProcessExecuteValueResolver implements ValueResolverInterface
class HttpProcessExecuteValueResolver implements ValueResolverInterface
{
public function __construct(private string $storageDir, private SerializerInterface $serializer)
public function __construct(private readonly string $storageDir, private readonly SerializerInterface $serializer)
{
}

Expand Down
7 changes: 5 additions & 2 deletions src/Http/ValueResolver/ProcessConfigurationValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;

/**
* PHP 8.2 : Replace by readonly class.
*/
#[AsTargetedValueResolver('process')]
readonly class ProcessConfigurationValueResolver implements ValueResolverInterface
class ProcessConfigurationValueResolver implements ValueResolverInterface
{
public function __construct(private ProcessConfigurationRegistry $registry)
public function __construct(private readonly ProcessConfigurationRegistry $registry)
{
}

Expand Down
7 changes: 5 additions & 2 deletions src/Manager/ProcessConfigurationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraint;

/**
* PHP 8.2 : Replace by readonly class.
*/
/**
* @phpstan-type UiOptions array{
* 'source': ?string,
Expand All @@ -32,9 +35,9 @@
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
* }
*/
final readonly class ProcessConfigurationsManager
final class ProcessConfigurationsManager
{
public function __construct(private ProcessConfigurationRegistry $registry)
public function __construct(private readonly ProcessConfigurationRegistry $registry)
{
}

Expand Down
7 changes: 5 additions & 2 deletions src/Message/CronProcessMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@

use CleverAge\UiProcessBundle\Entity\ProcessSchedule;

final readonly class CronProcessMessage
/**
* PHP 8.2 : Replace by readonly class.
*/
final class CronProcessMessage
{
public function __construct(public ProcessSchedule $processSchedule)
public function __construct(public readonly ProcessSchedule $processSchedule)
{
}
}
7 changes: 5 additions & 2 deletions src/Message/CronProcessMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;

/**
* PHP 8.2 : Replace by readonly class.
*/
#[AsMessageHandler]
final readonly class CronProcessMessageHandler
final class CronProcessMessageHandler
{
public function __construct(private MessageBusInterface $bus)
public function __construct(private readonly MessageBusInterface $bus)
{
}

Expand Down
7 changes: 5 additions & 2 deletions src/Message/ProcessExecuteHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
use CleverAge\UiProcessBundle\Monolog\Handler\ProcessHandler;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

/**
* PHP 8.2 : Replace by readonly class.
*/
#[AsMessageHandler]
readonly class ProcessExecuteHandler
class ProcessExecuteHandler
{
public function __construct(private ProcessManager $manager, private readonly ProcessHandler $processHandler)
public function __construct(private readonly ProcessManager $manager, private readonly ProcessHandler $processHandler)
{
}

Expand Down
Loading