Skip to content

Commit 889da49

Browse files
Merge pull request #528 from cleverage/dev-v6
Release v6
2 parents 46706a3 + 7734d14 commit 889da49

329 files changed

Lines changed: 5837 additions & 5045 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.docker/php/Dockerfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Stays on PHP 8.5 until a pcov release builds on PHP 8.6 (1.0.12 does not, krakjoe/pcov#134) and PHP-CS-Fixer supports
2+
# it (PHP-CS-Fixer/PHP-CS-Fixer#9954). The php:8.6 images no longer ship mbstring: install it with oniguruma-dev,
3+
# without deleting oniguruma afterwards (libonig is needed at runtime).
14
FROM php:8.5-fpm-alpine
25

36
ARG UID

‎.github/ISSUE_TEMPLATE/bug.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ assignees: ''
1515
<!-- A minimal process configuration reproducing the bug, ideally a demo.* process from https://github.com/cleverage/process-bundle-demo -->
1616

1717
```yaml
18-
clever_age_process:
18+
cleverage_process:
1919
configurations:
2020
demo.<name>:
2121
tasks:

‎.github/workflows/quality.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Install PHP with extensions
4646
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
4747
with:
48-
php-version: '8.5'
48+
php-version: '8.6'
4949
coverage: none
5050
tools: composer:v2
5151
- name: Install Composer dependencies (locked)
@@ -63,6 +63,8 @@ jobs:
6363
- name: Install PHP with extensions
6464
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
6565
with:
66+
# PHP-CS-Fixer does not support PHP 8.6 yet (it refuses to run on it): stay on 8.5 until a release supports
67+
# it, see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/9954
6668
php-version: '8.5'
6769
coverage: none
6870
tools: composer:v2
@@ -81,7 +83,7 @@ jobs:
8183
- name: Install PHP with extensions
8284
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
8385
with:
84-
php-version: '8.5'
86+
php-version: '8.6'
8587
coverage: none
8688
tools: composer:v2
8789
- name: Install Composer dependencies (locked)

‎.github/workflows/test.yml‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,39 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
include:
33-
# Lowest versions allowed by composer.json, on the lowest supported PHP version
34-
- { php-version: '8.2', dependencies: lowest, symfony-require: '' }
33+
# Lowest versions allowed by composer.json, on the lowest and the highest supported PHP versions (the old
34+
# versions of a dependency may trigger deprecations of the recent PHP versions)
35+
- { php-version: '8.3', dependencies: lowest, symfony-require: '' }
36+
- { php-version: '8.6', dependencies: lowest, symfony-require: '' }
3537
# Highest versions, for each supported Symfony version (8.x requires PHP 8.4)
36-
- { php-version: '8.2', dependencies: highest, symfony-require: 6.4.* }
37-
- { php-version: '8.2', dependencies: highest, symfony-require: 7.4.* }
38-
- { php-version: '8.3', dependencies: highest, symfony-require: 6.4.* }
3938
- { php-version: '8.3', dependencies: highest, symfony-require: 7.4.* }
40-
- { php-version: '8.4', dependencies: highest, symfony-require: 6.4.* }
4139
- { php-version: '8.4', dependencies: highest, symfony-require: 7.4.* }
4240
- { php-version: '8.4', dependencies: highest, symfony-require: 8.* }
43-
- { php-version: '8.5', dependencies: highest, symfony-require: 6.4.* }
4441
- { php-version: '8.5', dependencies: highest, symfony-require: 7.4.* }
4542
- { php-version: '8.5', dependencies: highest, symfony-require: 8.* }
43+
- { php-version: '8.6', dependencies: highest, symfony-require: 7.4.* }
44+
- { php-version: '8.6', dependencies: highest, symfony-require: 8.* }
4645
steps:
4746
- name: Checkout
4847
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
4948
- name: Install PHP with extensions
5049
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
5150
with:
5251
php-version: ${{ matrix.php-version }}
53-
coverage: pcov
54-
tools: composer:v2, flex
52+
# No pcov release builds on PHP 8.6 yet (1.0.12 fails): it is built from source in the next step
53+
coverage: ${{ matrix.php-version == '8.6' && 'none' || 'pcov' }}
54+
tools: composer:v2, flex, phpize, php-config
55+
# Coverage is required: a missing #[CoversClass] / #[UsesClass] is only reported as risky when it is collected.
56+
# The PHP 8.6 build fix (krakjoe/pcov#134) is not released yet: remove this step and the coverage condition
57+
# above once a pcov release supports PHP 8.6.
58+
- name: Build pcov from source (PHP 8.6)
59+
if: matrix.php-version == '8.6'
60+
run: |
61+
curl -fsSL https://github.com/krakjoe/pcov/archive/3795c08561d69ca7f55f693492de59a65a6a182d.tar.gz | tar xz -C /tmp
62+
cd /tmp/pcov-3795c08561d69ca7f55f693492de59a65a6a182d
63+
phpize && ./configure && make -j"$(nproc)" && sudo make install
64+
echo 'extension=pcov' | sudo tee "$(php-config --ini-dir)/20-pcov.ini"
65+
php --ri pcov
5566
- name: Add PHPUnit matcher
5667
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5768
- name: Install Composer dependencies (${{ matrix.dependencies }})

‎.php-cs-fixer.dist.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
return (new PhpCsFixer\Config())
2828
->setRules([
29-
'@PHP8x2Migration' => true,
30-
'@PHPUnit10x0Migration:risky' => true,
29+
'@PHP8x3Migration' => true,
30+
'@PHPUnit11x0Migration:risky' => true,
3131
'@Symfony' => true,
3232
'@Symfony:risky' => true,
3333
'protected_to_private' => false,
@@ -40,6 +40,7 @@
4040
->setRiskyAllowed(true)
4141
->setFinder(
4242
(new PhpCsFixer\Finder())
43+
->in(__DIR__.'/config')
4344
->in(__DIR__.'/src')
4445
->in(__DIR__.'/tests')
4546
->append([__FILE__])

‎CHANGELOG.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
Latest
22
------
33

4+
v6.0
5+
-----
6+
7+
## BC breaks
8+
* [#428](https://github.com/cleverage/process-bundle/issues/428) Drop the support of PHP 8.2 and Symfony 6.4: PHP 8.3 or later and Symfony 7.4 or 8.x are required, `symfony/polyfill-php83` is no longer required, `symfony/event-dispatcher-contracts` requires 3.4.2 or later (the previous versions trigger the PHP 8.4 "Implicitly marking parameter as nullable" deprecation). Update documentation.
9+
* [#428](https://github.com/cleverage/process-bundle/issues/428) The class constants are typed: a class redeclaring a protected constant of the bundle must use the same type (see `UPGRADE.md`).
10+
* [#143](https://github.com/cleverage/process-bundle/issues/143) Narrow native types that were never `null` in practice: `AbstractConfigurableTask::getOptions()` and `ProcessState::getContextualizedOptions()` return `array` (instead of `?array`), `CsvResource::$lineNumber` is an `int` and `ProcessHistory::$startDate` a `\DateTimeInterface` (instead of nullable types). Overrides must declare the narrowed types (see `UPGRADE.md`). Improve PHPStan level from 7 to 8.
11+
* [#234](https://github.com/cleverage/process-bundle/issues/234) ArrayFirstTransformer: restore the meaning of the `allow_not_iterable` option, inverted since v4.0. By default (`false`), a non-iterable input now throws an `UnexpectedValueException` (it was returned unchanged); with `allow_not_iterable: true`, it is returned unchanged (a scalar or `null` threw a `TypeError`, an object returned its first property). Set `allow_not_iterable: true` to keep the former default behaviour (see `UPGRADE.md`). An iterable object (`\Traversable`) returns its first element (`false` or its first property before), a generator already run throws an `UnexpectedValueException`. Update documentation, add tests.
12+
* [#507](https://github.com/cleverage/process-bundle/issues/507) `csv_reader`, `input_csv_reader`: a line that cannot be read (number of columns not matching the headers, line that cannot be parsed) sends `['csv_file' => <path>, 'csv_line' => <line number>, 'csv_values' => <values read>]` to the error output, instead of the input of the task (`null`, or the file path for `input_csv_reader`, see `UPGRADE.md`), and `csv_file` / `csv_line` are in the error context of the logged error. `CsvResource::readLine()` throws an `InvalidCsvLineException` (an `UnexpectedValueException`) carrying the values read. Update documentation, add tests.
13+
* [#111](https://github.com/cleverage/process-bundle/issues/111) The root of the configuration is renamed from `clever_age_process` to `cleverage_process` (alias of the extension), the former one is no longer recognized (see `UPGRADE.md`). Update documentation, add tests.
14+
* [#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.
15+
* [#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.
16+
* [#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.
17+
* [#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.
18+
* [#292](https://github.com/cleverage/process-bundle/issues/292) Apply the behaviours announced by the deprecations of v5: an exception thrown by the `initialize()` of a task makes the process fail before any task is executed, with a `ProcessFailedException` (#222); the `event_dispatcher` task no longer dispatches its event under the class name of the event too when `event_name` is set (#189); a target property of an array destination that is neither a simple property name nor an index notation (`address.city`) throws an `UnexpectedValueException` in the `mapping` transformer (#117); the `additional_parameters` option of the `callback` transformer is removed, use `right_parameters`; a negative `flush_every` of the `counter` task is rejected (#491) (see `UPGRADE.md`). Update documentation and tests.
19+
* [#279](https://github.com/cleverage/process-bundle/issues/279) The 109 classes marked `@final since 5.4` are `final` (engine, registries, models, configurations, events, `CleverAgeProcessBundle`, concrete tasks and transformers): they can no longer be extended nor doubled by PHPUnit. The services of the bundle are typed on `ProcessManagerInterface`, `ProcessConfigurationRegistryInterface` and `TransformerRegistryInterface`, so that a decorator is injected everywhere; `ProcessManagerInterface` declares `getProcessHistory()` and `getTaskConfiguration()`, `ProcessConfigurationRegistryInterface` declares `getProcessCodes()`, and both extend `ResetInterface` (a decorator receives the `kernel.reset` tag and must delegate `reset()`). `PregFilterTransformer::transform()` returns `?string`, the `$transformerRegistry` property of `TransformerTrait` is typed on `TransformerRegistryInterface`, `SplFile::readLine()` no longer has its unused `$length` parameter (see `UPGRADE.md`). Update documentation and tests.
20+
* [#505](https://github.com/cleverage/process-bundle/issues/505) Consistent names for the equivalent options of the tasks: `filename` is renamed `file_path` (`file_reader`, `file_writer`, `line_reader`) and `base_folder_path` is renamed `base_path` (`input_folder_browser`), without deprecation in 5.x; `input_folder_browser` adds a single `/` between a non-empty `base_path` and the input, as `input_csv_reader` does (see `UPGRADE.md`). Update documentation and tests.
21+
* [#380](https://github.com/cleverage/process-bundle/issues/380) Executing a process while it is already running, by itself or through its sub-processes (`A → B → A` with `process_executor`), throws a `RecursiveProcessExecutionException` naming the chain of processes, before any event is dispatched for the rejected execution (deprecated since 5.6, it reset the states of the running process). The `error_strategy` of the `process_executor` task applies (see `UPGRADE.md`). Update documentation and tests.
22+
* [#404](https://github.com/cleverage/process-bundle/issues/404) `slugify`: the default `transliterator` is `Any-Latin; Latin-ASCII` (instead of `NFD; [:Nonspacing Mark:] Remove; NFC`), which transliterates the letters that are not decomposed (`Cœur` gives `coeur` instead of `c_ur`) and the other scripts; `strip_tags` is `false` by default (a `<` truncated the value). The slugs of existing data change, set both options to keep the 5.x slugs (see `UPGRADE.md`). Update documentation and tests.
23+
* [#405](https://github.com/cleverage/process-bundle/issues/405) Transformers: one policy for the inputs they do not expect. A string transformer (`convert_value` with `auto_cast`, `date_parser`, `explode`, `hash`, `multi_replace`, `preg_filter`, `preg_match`, `slugify`, `trim`) gives `null` for `null` (`hash` gave the hash of an empty string, `slugify` threw an `UnexpectedValueException`, `explode` gave `[]`, `multi_replace` `''`), casts a scalar or a `\Stringable` to a string, and throws an `UnexpectedValueException` for an array (cast to `'Array'` with a warning) or another object (raw `Error`); an array transformer (`array_element`, `array_last`, `array_unset`, `implode`, `instantiate`, `unset`) throws an `UnexpectedValueException` for anything but an array (`array_element` and `array_last` threw a `TypeError`); `sprintf` and `implode` reject an array or an object argument or item, `date_parser` an empty array (returned unchanged). New exception messages (see `UPGRADE.md`). Update documentation, add tests.
24+
25+
## Changes
26+
* [#105](https://github.com/cleverage/process-bundle/issues/105) Conditional branches: the new `branches` key of a task configuration lists the tasks receiving its output by branch name, only when the task selects their branch with `ProcessState::setOutputBranch()` (in addition to its `outputs`); an unknown branch makes the execution fail, an unknown task or a task listed several times in the `outputs` and `branches` is rejected; `cleverage:process:help` shows the branch leading to each task. Update documentation, add tests.
27+
* [#105](https://github.com/cleverage/process-bundle/issues/105) New `router` task: sends each input to the conditional branches of the task whose conditions it matches (conditions of `ConditionTrait` and an `expression`, by branch name), the first one (`mode: first`, default) or all of them (`mode: all`), else the `default` branch; without a default branch, an input matching no branch goes to the error outputs with a warning. The conditions and the default branch must match the `branches` of the task, checked at its initialization. Add the reference page and a recipe replacing a cascade of filters, add tests.
28+
* [#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.
29+
* [#510](https://github.com/cleverage/process-bundle/issues/510) Support PHP 8.6: tests on PHP 8.6 (lowest dependencies, highest with Symfony 7.4 and 8.x), PHPStan and Rector on PHP 8.6, `symfony/polyfill-php86` is required so that the PHP 8.6 functions can be used on PHP 8.3 to 8.5.
30+
* [#493](https://github.com/cleverage/process-bundle/issues/493) Documentation: the `constant()` function of the `evaluator` expressions is deprecated by Symfony 8.2 (a `ConstantFunctionProvider` must be registered), avoid it.
31+
* [#277](https://github.com/cleverage/process-bundle/issues/277) `CleverAgeProcessBundle` extends `AbstractBundle`: the configuration tree (`configure()`) and the loading of the services (`loadExtension()`) move from the internal `Configuration` and `CleverAgeProcessExtension` classes, removed, to the bundle, and the service definitions are written in PHP (`config/services/*.php`, analysed by PHPStan, Rector and PHP-CS-Fixer) instead of YAML. Same configuration tree (root `cleverage_process`), same service ids and definitions. Update documentation and tests.
32+
433
v5.10
534
-----
635

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ make tests
4242

4343
## PHP version
4444

45-
The bundle supports PHP 8.2 and later: do not use a syntax introduced by a later version (typed class constants,
46-
property hooks, pipe operator...). The functions of PHP 8.3 to 8.5 (`json_validate()`, `array_find()`, `array_any()`,
47-
`mb_trim()`, `array_first()`...) can be used: they are provided by the required `symfony/polyfill-php83`,
48-
`symfony/polyfill-php84` and `symfony/polyfill-php85` packages on the older versions. Rector (`make quality`) is
49-
configured accordingly.
45+
The bundle supports PHP 8.3 and later: do not use a syntax introduced by a later version (property hooks, asymmetric
46+
visibility, pipe operator...). The functions of PHP 8.4, 8.5 and 8.6 (`array_find()`, `array_any()`, `mb_trim()`,
47+
`array_first()`, `clamp()`...) can be used: they are provided by the required `symfony/polyfill-php84`,
48+
`symfony/polyfill-php85` and `symfony/polyfill-php86` packages on the older versions. Rector (`make quality`) is configured accordingly.
5049

5150
## Deprecations notices
5251

0 commit comments

Comments
 (0)