Skip to content

Latest commit

 

History

History
403 lines (273 loc) · 24.1 KB

File metadata and controls

403 lines (273 loc) · 24.1 KB

Latest

Changes

  • #197 Add missing tests: every Task and Transformer is now covered by unit tests. Remove the obsolete tests.old directory.
  • #143 Improve PHPStan configuration: remove all ignoreErrors and @phpstan-ignore comments (report unmatched ignored errors again), add missing iterable value types and generic types in PHPDoc, remove unreachable code in AbstractIterableOutputTask and InputAggregatorTask.
  • #143 Improve PHPStan level from 6 to 7, and fix the level 8 errors that do not require a signature change (the remaining ones, due to nullable return types such as AbstractConfigurableTask::getOptions(): ?array, will be fixed in v6.0). Default to a ContextualOptionResolver in ProcessState and to a property accessor in ConditionTrait when none is set.
  • #94 TransformerTrait: the transformers option (TransformerTask, MappingTransformer, ArrayMapTransformer, CachedTransformer, RulesTransformer, generic transformers) also accepts a list, whose items are a transformer code without options (- trim) or a single code: options map (- callback: {...}), to chain the same transformer without # suffix. The map syntax is still supported. Update documentation, add tests.
  • #117 MappingTransformer: writing a target property that is a nested path (e.g. address.city) on an array destination, which silently created an address.city literal key, is deprecated and will throw an \UnexpectedValueException in v6.0. Use [address.city] for a literal key or [address][city] for a nested array; a simple property name (e.g. name) is still added as a key. Update documentation, add tests.

Fixes

  • #143 Fix InputIteratorTask: an \IteratorAggregate input whose getIterator() does not return an \Iterator (e.g. another \IteratorAggregate) is iterated instead of failing with a TypeError. Update documentation, add tests.
  • #143 Fix level 8 edge cases failing with a TypeError or an Error: CsvResource rejects a blank header line and checks ftell(), XpathEvaluatorTransformer throws an explicit \UnexpectedValueException on an invalid query (with the libxml messages), a namespace node to unwrap or a node without document, SlugifyTransformer on a value that cannot be transliterated, ProcessState::getContext() returns [] until the context is defined, GenericTransformer and TransformerTrait throw a \LogicException when not initialized, IterableBatchTask and JsonStreamReaderTask can be flushed / iterated before their first execution, RegistryCompilerPass checks its configuration, SubprocessInstance checks the PHP executable. Update documentation, add tests.
  • #239 Fix PropertyGetterTask: catch any \Throwable, so that the TypeError of the property accessor on a scalar input is set on the state (with the property error context) and handled according to the task error_strategy instead of escaping it. Update documentation, add tests.
  • #241 Fix CsvWriterTask: a non-array input throws the documented \UnexpectedValueException instead of a TypeError when headers is null, and the CSV tasks release their file on finalize() so that the task can be executed again. Update documentation, add tests.
  • #240 Fix FileMoverTask: with autoincrement, the suffix was computed on the whole path (a dot in a directory name was taken as the extension, making the move fail for a file without extension) and an existing numeric suffix of the file name was replaced (report-2024.csv became report-1.csv). The suffix is now appended to the file name only (report-2024-1.csv, file-1, .env-1). Update documentation, add tests.
  • #243 Fix RecursivePropertySetterTransformer: a \stdClass item without the property was replaced by a copy in the output, so the input object was not modified; the property is now added to the item itself. Update documentation, add tests.
  • #242 Fix InputFileReaderTask: an input that is not a non-empty string (e.g. null) throws an explicit \UnexpectedValueException (No file path given as input) instead of a PHP warning followed by a TypeError. Update documentation, add tests.
  • #244 Fix MappingTransformer: a missing target property of a \stdClass destination (initial_value or keep_input) threw Property '...' is not writable, it is now added when the target is a simple property name (nested paths still throw). Update documentation, add tests.
  • #143 Type the remaining untyped task options: split_character of CsvWriterTask and SplitJoinLineTask must be a string (a wrong type used to fail later with a TypeError), write_headers of CsvWriterTask and log_empty_lines of CsvReaderTask are cast to bool (any value used to be evaluated as a boolean, so it is still accepted). Update documentation, add tests.

v5.1

