From c48bbc18ee2c5f964563a146f15f7fc83c57347d Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 23 Oct 2026 11:49:47 +0200 Subject: [PATCH] #226 - Require process-bundle ^5.5, remove the compatibility code of #220 (method_exists, skipped test, PHPStan ignored errors) Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 1 + composer.json | 2 +- docs/reference/04-process_executions_and_logs.md | 2 +- phpstan.neon | 12 ------------ src/EventSubscriber/ProcessEventSubscriber.php | 12 ++---------- tests/EventSubscriber/ProcessEventSubscriberTest.php | 3 --- 6 files changed, 5 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f8b685..e38048b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Latest * [#216](https://github.com/cleverage/ui-process-bundle/issues/216) Cookbooks with task codes, application `upload_directory` parameter left alone, deprecation notice for the unused `$translator` argument, scheduler log levels. ## Changes +* [#226](https://github.com/cleverage/ui-process-bundle/issues/226) Require `cleverage/process-bundle` `^5.5` (`ProcessEvent::isProcessStopped()`, #220): the compatibility code with process-bundle 5.4 is removed. * [#220](https://github.com/cleverage/ui-process-bundle/issues/220) A process stopped on purpose by a `StopTask` (e.g. not going on when the source file does not exist) is recorded with the `stopped` status, and notified as `stopped`, instead of `finish`. Requires the process bundle version providing `ProcessEvent::isProcessStopped()` (cleverage/process-bundle#337); with an older version, the execution keeps the `finish` status. Update documentation, add tests. * [#207](https://github.com/cleverage/ui-process-bundle/issues/207) The `main` firewall configured by the bundle (`security.configure_firewall`) limits the login attempts (Symfony `login_throttling`, default settings: 5 failed attempts per minute for a username and an IP address, 25 for an IP address); the settings can be changed in the application firewall. Require `symfony/rate-limiter`. Update documentation and tests. * [#186](https://github.com/cleverage/ui-process-bundle/issues/186) `ProcessExecuteController`, `ProcessExecuteHandler`, `LaunchType`, `ProcessConfigurationsManager` and `IsValidProcessCodeValidator` are typed on `ProcessManagerInterface` / `ProcessConfigurationRegistryInterface` (process-bundle 5.4) instead of the concrete classes, `@final since 5.4`: the process manager and the process configuration registry can be decorated or replaced for the UI. diff --git a/composer.json b/composer.json index 490f0d0..e0c700b 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ }, "require": { "php": "^8.2", - "cleverage/process-bundle": "^5.4", + "cleverage/process-bundle": "^5.5", "doctrine/collections": "^1.5|^2.1|^3.1", "doctrine/dbal": "^3.10|^4.4", "doctrine/doctrine-bundle": "^2.18|^3.1", diff --git a/docs/reference/04-process_executions_and_logs.md b/docs/reference/04-process_executions_and_logs.md index 29816a7..6ab0621 100644 --- a/docs/reference/04-process_executions_and_logs.md +++ b/docs/reference/04-process_executions_and_logs.md @@ -13,7 +13,7 @@ An event subscriber listens to the process bundle events: name of the log file, - on process end, its status becomes `finish` and its end date is set, or `stopped` when the process has been stopped on purpose by a [StopTask](https://github.com/cleverage/process-bundle/blob/main/docs/reference/tasks/stop_task.md) - (e.g. not going on when the source file does not exist; requires the process bundle version following 5.4), + (e.g. not going on when the source file does not exist), - on process failure, its status becomes `failed` and its end date is set, or `stopped` when the process has been [stopped from the UI](#stopping-a-process-execution). diff --git a/phpstan.neon b/phpstan.neon index fac13b9..906f411 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -24,15 +24,3 @@ parameters: path: tests/* - identifier: method.impossibleType path: tests/* - # ProcessEvent::isProcessStopped() is only provided by the process bundle version following 5.4 (#220): remove - # these entries once this version is required - - identifier: function.alreadyNarrowedType - paths: - - src/EventSubscriber/ProcessEventSubscriber.php - - tests/EventSubscriber/ProcessEventSubscriberTest.php - - identifier: function.impossibleType - paths: - - src/EventSubscriber/ProcessEventSubscriber.php - - tests/EventSubscriber/ProcessEventSubscriberTest.php - - identifier: arguments.count - path: tests/EventSubscriber/ProcessEventSubscriberTest.php diff --git a/src/EventSubscriber/ProcessEventSubscriber.php b/src/EventSubscriber/ProcessEventSubscriber.php index 7fcec1c..3e26551 100644 --- a/src/EventSubscriber/ProcessEventSubscriber.php +++ b/src/EventSubscriber/ProcessEventSubscriber.php @@ -57,7 +57,8 @@ public function success(ProcessEvent $event): void { if ($event->getProcessCode() === $this->processExecutionManager->getCurrentProcessExecution()?->getCode()) { $this->processExecutionManager->getCurrentProcessExecution()->setStatus( - $this->isStoppedOnPurpose($event) ? ProcessExecutionStatus::Stopped : ProcessExecutionStatus::Finish + // Stopped on purpose by a StopTask: ended normally, flagged as stopped + $event->isProcessStopped() ? ProcessExecutionStatus::Stopped : ProcessExecutionStatus::Finish ); $this->processExecutionManager->getCurrentProcessExecution()->end(); $this->endProcessExecution($event); @@ -90,15 +91,6 @@ private function endProcessExecution(ProcessEvent $event): void $this->dispatchEnded($event); } - /** - * The process has been stopped on purpose by a StopTask: it has ended normally, flagged as stopped - * (ProcessEvent::isProcessStopped(), since the process bundle version following 5.4). - */ - private function isStoppedOnPurpose(ProcessEvent $event): bool - { - return method_exists($event, 'isProcessStopped') && $event->isProcessStopped(); - } - /** * The process has been stopped on a stop request: a ProcessStoppedException in the chain of the previous * exceptions (wrapped in a ProcessFailedException, by each parent process for a sub-process). diff --git a/tests/EventSubscriber/ProcessEventSubscriberTest.php b/tests/EventSubscriber/ProcessEventSubscriberTest.php index bcd1fe6..3d4c329 100644 --- a/tests/EventSubscriber/ProcessEventSubscriberTest.php +++ b/tests/EventSubscriber/ProcessEventSubscriberTest.php @@ -188,9 +188,6 @@ public static function provideStopErrors(): iterable public function testProcessStoppedByAStopTask(): void { - if (!method_exists(ProcessEvent::class, 'isProcessStopped')) { - self::markTestSkipped('ProcessEvent::isProcessStopped() requires a newer cleverage/process-bundle'); - } $processExecution = new ProcessExecution('test.process', 'test.log'); $processExecutionManager = new ProcessExecutionManager($this->createRepositoryStub()); $processExecutionManager->setCurrentProcessExecution($processExecution);