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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Latest
* [#280](https://github.com/cleverage/process-bundle/issues/280) The `code` attribute of the `cleverage.transformer` tag (or `#[AsTransformer]`) is required: a tagged service without code fails the container compilation. `TransformerInterface::getCode()` (and the `getCode()` method of the transformers of the bundle, except `GenericTransformer` and `UnavailableTransformer`), `TransformerRegistry::addTransformer()` and `RegistryCompilerPass`, deprecated since 5.4, are removed; the service locator is a required argument of the `TransformerRegistry` constructor; `TransformerRegistryInterface::getTransformerCodes()` gives the codes without instantiating the transformers (see `UPGRADE.md`). Update documentation, add tests.
* [#292](https://github.com/cleverage/process-bundle/issues/292) Remove the fallbacks of the task registry on the service container, deprecated since 5.4 (#275): the `$container` argument of the `ProcessManager` constructor is removed and its `TaskRegistryInterface $taskRegistry` argument is required, before `$stopCheckers`; `ProcessHelpCommand` only accepts a `TaskRegistryInterface`; `TaskRegistry` only fetches the tasks from its service locator (a task of a process configuration unknown when the container is compiled is not found). The `service` key of the task configurations is removed, use `task: <code>`. The tasks and transformers of the bundle, and the tasks of the application autoconfigured with `TaskInterface`, are private; `PublicTaskDeprecationCompilerPass` is removed (see `UPGRADE.md`). Update documentation and tests.
* [#292](https://github.com/cleverage/process-bundle/issues/292) Reject the process configuration errors deprecated during v5: the `errors` task configuration key is removed (use `error_outputs`), with `TaskConfiguration::getErrors()` and `$logErrors`; an unknown `error_strategy` (#310) and an unknown task reference (#426) fail the container compilation; a task listed several times in the `outputs` / `error_outputs` of a task throws an `InvalidProcessConfigurationException` (#414); a shared service used by several tasks of a process fails the container compilation (#382). The former names of the codes with a dash, with underscores, are no longer found (#412, #475): processes, tasks, generic transformers, transformer codes and contextual options of the generic transformers; `DeprecatedCodeAliases` and the second argument of the `TransformerRegistry` constructor are removed (see `UPGRADE.md`). Update documentation and tests.
* [#292](https://github.com/cleverage/process-bundle/issues/292) Remove the classes, methods and options deprecated during v5: `ProcessState::getReturnCode()` / `setReturnCode()` (#503), the `cleverage_process.event_listener.data_queue` service and `DataQueueEventListener` (#311), `CheckSerializerCompilerPass`, the `KernelInterface` argument and the `$kernel` / `$logDir` properties of `CommandRunnerTask`, `ProcessLauncherTask` and `SubprocessInstance` (#318), the `process_options` option of the `process_launcher` task (see `UPGRADE.md`). Update documentation and tests.

## Changes
* [#428](https://github.com/cleverage/process-bundle/issues/428) Tests on PHPUnit 12.5 and 13 (PHPUnit 10 and 11 dropped), with the lowest dependencies on PHP 8.3 and 8.5.
Expand Down
15 changes: 15 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,21 @@ The former names of the codes with a dash, with underscores instead of dashes, a
- the second argument of the `TransformerRegistry` constructor (former names, internal) and the internal
`DeprecatedCodeAliases` class are removed.

### Removed classes, methods and options

- `ProcessState::getReturnCode()` / `setReturnCode()` and the `$returnCode` property are removed (deprecated since
5.10, used nowhere: the exit code of the command does not depend on them);
- the `cleverage_process.event_listener.data_queue` service and `DataQueueEventListener` are removed (deprecated since
5.4, they kept a copy of the state of every `cleverage_process.data_queue` event in memory): write your own listener
of the event dispatched by the `event_dispatcher` task (see its reference page);
- `CheckSerializerCompilerPass` is removed (deprecated since 5.4, no longer registered by the bundle);
- `CommandRunnerTask`, `ProcessLauncherTask` and `SubprocessInstance` only accept the paths as strings (deprecated
since 5.4): the project directory for `CommandRunnerTask`, the path of the console (and the environment) for
`ProcessLauncherTask` and `SubprocessInstance`, no longer a `KernelInterface`. The deprecated `$kernel` property of
`CommandRunnerTask` and `ProcessLauncherTask`, and `SubprocessInstance::$logDir`, are removed. Only the definitions or subclasses of your application are concerned;
- the `process_options` option of the `process_launcher` task is removed (deprecated, a non-empty value already threw):
remove it from your process configurations, an `UndefinedOptionsException` is thrown otherwise.

## v5.10

### Stop strategy and error branch ending on a stop
Expand Down
6 changes: 0 additions & 6 deletions config/services/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use CleverAge\ProcessBundle\EventListener\DataQueueEventListener;
use CleverAge\ProcessBundle\EventListener\SignalStopChecker;

return static function (ContainerConfigurator $container): void {
$services = $container->services();

// @phpstan-ignore classConstant.deprecatedClass (deprecated service, removed in v6.0)
$services->set('cleverage_process.event_listener.data_queue', DataQueueEventListener::class)
->deprecate('cleverage/process-bundle', '5.4', 'The "%service_id%" service is deprecated, it will be removed in v6.0: write your own listener of the event dispatched by the event_dispatcher task.')
->tag('kernel.event_listener', ['event' => 'cleverage_process.data_queue', 'method' => 'pushData']);

$services->set('cleverage_process.event_listener.signal_stop_checker', SignalStopChecker::class)
->args([
service('logger')->ignoreOnInvalid(),
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/tasks/event_dispatcher_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public function onDataQueue(EventDispatcherTaskEvent $event): void
`CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`. Every `EventDispatcherTask` without `event_name` then
triggers the same listeners.

**Deprecated since 5.4, removed in v6.0**: the bundle listens to the `cleverage_process.data_queue` event with the
`cleverage_process.event_listener.data_queue` service (`DataQueueEventListener`), which keeps a copy of the
`ProcessState` of every event in memory. Injecting or fetching this service triggers an `E_USER_DEPRECATED` error: write
your own listener, as above.

**Deprecated since 5.1 (deprecation notice), removed in v6.0**: from v4.0 to v5.0, the `event_name` option was ignored and the event was
always dispatched under its class name. To preserve backward compatibility, when `event_name` is set (and differs from the
event class name) and listeners subscribe to `CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`, the event is also
Expand Down
1 change: 0 additions & 1 deletion docs/reference/tasks/process_launcher_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Options
| `sleep_on_finalize_interval` | `int\|float` | | `1` | Time (in seconds) to wait at the end of **each** execution (each input) when no sub-process result is ready to be output, in addition to `sleep_interval_after_launch`: lower it to launch the sub-processes faster |
| `context` | `array` | | `[]` | Context values passed to each sub-process (as `--context=key:value`, values must be scalars) |
| `json_buffering` | `bool` | | `false` | Store each sub-process output in a JSON stream file and output its path |
| `process_options` | `array` | | `[]` | **Deprecated**: any non-empty value throws an `InvalidArgumentException` |

Examples
--------
Expand Down

This file was deleted.

53 changes: 0 additions & 53 deletions src/EventListener/DataQueueEventListener.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/Model/ProcessState.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ class ProcessState
*/
protected array $errorContext = [];

/**
* @deprecated since 5.10, used nowhere, will be removed in v6.0
*/
protected ?int $returnCode = null;

protected bool $skipped;

/**
Expand Down Expand Up @@ -238,26 +233,6 @@ public function removeErrorContext(string|int $key): void
unset($this->errorContext[$key]);
}

/**
* @deprecated since 5.10, used nowhere, will be removed in v6.0
*/
public function getReturnCode(): int
{
trigger_deprecation('cleverage/process-bundle', '5.10', 'The "%s()" method is deprecated: it is used nowhere and will be removed in 6.0.', __METHOD__);

return $this->returnCode ?? 0;
}

/**
* @deprecated since 5.10, used nowhere (the exit code of the command does not depend on it), will be removed in v6.0
*/
public function setReturnCode(int $returnCode): void
{
trigger_deprecation('cleverage/process-bundle', '5.10', 'The "%s()" method is deprecated: it is used nowhere (the exit code of the command does not depend on it) and will be removed in 6.0.', __METHOD__);

$this->returnCode = $returnCode;
}

public function isSkipped(): bool
{
return $this->skipped;
Expand Down
35 changes: 6 additions & 29 deletions src/Model/SubprocessInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use CleverAge\ProcessBundle\Exception\RuntimeException;
use CleverAge\ProcessBundle\Filesystem\TemporaryFile;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
Expand All @@ -40,22 +39,15 @@ class SubprocessInstance
*/
protected array $options;

protected string $consolePath;

/**
* @deprecated since 5.4, not used; only set when the kernel is passed to the constructor
*/
protected ?string $logDir = null;

/**
* @param string|KernelInterface $consolePath path of the Symfony console; passing the kernel is deprecated since 5.4
* @param array<string, mixed> $context
* @param array<string, mixed> $options
* @param string|null $environment environment of the sub-process (--env), the default one of the console
* if null; taken from the kernel when it is passed
* @param string $consolePath path of the Symfony console
* @param array<string, mixed> $context
* @param array<string, mixed> $options
* @param string|null $environment environment of the sub-process (--env), the default one of the console if
* null
*/
public function __construct(
KernelInterface|string $consolePath,
protected string $consolePath,
protected string $processCode,
protected ?string $input,
protected array $context = [],
Expand All @@ -65,21 +57,6 @@ public function __construct(
$resolver = new OptionsResolver();
$this->configureOptions($resolver);
$this->options = $resolver->resolve($options);

if ($consolePath instanceof KernelInterface) {
trigger_deprecation(
'cleverage/process-bundle',
'5.4',
'Passing a "%s" to "%s::__construct()" is deprecated, pass the path of the console and the environment instead. The argument will only accept a string in v6.0.',
KernelInterface::class,
self::class,
);
$this->environment ??= $consolePath->getEnvironment();
// @phpstan-ignore property.deprecated (kept for BC until v6.0)
$this->logDir = $consolePath->getLogDir().'/process';
$consolePath = $consolePath->getProjectDir().'/bin/console';
}
$this->consolePath = $consolePath;
}

/**
Expand Down
29 changes: 4 additions & 25 deletions src/Task/Process/CommandRunnerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use CleverAge\ProcessBundle\Model\AbstractConfigurableTask;
use CleverAge\ProcessBundle\Model\ProcessState;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Process\Process;

Expand All @@ -27,31 +26,11 @@
class CommandRunnerTask extends AbstractConfigurableTask
{
/**
* @deprecated since 5.4, only set when the kernel is passed to the constructor
* @param string $projectDir default working directory of the commands
*/
protected ?KernelInterface $kernel = null;

protected string $projectDir;

/**
* @param string|KernelInterface $projectDir default working directory of the commands; passing the kernel is
* deprecated since 5.4
*/
public function __construct(KernelInterface|string $projectDir)
{
if ($projectDir instanceof KernelInterface) {
trigger_deprecation(
'cleverage/process-bundle',
'5.4',
'Passing a "%s" to "%s::__construct()" is deprecated, pass the project directory instead. The argument will only accept a string in v6.0.',
KernelInterface::class,
self::class,
);
// @phpstan-ignore property.deprecated (kept for BC until v6.0)
$this->kernel = $projectDir;
$projectDir = $projectDir->getProjectDir();
}
$this->projectDir = $projectDir;
public function __construct(
protected string $projectDir,
) {
}

public function execute(ProcessState $state): void
Expand Down
Loading