Changes

  • #190 Update quality stack: use Rector withComposerBased() sets (removed SYMFONY_64 / PHPUNIT_100 sets), declare used Symfony packages and PHPUnit range in composer.json, apply quality tools fixes
  • #145 Add missing documentations: reference pages for every Task & Transformer, ConditionTrait & GenericTransformer, complete guides and cookbooks. Harmonize and fix existing documentation.
  • #229 StatCounterTask and AdvancedStatCounterTask pass their input to their output on every execution (they used to output null, and AdvancedStatCounterTask was skipped when not logging), so they can be placed anywhere in a branch. Update documentation, add tests.
  • #236 TransformerTrait: document that any non-empty #suffix is accepted on transformer codes (callback#1, callback#reverse), and anchor the matching regex (an empty suffix is no longer accepted). Update documentation, add tests.

Fixes

  • #192 Fix CommandRunnerTask: only pass the options option to Process::setOptions(), support string commandline through Process::fromShellCommandline(), validate option types. Update documentation, add tests.
  • #194 Fix ProcessLauncherTask: the process_options normalizer returned an array despite its scalar return type, so the task always failed with a TypeError. Update documentation, add tests.
  • #189 Fix EventDispatcherTask: dispatch the event under the event_name option (regression since v4.0). event_name is now optional: when null (default), the event is dispatched under its class name. Update documentation, add tests.
  • #198 Fix DateParserTransformer: a \DateTimeImmutable input is converted to a \DateTime instead of throwing a TypeError. Update documentation, add tests.
  • #199 Fix PregFilterTransformer: an array replacement is no longer cast to the string "Array", and requires an array pattern. Update documentation, add tests.
  • #200 Fix GenericTransformer: a contextual option declared with required: false and no default can now be used; its placeholders are replaced by null when omitted. Update documentation, add tests.
  • #202 Fix XmlReaderTask: throw an explicit \UnexpectedValueException on an empty file or invalid XML (with the libxml error messages) instead of a ValueError or a silent empty \DOMDocument. Update documentation, add tests.
  • #203 Fix ProcessState::addErrorContextValue(): accept any value type, so that iterable tasks on an empty iterable are skipped and PropertySetterTask reports the original exception instead of a TypeError. Update documentation, add tests.
  • #204 Fix CachedTransformer, SlugifyTransformer and TypeSetterTransformer edge cases: accept a non-string input in cached (key built after key_transformers), reject an invalid transliterator in slugify with an InvalidOptionsException, remove the unreachable error branch of type_setter. Update documentation, add tests.
  • #205 Fix FileSplitterTask: produced files lost the first line, doubled line breaks and ended with an empty file; each file now contains exactly max_lines lines of the source. Update documentation, add tests.
  • #206 Fix AdvancedStatCounterTask, IterableBatchTask, ConditionTrait and ColumnAggregatorTask edge cases: log the first counted execution with correct counts, accept a null batch_count (only flush at the end), allow scalar inputs in conditions ('' path on the whole value), aggregate null column values. Update documentation, add tests.
  • #207 Fix JsonStreamReaderTask / JsonStreamWriterTask: throw an explicit \UnexpectedValueException when a line decodes to a scalar, create the missing parent directory when writing. Update documentation, add tests.
  • #208 Fix FolderBrowserTask, InputFolderBrowserTask, CsvReaderTask and LineReaderTask (and their Input* variants): reset the state at the end of the iteration, so that a following input is read from its beginning. Update documentation, add tests.
  • #201 Fix minor defects: error messages of TransformerTrait, RulesTransformer and ExpressionLanguageMapTransformer, useless setRequired() in ImplodeTransformer and SprintfTransformer, stray namespace in TrimTransformer, wrong or missing docblocks. Add tests.
  • #220 Fix the stop error strategy: throw a ProcessFailedException (with the original exception as previous) instead of a FatalError, so that the command exits with a non-zero code when a process fails and ProcessLauncherTask detects failed sub-processes. Update documentation, add tests.
  • #221 Fix CsvSplitterTask: each produced file contains max_lines data lines (instead of max_lines - 2), no infinite loop with max_lines <= 2 (max_lines must now be an integer greater than 0), no header-only file at the end. Update documentation, add tests.
  • #223 Fix CounterTask: the final count is outputted once, as flush() may be called several times. Document that flush() implementations must be idempotent. Update documentation, add tests.
  • #228 Add the missing setAllowedTypes() on HashTransformer (raw_output), SimpleBatchTask (batch_count), ConditionTrait (empty, not_empty), NormalizerTask / SerializerTask / DeserializerTask (context) and ObjectUpdaterTask (property_path): a wrong type is now reported when the options are resolved. Add tests.
  • #232 Fix edge cases looping forever or failing with a TypeError: validate FileSplitterTask max_lines (greater than 0, also when given as input), catch any \Throwable in PropertySetterTask, type SlugifyTransformer options, explicit exceptions in InputFolderBrowserTask (no folder path) and XmlFile::write() (saveXML() failure). Update documentation, add tests.

