Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
44 changes: 32 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ jobs:
- '8.2'
- '8.3'
- '8.4'
dependencies: [highest]
- '8.5'
dependencies: [highest, lowest]
allowed-to-fail: [false]
symfony-require: ['']
variant: [normal]
include:
- php-version: '8.1'
dependencies: highest
- php-version: '8.2'
dependencies: lowest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
Expand All @@ -41,8 +42,8 @@ jobs:
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
Expand All @@ -51,8 +52,8 @@ jobs:
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
Expand All @@ -61,12 +62,31 @@ jobs:
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.3.*
variant: symfony/symfony:"7.3.*"

symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.4'
dependencies: highest
allowed-to-fail: false
symfony-require: 8.*
variant: symfony/symfony:"8.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.4.*
variant: symfony/symfony:"7.4.*"
- php-version: '8.5'
dependencies: highest
allowed-to-fail: false
symfony-require: 8.*
variant: symfony/symfony:"8.*"
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
Expand All @@ -87,4 +107,4 @@ jobs:
#- name: Send coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: build/logs/clover.xml
# files: build/logs/clover.xml
8 changes: 5 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the CleverAge/UiProcessBundle package.
*
Expand All @@ -24,9 +26,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 All @@ -35,6 +36,7 @@
'header_comment' => ['header' => $fileHeaderComment],
'modernize_strpos' => true,
'get_class_to_class_keyword' => true,
'declare_strict_types' => true,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
48 changes: 24 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"name": "Xavier Marchegay",
"email": "xmarchegay@clever-age.com",
"role": "Developer"
"role": "Lead Developer"
}
],
"autoload": {
Expand All @@ -36,41 +36,41 @@
}
},
"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": "^5",
"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",
"doctrine/doctrine-fixtures-bundle": "^3 || ^4",
"friendsofphp/php-cs-fixer": "*",
"phpstan/extension-installer": "*",
"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_82,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/Field/ContextField.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Symfony\Contracts\Translation\TranslatableInterface;

class ContextField implements FieldInterface
{
use FieldTrait;

public static function new(string $propertyName, ?string $label = null): self
public static function new(string $propertyName, TranslatableInterface|string|bool|null $label = null): self
{
return (new self())
->setProperty($propertyName)
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/Field/EnumField.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Symfony\Contracts\Translation\TranslatableInterface;

class EnumField implements FieldInterface
{
use FieldTrait;

public static function new(string $propertyName, ?string $label = null): self
public static function new(string $propertyName, TranslatableInterface|string|bool|null $label = null): self
{
return (new self())
->setProperty($propertyName)
Expand Down
3 changes: 2 additions & 1 deletion src/Admin/Field/LogLevelField.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Symfony\Contracts\Translation\TranslatableInterface;

class LogLevelField implements FieldInterface
{
use FieldTrait;

public static function new(string $propertyName, ?string $label = null): self
public static function new(string $propertyName, TranslatableInterface|string|bool|null $label = null): self
{
return (new self())
->setProperty($propertyName)
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Admin/LogRecordCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ public function configureFilters(Filters $filters): Filters
{
$id = $this->requestStack->getMainRequest()?->query->all('filters')['process']['value'] ?? null;
$processList = $this->processConfigurationsManager->getPublicProcesses();
$processList = array_map(fn (ProcessConfiguration $cfg) => $cfg->getCode(), $processList);
$processList = array_map(static fn (ProcessConfiguration $cfg) => $cfg->getCode(), $processList);

return $filters->add(
LogProcessFilter::new('Process', $processList, $id)
)->add(
ChoiceFilter::new('level')
->setTranslatableChoices(array_combine(
Level::VALUES,
array_map(fn ($value) => 'enum.log_level.'.strtolower((string) $value), Level::NAMES)
array_map(static fn ($value) => 'enum.log_level.'.strtolower((string) $value), Level::NAMES)
))
->setFormTypeOption('translation_domain', 'enums'),
)->add('message')->add('context')->add('createdAt');
Expand Down
17 changes: 7 additions & 10 deletions src/Controller/Admin/Process/LaunchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use CleverAge\UiProcessBundle\Manager\ProcessConfigurationsManager;
use CleverAge\UiProcessBundle\Message\ProcessExecuteMessage;
use EasyCorp\Bundle\EasyAdminBundle\Config\Asset;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand All @@ -40,21 +40,18 @@
#[IsGranted('ROLE_USER')]
class LaunchAction extends AbstractController
{
public function __construct(private readonly MessageBusInterface $messageBus)
public function __construct(private readonly MessageBusInterface $messageBus, private readonly RequestStack $requestStack, private readonly ProcessConfigurationsManager $processConfigurationsManager, private readonly AdminContextProvider $adminContextProvider)
{
}

public function __invoke(
RequestStack $requestStack,
string $uploadDirectory,
ProcessConfigurationsManager $processConfigurationsManager,
AdminContext $context,
): Response {
$processCode = $requestStack->getMainRequest()?->get('process');
if (null === $processCode) {
$processCode = (string) $this->requestStack->getMainRequest()?->query->get('process');
if ('' === $processCode) {
throw new MissingProcessException();
}
$uiOptions = $processConfigurationsManager->getUiOptions($processCode);
$uiOptions = $this->processConfigurationsManager->getUiOptions($processCode);
if (null === $uiOptions) {
throw new \InvalidArgumentException('Missing UI Options');
}
Expand Down Expand Up @@ -84,7 +81,7 @@ public function __invoke(
}
$form->setData($default);
}
$form->handleRequest($requestStack->getMainRequest());
$form->handleRequest($this->requestStack->getMainRequest());
if ($form->isSubmitted() && $form->isValid()) {
$input = $form->get('input')->getData();
if ($input instanceof UploadedFile) {
Expand All @@ -104,7 +101,7 @@ public function __invoke(

return $this->redirectToRoute('process', ['routeName' => 'process_list']);
}
$context->getAssets()->addJsAsset(Asset::fromEasyAdminAssetPackage('field-collection.js')->getAsDto());
$this->adminContextProvider->getContext()?->getAssets()->addJsAsset(Asset::fromEasyAdminAssetPackage('field-collection.js')->getAsDto());

return $this->render(
'@CleverAgeUiProcess/admin/process/launch.html.twig',
Expand Down
Loading
Loading