Skip to content

v6.0

Latest

Choose a tag to compare

@njoubert-cleverage njoubert-cleverage released this 04 Dec 09:00
889da49

BC breaks

  • #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.
  • #428 The class constants are typed: a class redeclaring a protected constant of the bundle must use the same type (see UPGRADE.md).
  • #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.
  • #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.
  • #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.
  • #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.
  • #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 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 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 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.
  • #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.
  • #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.
  • #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.
  • #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.
  • #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.
  • #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.

Changes

  • #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.
  • #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.
  • #428 Tests on PHPUnit 12.5 and 13 (PHPUnit 10 and 11 dropped), with the lowest dependencies on PHP 8.3 and 8.5.
  • #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.
  • #493 Documentation: the constant() function of the evaluator expressions is deprecated by Symfony 8.2 (a ConstantFunctionProvider must be registered), avoid it.
  • #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.