Deprecated

  • #189 EventDispatcherTask: when event_name is set, listening to CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent is deprecated (the event is still dispatched under its class name, with an E_USER_DEPRECATED error, if it has listeners). Listen to the configured event_name instead: the BC layer will be removed in v6.0.
  • #222 ProcessManager: going on with the process after an exception thrown by a task initialize() is deprecated (an E_USER_DEPRECATED error is triggered). In v6.0, the process will fail before executing any task.

v5.0

Changes

  • #179 Add support for PHP 8.5 and Symfony 8.* Update phpunit/phpunit to version >10.0

BC breaks

  • #179 Remove support for PHP 8.1 and Symfony 7.3

v4.5

Changes

  • #176 Upgrade to Symfony 7.3 & PHP 8.4

v4.4

Add

  • #168 Add JsonStreamWriterTask with related doc
  • #172 Add spl_file_object_flags and json_flags options on JsonStream*Tasks. Update docs.
  • #174 Add FileSplitterTask using Filesystem/SplFile. Add doc.

Fixes

  • #169 Fix JsonStreamFile empty line at the end issue, even if SKIP_EMPTY is set. Add JsonStreamReaderTask doc.

v4.3

Add

  • #166 Add PregMatchTransformer

v4.2

Add

  • #cleverage/archive-process-bundle#1 Add new bridge ArchiveProcessBundle
  • #162 Add timestamp placeholder on file_path parameter of CsvWriterTask. Improve documentation.
  • #164 Add cleverage/cache-process-bundle dependency

v4.1.1

Fixes

  • #158 Add dependency to symfony/service-contract

v4.1

Add

  • #155 Add InputFileReaderTask (Reads the whole input file and outputs its content), InputLineReaderTask (Reads an input file line by line and outputs each line.) and LineReaderTask (Reads a file line by line and outputs each line.)

v4.0

BC breaks

  • #142 Remove FileFetchTask, use cleverage/flysystem-process-bundle instead.
  • #142 YamlReaderTask & YamlWriterTask namespaces changed to CleverAge\ProcessBundle\Task\File\Yaml
  • #142 Array***Transformers namespaces changed to CleverAge\ProcessBundle\Transformer\Array
  • #142 NormalizeTransformer & DenormalizeTransformer namespaces changed to CleverAge\ProcessBundle\Transformer\Serialization
  • #142 DateFormatTransformer & DateParserTransformer namespaces changed to CleverAge\ProcessBundle\Transformer\Date
  • #142 ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to CleverAge\ProcessBundle\Transformer\String
  • #142 InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to CleverAge\ProcessBundle\Transformer\Object
  • #147 Replace Symfony\Component\Form\Exception\InvalidConfigurationException by Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
  • #148 Update services (step 1) according to Symfony best practices. Services should not use autowiring or autoconfiguration. Instead, all services should be defined explicitly. Services must be prefixed with the bundle alias instead of using fully qualified class names => cleverage_process
  • #150 The class \CleverAge\ProcessBundle\Task\Debug\MemInfoDumpTask has been deleted without suggested replacement
  • #115 New mandatory configuration default_error_strategy on clever_age_process level. See Quick Start/Global configuration

Changes

  • #139 Update Makefile & .docker for local standalone usage
  • #139 Update rector, phpstan & php-cs-fixer configurations & apply it
  • #141 league/flysystem-bundle is not required anymore
  • #130 EventDispatcherInterface service declaration breaks dependency injection
  • #147 Add missing dependencies on symfony/dotenv and symfony/runtime
  • #147 Remove dependencies on symfony/form, symfony/messenger & symfony/scheduler
  • #146 eav-process-bundle, enqueue-process-bundle, cache-process-bundle and process-soap-bundle were deprecated / archived.
  • #141 Add a default value to the node "default_error_strategy"

Fixes

v4.0-RC2

BC breaks

  • Bump php version to >=8.2
  • Bump symfony version to ^6.4|^7.1

Fixes

v4.0-RC1

BC breaks

  • Bump php version to >=8.1
  • Bump symfony version to ^6.3

