Skip to content
Draft
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
5 changes: 2 additions & 3 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.4-fpm-alpine
FROM php:8.5-fpm-alpine

ARG UID
ARG GID
Expand All @@ -13,8 +13,7 @@ RUN apk update && apk add \
bash \
icu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl opcache \
&& docker-php-ext-enable opcache
&& docker-php-ext-install intl

RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime \
&& sed -i "s/^;date.timezone =.*/date.timezone = Europe\/Paris/" $PHP_INI_DIR/php.ini
Expand Down
5 changes: 2 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

return (new PhpCsFixer\Config())
->setRules([
'@PHP71Migration' => true,
'@PHP82Migration' => true,
'@PHPUnit75Migration:risky' => true,
'@PHP8x2Migration' => true,
'@PHPUnit7x5Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,
Expand Down
46 changes: 23 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"name": "Xavier Marchegay",
"email": "[email protected]",
"role": "Developer"
"role": "Lead Developer"
}
],
"autoload": {
Expand All @@ -36,24 +36,24 @@
}
},
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"cleverage/process-bundle": "^4.0",
"doctrine/common": "^3.0",
"doctrine/dbal": "^2.9 || ^3.0",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.9 || ^3.0",
"dragonmantank/cron-expression": "^3.4",
"easycorp/easyadmin-bundle": "^4.8",
"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"
"cleverage/process-bundle": "^5.0",
"doctrine/common": "^3.5",
"doctrine/dbal": "^3.10 || ^4.4",
"doctrine/doctrine-bundle": "^2.18 || ^3.1",
"doctrine/doctrine-migrations-bundle": "^3.7 || ^4",
"doctrine/orm": "^2.20 || ^3.5",
"dragonmantank/cron-expression": "^3.6",
"easycorp/easyadmin-bundle": "^4.27",
"symfony/doctrine-messenger": "^6.4 || ^7.4 || ^8",
"symfony/dotenv": "^6.4 || ^7.4 || ^8",
"symfony/messenger":"^6.4 || ^7.4 || ^8",
"symfony/runtime": "^6.4 || ^7.4 || ^8",
"symfony/scheduler": "^6.4 || ^7.4 || ^8",
"symfony/string":"^6.4 || ^7.4 || ^8",
"symfony/uid": "^6.4 || ^7.4 || ^8"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
Expand All @@ -62,15 +62,15 @@
"phpstan/phpstan": "*",
"phpstan/phpstan-doctrine": "*",
"phpstan/phpstan-symfony": "*",
"phpunit/phpunit": "<10.0",
"phpunit/phpunit": "*",
"rector/rector": "*",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^6.4|^7.3",
"symfony/css-selector": "^6.4|^7.3",
"symfony/debug-bundle": "^6.4|^7.3",
"symfony/browser-kit": "^6.4 || ^7.4 || ^8",
"symfony/css-selector": "^6.4 || ^7.4 || ^8",
"symfony/debug-bundle": "^6.4 || ^7.4 || ^8",
"symfony/maker-bundle": "^1.31",
"symfony/web-profiler-bundle": "^6.4|^7.3",
"vincentlanglet/twig-cs-fixer": "^3.3"
"symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8",
"vincentlanglet/twig-cs-fixer": "^3.11"
},
"conflict": {
"symfony/twig-bridge": "7.2.0",
Expand Down
3 changes: 3 additions & 0 deletions config/routes/easyadmin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
easyadmin:
resource: .
type: easyadmin.routes
21 changes: 8 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
</source>
</phpunit>
6 changes: 3 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
use Rector\ValueObject\PhpVersion;

return RectorConfig::configure()
->withPhpVersion(PhpVersion::PHP_84)
->withPhpVersion(PhpVersion::PHP_85)
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withPhpSets(php81: true)
->withPhpSets(php82: true)
// here we can define, what prepared sets of rules will be applied
->withComposerBased(doctrine: true)
->withPreparedSets(deadCode: true, codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true)
->withAttributesSets(symfony: true, doctrine: true)
->withSets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_85,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Admin/Process/LaunchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function __invoke(
ProcessConfigurationsManager $processConfigurationsManager,
AdminContext $context,
): Response {
$processCode = $requestStack->getMainRequest()?->get('process');
if (null === $processCode) {
$processCode = (string) $requestStack->getMainRequest()?->request->get('process');
if ('' === $processCode) {
throw new MissingProcessException();
}
$uiOptions = $processConfigurationsManager->getUiOptions($processCode);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/Process/UploadAndExecuteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __invoke(
$form = $this->createForm(
ProcessUploadFileType::class,
null,
['process_code' => $requestStack->getMainRequest()?->get('process')]
['process_code' => $requestStack->getMainRequest()?->request->get('process')]
);
$form->handleRequest($requestStack->getMainRequest());
if ($form->isSubmitted() && $form->isValid()) {
Expand Down
7 changes: 1 addition & 6 deletions src/Entity/ProcessSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ public function setContext(array $context): void
$this->context = $context;
}

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

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

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

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

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

Expand All @@ -46,16 +43,16 @@
'json'
);
} else {
$input = $request->get('input', $request->files->get('input'));

Check failure on line 46 in src/Http/ValueResolver/HttpProcessExecuteValueResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Symfony\Component\HttpFoundation\Request::get().
if ($input instanceof UploadedFile) {
$uploadFileName = $this->storageDir.\DIRECTORY_SEPARATOR.date('YmdHis').'_'.uniqid().'_'.$input->getClientOriginalName();
(new Filesystem())->dumpFile($uploadFileName, $input->getContent());
$input = $uploadFileName;
}
$httpProcessExecution = new HttpProcessExecution(
$request->get('code'),

Check failure on line 53 in src/Http/ValueResolver/HttpProcessExecuteValueResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Symfony\Component\HttpFoundation\Request::get().
$input,
$request->get('context', []),

Check failure on line 55 in src/Http/ValueResolver/HttpProcessExecuteValueResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Symfony\Component\HttpFoundation\Request::get().
$request->request->getBoolean('queue', true),
);
}
Expand Down
9 changes: 3 additions & 6 deletions src/Http/ValueResolver/ProcessConfigurationValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;

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

Expand All @@ -35,6 +32,6 @@ public function __construct(private readonly ProcessConfigurationRegistry $regis
*/
public function resolve(Request $request, ArgumentMetadata $argument): iterable
{
return [$this->registry->getProcessConfiguration($request->get('process'))];
return [$this->registry->getProcessConfiguration((string)$request->request->get('process'))];
}
}
7 changes: 2 additions & 5 deletions src/Manager/ProcessConfigurationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
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 @@ -35,9 +32,9 @@
* 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}}
* }
*/
final class ProcessConfigurationsManager
readonly final class ProcessConfigurationsManager
{
public function __construct(private readonly ProcessConfigurationRegistry $registry)
public function __construct(private ProcessConfigurationRegistry $registry)
{
}

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

use CleverAge\UiProcessBundle\Entity\ProcessSchedule;

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

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

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

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

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

namespace CleverAge\UiProcessBundle\Message;

/**
* PHP 8.2 : Replace by readonly class.
*/
class ProcessExecuteMessage
readonly class ProcessExecuteMessage
{
/**
* @param mixed[] $context
*/
public function __construct(public readonly string $code, public readonly mixed $input, public readonly array $context = [])
public function __construct(public string $code, public mixed $input, public array $context = [])
{
}
}
11 changes: 4 additions & 7 deletions src/Scheduler/CronScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;

/**
* PHP 8.2 : Replace by readonly class.
*/
class CronScheduler implements ScheduleProviderInterface
readonly class CronScheduler implements ScheduleProviderInterface
{
public function __construct(
private readonly ProcessScheduleRepository $repository,
private readonly ValidatorInterface $validator,
private readonly LoggerInterface $logger,
private ProcessScheduleRepository $repository,
private ValidatorInterface $validator,
private LoggerInterface $logger,
) {
}

Expand Down
Loading
Loading