Changes

  • Add some phpunit tests
  • Apply Rector & Phpstan
  • Add StopwatchTask
  • Change directory structure. Move Symfony code to /src, documentation to /doc, and tests to /tests

Fixes

v3.2.9

Fixes

https://github.com/cleverage/process-bundle/compare/v3.2.8...v3.2.9

v3.2.8

Fixes

https://github.com/cleverage/process-bundle/compare/v3.2.7...v3.2.8

v3.2.7

Fixes

Suppress deprecation message

v3.2.6

Fixes

Fix SubprocessInstance Task for Symfony >=5

v3.2.5

Fixes

Upgrade psr/cache

v3.2.4

Features

  • Added a ttl option in the cached transformer

v3.2.3

Features

  • Added multi_replace transformer
  • Added cached transformer

Fixes

  • Fixed return value of list and help commands (mandatory for Symfony 5)

BC breaks

  • Added psr/cache as a dependency, but it shouldn't break anything
  • Added ext-intl as a dependency, since required by the slugify transformer

v3.2.2

Fixes

  • Ignore empty lines in \CleverAge\ProcessBundle\Filesystem\CsvResource::getLineCount.
  • Fixed \CleverAge\ProcessBundle\Task\AbstractIterableOutputTask skipping iterations when inside another iteration loop
  • \CleverAge\ProcessBundle\Exception\InvalidProcessConfigurationException now displays the failing process code
  • \CleverAge\ProcessBundle\Transformer\TransformerTrait now displays a more explicit message on wrong options type

v3.2.1

Fixes

  • Fatal error while loading configuration in Symfony 3.4

v3.2.0

Features

  • GITHUB-121: Enable compatibility with Symfony 5
  • GITHUB-118: Added boilerplate code to avoid deprecations notices for event listeners

BC breaks

There is no BC break for this version, but note that sidus/base-bundle has been removed from dependencies. If you use it, it should already be inside your own composer.json.

Release v3.1

v3.1-dev

Features

Nothing yet

Fixes

Nothing yet

BC breaks

Nothing yet

v3.1.5

Fixes

  • GITHUB-120: FolderBrowserTask: Accept array type for name_pattern option

v3.1.4

Features

  • (backport from v3.0.9) Adding simple task to launch system commands

v3.1.3

Features

  • (backport from v3.0.7) Allowing ValidatorTask to output constraint violations with an option
  • (backport from v3.0.6) Adding ArrayUnsetTransformer
  • (backport from v3.0.5) Adding basic debug transformer

Fixes

  • (backport from v3.0.8) Fixing AbstractIterableOutputTask that was inconsistent when chained, refactoring InputIteratorTask that had the proper implementation with the AbstractIterableOutputTask as parent

v3.1.2

Fixes

  • Fixed bad static access in tests

v3.1.1

Features

  • (backport from v3.0.4) Adding simple file reader task and cast transformer
  • (backport from v3.0.3) FilterTask now outputs skipped content to error output

Fixes

  • Removed useless, CPU intensive, log on CsvSplitterTask

v3.1.0

Features

  • GITHUB-83: added events around process execution
  • GITHUB-86: added XML manipulation tools
  • GITHUB-109: added an event during CLI process execution
  • GITHUB-107: allow to use directly a string in task outputs and errors configurations

Fixes

  • GITHUB-99: transformer exception message improvements

BC breaks

  • GIHTUB-82: the default_error_strategy is now mandatory. If you have any doubt, you can use default_error_strategy: skip to keep previous behavior.
  • GITHUB-106: an entry-point cannot have an ancestor anymore. The behaviour was undefined, and now it will throw an exception.

UPGRADE TO 2.0

Task Logging

Instead of using CleverAge\ProcessBundle\Model\ProcessState::log you must now use the standard Psr\Log\LoggerInterface with the cleverage_process_task chanel. You should also pass CleverAge\ProcessBundle\Model\ProcessState::getLogContext to the log context.

TransformerTask

The main option is now "transformers", which accept transformer codes and then transformer options. Default options should now look like:

options:
    transformers:
        mapping:
            mapping:
                <key>: <options>

UPGRADE TO 1.1

MappingTransformer

  • The option "ignore_extra" is renamed to "keep_input".

Other

  • Fixed issues with blocking tasks
  • Removed deprecated methods
  • added input/output in process manager (may allow a start_process_task)

New issues :

  • Error workflow

Planned (v2+)

  • automated transformer creation & refactoring
    • easy test cases via yml ?
  • changes in interfaces
    • allow blocking + iterable
  • FIFO queues for in/out