From de8c42b71b67433c4e77c5d12b0b9ea195f8ae3f Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 16 Oct 2024 11:04:45 +0200 Subject: [PATCH 01/41] #139 Remove unused ecs.php --- ecs.php | 24 ------------------------ phpstan.neon | 1 - 2 files changed, 25 deletions(-) delete mode 100644 ecs.php diff --git a/ecs.php b/ecs.php deleted file mode 100644 index 69fb8167..00000000 --- a/ecs.php +++ /dev/null @@ -1,24 +0,0 @@ -rule(LineLengthFixer::class); - - $ecsConfig->sets([ - SetList::CLEAN_CODE, - SetList::SYMPLIFY, - SetList::COMMON, - SetList::PSR_12, - SetList::DOCTRINE_ANNOTATIONS, - ]); - - $ecsConfig->paths([__DIR__.'/src']); - - $ecsConfig->skip([AssignmentInConditionSniff::class]); -}; diff --git a/phpstan.neon b/phpstan.neon index a9f5c7bc..244b173e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,7 +3,6 @@ parameters: paths: - src excludePaths: - - ecs.php - vendor/* - tests/* - rector.php From 1c33118c2ef5a7109f1d9a5d325dd55a4f17608a Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 09:54:12 +0200 Subject: [PATCH 02/41] #140 Move ISSUE_TEMPLATE & PULL_REQUEST_TEMPLATE to proper .github directory. Fix github notifications workflow due to RocketChat/Rocket.Chat.GitHub.Action.Notification deprecation. Add quality & test github workflows. --- .../ISSUE_TEMPLATE.md | 0 .../PULL_REQUEST_TEMPLATE.md | 0 .github/workflows/notifications.yml | 2 +- .github/workflows/quality.yml | 62 ++++++++++++++++ .github/workflows/test.yml | 74 +++++++++++++++++++ 5 files changed, 137 insertions(+), 1 deletion(-) rename ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md (100%) rename PULL_REQUEST_TEMPLATE.md => .github/PULL_REQUEST_TEMPLATE.md (100%) create mode 100644 .github/workflows/quality.yml create mode 100644 .github/workflows/test.yml diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index 00aa3926..dd59e3a5 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -16,7 +16,7 @@ jobs: run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@1.1.1 + uses: madalozzo/Rocket.Chat.GitHub.Action.Notification@v2 with: type: success job_name: "[cleverage/process-bundle](https://github.com/cleverage/process-bundle) : ${{ steps.get_tag.outputs.TAG }} has been released" diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 00000000..9f1580fe --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,62 @@ +name: Quality + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: none + tools: composer:v2 + - name: Install Composer dependencies (locked) + uses: ramsey/composer-install@v3 + - name: PHPStan + run: vendor/bin/phpstan --no-progress --memory-limit=1G analyse --error-format=github + + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: none + tools: composer:v2 + - name: Install Composer dependencies (locked) + uses: ramsey/composer-install@v3 + - name: PHP-CS-Fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none + + rector: + name: Rector + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: none + tools: composer:v2 + - name: Install Composer dependencies (locked) + uses: ramsey/composer-install@v3 + - name: Rector + run: vendor/bin/rector --no-progress-bar --dry-run diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..78aa3aa8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,74 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + test: + name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allowed-to-fail }} + env: + SYMFONY_REQUIRE: ${{matrix.symfony-require}} + + strategy: + matrix: + php-version: + - '8.2' + - '8.3' + dependencies: [highest] + allowed-to-fail: [false] + symfony-require: [''] + variant: [normal] + include: + - php-version: '8.2' + dependencies: highest + allowed-to-fail: false + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" + - php-version: '8.2' + dependencies: highest + allowed-to-fail: false + symfony-require: 7.1.* + variant: symfony/symfony:"7.1.*" + - php-version: '8.3' + dependencies: highest + allowed-to-fail: false + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" + - php-version: '8.3' + dependencies: highest + allowed-to-fail: false + symfony-require: 7.1.* + variant: symfony/symfony:"7.1.*" + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: pcov + tools: composer:v2, flex + - name: Add PHPUnit matcher + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install variant + if: matrix.variant != 'normal' && !startsWith(matrix.variant, 'symfony/symfony') + run: composer require ${{ matrix.variant }} --no-update + - name: Install Composer dependencies (${{ matrix.dependencies }}) + uses: ramsey/composer-install@v3 + with: + dependency-versions: ${{ matrix.dependencies }} + - name: Run Tests with coverage + run: make coverage + #- name: Send coverage to Codecov + # uses: codecov/codecov-action@v4 + # with: + # files: build/logs/clover.xml From c725b1030c5e9d432c7ed58602d80151a701510e Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 09:59:45 +0200 Subject: [PATCH 03/41] #138 Update README & CONTRIBUTING --- CONTRIBUTING.md | 1 - README.md | 115 ++++++++++++++++++++++++++++-------------------- 2 files changed, 68 insertions(+), 48 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06b24c8f..0a4b6a92 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,5 +14,4 @@ When a feature should be deprecated, or when you have a breaking change for a fu * Trigger a deprecation error: `@trigger_error('This feature will be deprecated in v4.0', E_USER_DEPRECATED);` You can check which deprecation notice is triggered in tests -* `make shell` * `SYMFONY_DEPRECATIONS_HELPER=0 ./vendor/bin/phpunit` diff --git a/README.md b/README.md index da35666a..28cbc9ab 100644 --- a/README.md +++ b/README.md @@ -6,58 +6,79 @@ CleverAge/ProcessBundle This bundle allows to configure series of tasks to be performed on a certain order. Basically, it will greatly ease the configuration of import and exports but can do much more. -Compatible with every [currently supported Symfony versions](https://symfony.com/releases). +Compatible with [Symfony stable version and latest Long-Term Support (LTS) release](https://symfony.com/releases). -## Index +Demo project can be found on [there](https://github.com/cleverage/process-bundle-ui-demo). + +## Documentation - [Quick start](doc/01-quick_start.md) - [Task types](doc/02-task_types.md) - [Custom tasks and development](doc/03-custom_tasks.md) - [Advanced workflow](doc/04-advanced_workflow.md) -- [Contribute](CONTRIBUTING.md) - Cookbooks - - [Common Setup](doc/cookbooks/01-common_setup.md) - - [Transformations] - - [Flow manipulation] - - [Dummy tasks] - - [Debugging] - - [Logging] - - [Subprocess] - - [File manipulation] - - [Direct call (in controller)] - - [Performances monitoring](doc/cookbooks/performances_monitoring.md) - - [Memory usage analysis](doc/cookbooks/memory_usage_graph.md) + - [Common Setup](doc/cookbooks/01-common_setup.md) + - [Transformations] + - [Flow manipulation] + - [Dummy tasks] + - [Debugging] + - [Logging] + - [Subprocess] + - [File manipulation] + - [Direct call (in controller)] + - [Performances monitoring](doc/cookbooks/performances_monitoring.md) + - [Memory usage analysis](doc/cookbooks/memory_usage_graph.md) - Reference - - [Process definition](doc/reference/01-process_definition.md) - - [Task definition](doc/reference/02-task_definition.md) - - Basic and debug - - [ConstantOutputTask](doc/reference/tasks/constant_output_task.md) - - [ConstantIterableOutputTask](doc/reference/tasks/constant_iterable_output_task.md) - - [DebugTask](doc/reference/tasks/debug_task.md) - - [DieTask](doc/reference/tasks/die_task.md) - - [DummyTask](doc/reference/tasks/dummy_task.md) - - [EventDispatcherTask](doc/reference/tasks/event_dispatcher_task.md) - - Data manipulation and transformations - - [DenormalizerTask](doc/reference/tasks/denormalizer_task.md) - - [NormalizerTask](doc/reference/tasks/normalizer_task.md) - - [PropertyGetterTask](doc/reference/tasks/property_getter_task.md) - - [PropertySetterTask](doc/reference/tasks/property_setter_task.md) - - [TransformerTask](doc/reference/tasks/transformer_task.md) - - File/CSV - - [CsvReaderTask](doc/reference/tasks/csv_reader_task.md) - - [CsvWriterTask](doc/reference/tasks/csv_writer_task.md) - - File/XML - - [XmlReaderTask](doc/reference/tasks/xml_reader_task.md) - - [XmlWriterTask](doc/reference/tasks/xml_writer_task.md) - - Flow manipulation - - [AggregateIterableTask](doc/reference/tasks/aggregate_iterable_task.md) - - [InputAggregatorTask](doc/reference/tasks/input_aggregator_task.md) - - [InputIteratorTask](doc/reference/tasks/input_iterator_task.md) - - Transformers - - [ArrayFilterTransformer](doc/reference/transformers/array_filter_transformer.md) - - [MappingTransformer](doc/reference/transformers/mapping_transformer.md) - - [RulesTransformer](doc/reference/transformers/rules_transformer.md) - - [DateFormatTransformer](doc/reference/transformers/date_format.md) - - [DateParserTransformer](doc/reference/transformers/date_parser.md) - - [XpathEvaluatorTransformer](doc/reference/transformers/xpath_evaluator.md) - - [Generic transformers definition](doc/reference/03-generic_transformers_definition.md) + - [Process definition](doc/reference/01-process_definition.md) + - [Task definition](doc/reference/02-task_definition.md) + - Basic and debug + - [ConstantOutputTask](doc/reference/tasks/constant_output_task.md) + - [ConstantIterableOutputTask](doc/reference/tasks/constant_iterable_output_task.md) + - [DebugTask](doc/reference/tasks/debug_task.md) + - [DieTask](doc/reference/tasks/die_task.md) + - [DummyTask](doc/reference/tasks/dummy_task.md) + - [EventDispatcherTask](doc/reference/tasks/event_dispatcher_task.md) + - Data manipulation and transformations + - [DenormalizerTask](doc/reference/tasks/denormalizer_task.md) + - [NormalizerTask](doc/reference/tasks/normalizer_task.md) + - [PropertyGetterTask](doc/reference/tasks/property_getter_task.md) + - [PropertySetterTask](doc/reference/tasks/property_setter_task.md) + - [TransformerTask](doc/reference/tasks/transformer_task.md) + - File/CSV + - [CsvReaderTask](doc/reference/tasks/csv_reader_task.md) + - [CsvWriterTask](doc/reference/tasks/csv_writer_task.md) + - File/XML + - [XmlReaderTask](doc/reference/tasks/xml_reader_task.md) + - [XmlWriterTask](doc/reference/tasks/xml_writer_task.md) + - Flow manipulation + - [AggregateIterableTask](doc/reference/tasks/aggregate_iterable_task.md) + - [InputAggregatorTask](doc/reference/tasks/input_aggregator_task.md) + - [InputIteratorTask](doc/reference/tasks/input_iterator_task.md) + - Transformers + - [ArrayFilterTransformer](doc/reference/transformers/array_filter_transformer.md) + - [MappingTransformer](doc/reference/transformers/mapping_transformer.md) + - [RulesTransformer](doc/reference/transformers/rules_transformer.md) + - [DateFormatTransformer](doc/reference/transformers/date_format.md) + - [DateParserTransformer](doc/reference/transformers/date_parser.md) + - [XpathEvaluatorTransformer](doc/reference/transformers/xpath_evaluator.md) + - Other bridges + - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) + - [Eav](https://github.com/cleverage/eav-process-bundle) + - [Soap](https://github.com/cleverage/soap-process-bundle) + - [Another Soap](https://github.com/cleverage/process-soap-bundle) + - [Rest](https://github.com/cleverage/rest-process-bundle) + - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) + - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) + - [Cache](https://github.com/cleverage/cache-process-bundle) + - [Generic transformers definition](doc/reference/03-generic_transformers_definition.md) +- [UI](https://github.com/cleverage/processuibundle) + +## Support & Contribution + +For general support and questions, please use [Github](https://github.com/cleverage/process-bundle/issues). +If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the [contributing](CONTRIBUTING.md) guide. + +## License + +This bundle is under the MIT license. +For the whole copyright, see the [LICENSE](LICENSE) file distributed with this source code. From 57dd03f8a642ab17acd0f990ec5fc9ad16f6887b Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 16 Oct 2024 17:06:30 +0200 Subject: [PATCH 04/41] #139 Update Makefile & .docker for local standalone usage --- .docker/compose.yaml | 12 +++++++++ .docker/php/Dockerfile | 29 ++++++++++++++++++++++ .docker/php/conf.d/dev.ini | 5 ++++ Dockerfile | 29 ---------------------- Makefile | 51 +++++++++++++++++++++++++++++++++----- 5 files changed, 91 insertions(+), 35 deletions(-) create mode 100644 .docker/compose.yaml create mode 100644 .docker/php/Dockerfile create mode 100644 .docker/php/conf.d/dev.ini delete mode 100644 Dockerfile diff --git a/.docker/compose.yaml b/.docker/compose.yaml new file mode 100644 index 00000000..9c311377 --- /dev/null +++ b/.docker/compose.yaml @@ -0,0 +1,12 @@ +x-build-args: &build-args + UID: "${UID:-1000}" + GID: "${GID:-1000}" + +services: + php: + build: + context: php + args: + <<: *build-args + volumes: + - ../:/var/www diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile new file mode 100644 index 00000000..f98c3ba0 --- /dev/null +++ b/.docker/php/Dockerfile @@ -0,0 +1,29 @@ +FROM php:8.2-fpm-alpine + +ARG UID +ARG GID + +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" +COPY /conf.d/ "$PHP_INI_DIR/conf.d/" + +RUN apk update && apk add \ + tzdata \ + shadow \ + nano \ + bash \ + icu-dev \ + && docker-php-ext-configure intl \ + && docker-php-ext-install intl opcache \ + && docker-php-ext-enable opcache + +RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime \ + && sed -i "s/^;date.timezone =.*/date.timezone = Europe\/Paris/" $PHP_INI_DIR/php.ini + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer + +RUN usermod -u $UID www-data \ + && groupmod -g $GID www-data + +USER www-data:www-data + +WORKDIR /var/www diff --git a/.docker/php/conf.d/dev.ini b/.docker/php/conf.d/dev.ini new file mode 100644 index 00000000..2a141bea --- /dev/null +++ b/.docker/php/conf.d/dev.ini @@ -0,0 +1,5 @@ +display_errors = 1 +error_reporting = E_ALL + +opcache.validate_timestamps = 1 +opcache.revalidate_freq = 0 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5ed590e7..00000000 --- a/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -ARG PHP_VERSION=8.1 -FROM php:${PHP_VERSION}-cli - -# Basic tools -RUN apt-get update -RUN apt-get install -y wget git zip unzip - -# Composer install -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer - -# PHP setup -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -COPY Resources/tests/environment/php/conf.ini "$PHP_INI_DIR/conf.d/" - -# Basic sample symfony app install -ARG SF_ENV=sf5 -ENV APP_ENV test -RUN mkdir /app -WORKDIR /app -ENV HOME /app -COPY Resources/tests/environment/${SF_ENV}/composer.json /app -RUN composer install - -# Additionnal config files for a test env -COPY phpstan.neon /app/ -COPY Resources/tests/environment/${SF_ENV} /app/ - -# Drop the process-bundle sources into this folder -RUN mkdir /src-cleverage_process diff --git a/Makefile b/Makefile index e9e753c2..d41ff83a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,50 @@ .ONESHELL: SHELL := /bin/bash -test: - php -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html coverage-report +DOCKER_RUN_PHP = docker compose -f .docker/compose.yaml run --rm php "bash" "-c" +DOCKER_COMPOSE = docker compose -f .docker/compose.yaml -linter: #[Linter] - vendor/bin/php-cs-fixer fix +start: upd #[Global] Start application -phpstan: #[Phpstan] - vendor/bin/phpstan +src/vendor: #[Composer] install dependencies + $(DOCKER_RUN_PHP) "composer install --no-interaction" + +upd: #[Docker] Start containers detached + touch .docker/.env + make src/vendor + $(DOCKER_COMPOSE) up --remove-orphans --detach + +up: #[Docker] Start containers + touch .docker/.env + make src/vendor + $(DOCKER_COMPOSE) up --remove-orphans + +stop: #[Docker] Down containers + $(DOCKER_COMPOSE) stop + +down: #[Docker] Down containers + $(DOCKER_COMPOSE) down + +build: #[Docker] Build containers + $(DOCKER_COMPOSE) build + +ps: # [Docker] Show running containers + $(DOCKER_COMPOSE) ps + +bash: #[Docker] Connect to php container with current host user + $(DOCKER_COMPOSE) exec php bash + +logs: #[Docker] Show logs + $(DOCKER_COMPOSE) logs -f + +phpstan: #[Quality] Run PHPStan + $(DOCKER_RUN_PHP) "vendor/bin/phpstan --no-progress --memory-limit=1G analyse" + +php-cs-fixer: #[Quality] Run PHP-CS-Fixer + $(DOCKER_RUN_PHP) "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose" + +rector: #[Quality] Run Rector + $(DOCKER_RUN_PHP) "vendor/bin/rector --dry-run" + +phpunit: #[Tests] Run PHPUnit + $(DOCKER_RUN_PHP) "vendor/bin/phpunit" From eae6e14f2c08b33524557c758615703c5515fdc2 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 10:22:11 +0200 Subject: [PATCH 05/41] #139 Update rector configuration & apply it. --- Makefile | 2 +- rector.php | 33 ++++++++++++------- src/Command/ProcessHelpCommand.php | 30 ++++++++--------- src/Configuration/ProcessConfiguration.php | 4 +-- src/Configuration/TaskConfiguration.php | 2 +- .../Compiler/RegistryCompilerPass.php | 2 +- src/DependencyInjection/Configuration.php | 4 +-- src/Exception/TransformerException.php | 2 +- src/Filesystem/CsvResource.php | 10 ++---- src/Logger/AbstractProcessor.php | 10 +++--- src/Manager/ProcessManager.php | 12 +++---- src/Model/ProcessHistory.php | 2 +- src/Model/ProcessState.php | 2 +- src/Model/SubprocessInstance.php | 6 ++-- src/Task/AbstractIterableOutputTask.php | 2 +- src/Task/AggregateIterableTask.php | 2 +- src/Task/ColumnAggregatorTask.php | 2 +- src/Task/File/Csv/AbstractCsvResourceTask.php | 2 +- src/Task/File/Csv/AbstractCsvTask.php | 3 +- src/Task/File/Csv/CsvSplitterTask.php | 2 +- src/Task/File/FileFetchTask.php | 2 +- .../File/JsonStream/JsonStreamReaderTask.php | 2 +- src/Task/GroupByAggregateIterableTask.php | 2 +- src/Task/InputAggregatorTask.php | 4 +-- src/Task/IterableBatchTask.php | 4 +-- src/Task/Process/ProcessLauncherTask.php | 4 +-- .../Reporting/AdvancedStatCounterTask.php | 2 +- src/Task/SimpleBatchTask.php | 2 +- src/Transformer/SlugifyTransformer.php | 2 +- src/Transformer/TransformerTrait.php | 2 +- src/Transformer/TypeSetterTransformer.php | 2 +- .../Xml/XpathEvaluatorTransformer.php | 14 +++----- 32 files changed, 89 insertions(+), 87 deletions(-) diff --git a/Makefile b/Makefile index d41ff83a..efe85520 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ php-cs-fixer: #[Quality] Run PHP-CS-Fixer $(DOCKER_RUN_PHP) "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose" rector: #[Quality] Run Rector - $(DOCKER_RUN_PHP) "vendor/bin/rector --dry-run" + $(DOCKER_RUN_PHP) "vendor/bin/rector" phpunit: #[Tests] Run PHPUnit $(DOCKER_RUN_PHP) "vendor/bin/phpunit" diff --git a/rector.php b/rector.php index 5a4479b2..72a24086 100644 --- a/rector.php +++ b/rector.php @@ -2,20 +2,29 @@ declare(strict_types=1); -/* - * This file is part of the CleverAge/ProcessBundle package. - * - * Copyright (c) 2017-2024 Clever-Age - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - use Rector\Config\RectorConfig; +use Rector\Set\ValueObject\LevelSetList; +use Rector\Symfony\Set\SymfonySetList; +use Rector\ValueObject\PhpVersion; return RectorConfig::configure() - ->withPaths([__DIR__.'/src', __DIR__.'/tests']) + ->withPhpVersion(PhpVersion::PHP_82) + ->withPaths([ + __DIR__.'/src', + __DIR__.'/tests', + ]) ->withPhpSets(php82: true) - ->withAttributesSets(symfony: true) - ->withImportNames(removeUnusedImports: true) + // here we can define, what prepared sets of rules will be applied + ->withPreparedSets( + deadCode: true, + codeQuality: true + ) + ->withSets([ + LevelSetList::UP_TO_PHP_82, + SymfonySetList::SYMFONY_64, + SymfonySetList::SYMFONY_71, + SymfonySetList::SYMFONY_CODE_QUALITY, + SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, + SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, + ]) ; diff --git a/src/Command/ProcessHelpCommand.php b/src/Command/ProcessHelpCommand.php index 8fe4a510..e1e446c3 100644 --- a/src/Command/ProcessHelpCommand.php +++ b/src/Command/ProcessHelpCommand.php @@ -83,13 +83,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(str_repeat(' ', self::INDENT_SIZE).$processCode); $output->writeln(''); - if ($process->getDescription()) { + if ($process->getDescription() !== '' && $process->getDescription() !== '0') { $output->writeln('Description:'); $output->writeln(str_repeat(' ', self::INDENT_SIZE).$process->getDescription()); $output->writeln(''); } - if ($process->getHelp()) { + if ($process->getHelp() !== '' && $process->getHelp() !== '0') { $output->writeln('Help:'); $helpLines = array_filter(explode("\n", $process->getHelp())); foreach ($helpLines as $helpLine) { @@ -116,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $branches = array_filter($branches); - if (!empty($branches)) { + if ($branches !== []) { $branchStr = '['.implode(', ', $branches).']'; $output->writeln("All branches are not resolved : {$branchStr}"); } @@ -136,7 +136,7 @@ protected function findBestNextTask( $taskCandidates = []; foreach ($taskList as $taskCode) { $task = $process->getTaskConfiguration($taskCode); - if (empty($task->getPreviousTasksConfigurations())) { + if ($task->getPreviousTasksConfigurations() === []) { return $taskCode; } @@ -156,7 +156,7 @@ protected function findBestNextTask( } } - if (empty($taskCandidates)) { + if ($taskCandidates === []) { throw new \UnexpectedValueException('Cannot find a task to output'); } @@ -175,7 +175,7 @@ protected function findBestNextTask( $weight += $key; } - if (!empty($task->getPreviousTasksConfigurations())) { + if ($task->getPreviousTasksConfigurations() !== []) { $weight /= \count($task->getPreviousTasksConfigurations()); } @@ -194,7 +194,7 @@ protected function findBestNextTask( // If a few tasks have the same weight, return the tasks with the lowest number of children $childCounts = []; - foreach ($equalWeights as $taskCode => $weight) { + foreach (array_keys($equalWeights) as $taskCode) { $task = $process->getTaskConfiguration($taskCode); $childCounts[$taskCode] = $this->getTaskChildrenCount($task); } @@ -243,7 +243,7 @@ protected function resolveBranchOutput( } // Check previous branches - if (empty($previousTasks)) { + if ($previousTasks === []) { $branches[] = $task->getCode(); } elseif (1 === \count($previousTasks)) { $prevTask = current($previousTasks) @@ -292,7 +292,7 @@ protected function resolveBranchOutput( } // Merge branches - if (!empty($branchesToMerge)) { + if ($branchesToMerge !== []) { $this->writeBranches($output, $branches); $this->writeBranches( @@ -322,7 +322,7 @@ static function ($taskCode, $i) use ($gapBranches, $origin, $final, $branches): } ); - foreach ($branches as $i => $branchTask) { + foreach (array_keys($branches) as $i) { if (\in_array($i, $branchesToMerge, true)) { $branches[$i] = null; } @@ -423,7 +423,7 @@ static function ($branchTask, $i) use ($origin, $branches, $gapBranches, $final) ); } - if (empty($nextTasks)) { + if ($nextTasks === []) { foreach ($branches as $i => $branchTask) { if ($branchTask === $taskCode) { $branches[$i] = null; @@ -467,7 +467,7 @@ protected function writeBranches( } // Str_pad does not work with unicode ? - $noFormatStrLen = mb_strlen(preg_replace('/<[^>]*>/', '', (string) $str)); + $noFormatStrLen = mb_strlen((string) preg_replace('/<[^>]*>/', '', (string) $str)); for ($j = $noFormatStrLen; $j < self::BRANCH_SIZE; ++$j) { $str .= ' '; } @@ -499,15 +499,15 @@ protected function getTaskDescription(TaskConfiguration $task): string $subprocess[] = $task->getOption('process'); } - if (\count($interfaces)) { + if ($interfaces !== []) { $description .= ' ('.implode(', ', $interfaces).')'; } - if (\count($subprocess)) { + if ($subprocess !== []) { $description .= ' {'.implode(', ', $subprocess).'}'; } - if ($task->getDescription()) { + if ($task->getDescription() !== '' && $task->getDescription() !== '0') { $description .= " {$task->getDescription()}"; } diff --git a/src/Configuration/ProcessConfiguration.php b/src/Configuration/ProcessConfiguration.php index 52db1a8c..0db330e6 100644 --- a/src/Configuration/ProcessConfiguration.php +++ b/src/Configuration/ProcessConfiguration.php @@ -164,12 +164,12 @@ public function getMainTask(): ?TaskConfiguration $entryTask = $this->getEntryPoint(); // If there's no entry point, we might use the end point - if (!$entryTask) { + if (!$entryTask instanceof TaskConfiguration) { $entryTask = $this->getEndPoint(); } // By default use the first defined task - if (!$entryTask) { + if (!$entryTask instanceof TaskConfiguration) { $entryTask = reset($this->taskConfigurations); } diff --git a/src/Configuration/TaskConfiguration.php b/src/Configuration/TaskConfiguration.php index 6a59d872..16698a14 100644 --- a/src/Configuration/TaskConfiguration.php +++ b/src/Configuration/TaskConfiguration.php @@ -188,7 +188,7 @@ public function setInErrorBranch(bool $inErrorBranch): void public function isRoot(): bool { - return empty($this->getPreviousTasksConfigurations()) && !$this->isInErrorBranch(); + return $this->getPreviousTasksConfigurations() === [] && !$this->isInErrorBranch(); } /** diff --git a/src/DependencyInjection/Compiler/RegistryCompilerPass.php b/src/DependencyInjection/Compiler/RegistryCompilerPass.php index 517bb2d5..4ca029ac 100644 --- a/src/DependencyInjection/Compiler/RegistryCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegistryCompilerPass.php @@ -41,7 +41,7 @@ public function process(ContainerBuilder $container): void $definition = $container->findDefinition($this->registry); $taggedServices = $container->findTaggedServiceIds($this->tag); - foreach ($taggedServices as $id => $tags) { + foreach (array_keys($taggedServices) as $id) { $definition->addMethodCall($this->method, [new Reference($id)]); } } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index be337f93..dd83b428 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -77,7 +77,7 @@ protected function appendTransformerConfigDefinition(NodeBuilder $definition): v ->arrayNode('contextual_options') ->prototype('variable') ->end() - ?->end() + ->end() ->arrayNode('transformers') ->prototype('variable') ->end() @@ -110,7 +110,7 @@ protected function appendProcessConfigDefinition(NodeBuilder $definition): void ->scalarNode('entry_point') ->defaultNull() ->end() - ?->scalarNode('end_point') + ->scalarNode('end_point') ->defaultNull() ->end() ?->scalarNode('description') diff --git a/src/Exception/TransformerException.php b/src/Exception/TransformerException.php index 0c88e44a..334606d2 100644 --- a/src/Exception/TransformerException.php +++ b/src/Exception/TransformerException.php @@ -46,7 +46,7 @@ protected function updateMessage(): void } else { $m = sprintf("Transformation '%s' have failed", $this->transformerCode); } - if ($this->getPrevious()) { + if ($this->getPrevious() instanceof \Throwable) { $m .= ": {$this->getPrevious() ->getMessage()}"; } diff --git a/src/Filesystem/CsvResource.php b/src/Filesystem/CsvResource.php index bab85e4e..75ee03f4 100644 --- a/src/Filesystem/CsvResource.php +++ b/src/Filesystem/CsvResource.php @@ -159,11 +159,7 @@ public function readRaw(int $length = null): array|false public function readLine(int $length = null): ?array { - if ($this->seekCalled) { - $filePosition = "at position {$this->tell()}"; - } else { - $filePosition = "on line {$this->getLineNumber()}"; - } + $filePosition = $this->seekCalled ? "at position {$this->tell()}" : "on line {$this->getLineNumber()}"; $values = $this->readRaw($length); if (false === $values) { @@ -295,7 +291,7 @@ protected function parseHeaders(array $headers = null): array // If headers are not passed in the constructor but file is readable, try to read headers from file if (null === $headers) { $autoHeaders = $this->readRaw(); - if (false === $autoHeaders || 0 === \count($autoHeaders)) { + if (false === $autoHeaders || [] === $autoHeaders) { throw new \UnexpectedValueException("Unable to read headers for {$this->getResourceName()}"); } // Remove BOM if any @@ -311,7 +307,7 @@ protected function parseHeaders(array $headers = null): array throw new \UnexpectedValueException("Invalid headers for {$this->getResourceName()}, you need to pass the headers manually"); } - if (0 === \count($headers)) { + if ([] === $headers) { throw new \UnexpectedValueException("Empty headers for {$this->getResourceName()}, you need to pass the headers manually"); } diff --git a/src/Logger/AbstractProcessor.php b/src/Logger/AbstractProcessor.php index 544c7508..110b0fbe 100644 --- a/src/Logger/AbstractProcessor.php +++ b/src/Logger/AbstractProcessor.php @@ -13,7 +13,9 @@ namespace CleverAge\ProcessBundle\Logger; +use CleverAge\ProcessBundle\Configuration\TaskConfiguration; use CleverAge\ProcessBundle\Manager\ProcessManager; +use CleverAge\ProcessBundle\Model\ProcessHistory; use Monolog\LogRecord; class AbstractProcessor @@ -25,7 +27,7 @@ public function __construct( public function __invoke(LogRecord $record): LogRecord { - if (!empty($record->context)) { + if ($record->context !== []) { $context = $this->normalizeRecordData($record->context); $record = new LogRecord( $record->datetime, @@ -58,7 +60,7 @@ protected function normalizeRecordData(array $record): array protected function addProcessInfoToRecord(array &$record): void { $processHistory = $this->processManager->getProcessHistory(); - if (!$processHistory) { + if (!$processHistory instanceof ProcessHistory) { return; } @@ -70,7 +72,7 @@ protected function addProcessInfoToRecord(array &$record): void protected function addTaskInfoToRecord(array &$record): void { $taskConfiguration = $this->processManager->getTaskConfiguration(); - if (!$taskConfiguration) { + if (!$taskConfiguration instanceof TaskConfiguration) { return; } $this->addToRecord($record, 'task_code', $taskConfiguration->getCode()); @@ -82,7 +84,7 @@ protected function addTaskInfoToRecord(array &$record): void $this->addToRecord($record, 'error', $state->getErrorOutput()); } - if ($state->getException()) { + if ($state->getException() instanceof \Throwable) { $this->addToRecord($record, 'exception', $state->getException()); } } diff --git a/src/Manager/ProcessManager.php b/src/Manager/ProcessManager.php index d0b2751c..145630a9 100644 --- a/src/Manager/ProcessManager.php +++ b/src/Manager/ProcessManager.php @@ -133,7 +133,7 @@ protected function doExecute(string $processCode, mixed $input = null, array $co } // If defined, set the input of a task - if ($processConfiguration->getEntryPoint()) { + if ($processConfiguration->getEntryPoint() instanceof TaskConfiguration) { $processConfiguration->getEntryPoint() ->getState() ->setInput($input); @@ -159,7 +159,7 @@ protected function doExecute(string $processCode, mixed $input = null, array $co // If defined, return the output of a task $returnValue = null; - if ($processConfiguration->getEndPoint()) { + if ($processConfiguration->getEndPoint() instanceof TaskConfiguration) { $returnValue = $processConfiguration->getEndPoint() ->getState() ->getOutput(); @@ -225,7 +225,7 @@ protected function initialize(TaskConfiguration $taskConfiguration): void $this->taskConfiguration = $taskConfiguration; if (TaskConfiguration::STRATEGY_STOP === $taskConfiguration->getErrorStrategy() - && \count($taskConfiguration->getErrorOutputs()) > 0) { + && $taskConfiguration->getErrorOutputs() !== []) { $m = "Task configuration {$taskConfiguration->getCode()} has error outputs "; $m .= "but it's error strategy 'stop' implies they will never be reached."; $this->taskLogger->debug($m); @@ -289,7 +289,7 @@ protected function process(TaskConfiguration $taskConfiguration, int $executionF } if ($state->isStopped()) { $exception = $state->getException(); - if ($exception) { + if ($exception instanceof \Throwable) { $m = "Process {$state->getProcessConfiguration() ->getCode()} has failed"; $m .= " during process {$state->getTaskConfiguration() @@ -353,7 +353,7 @@ protected function process(TaskConfiguration $taskConfiguration, int $executionF protected function processExecution(TaskConfiguration $taskConfiguration, int $executionFlag): void { $task = $taskConfiguration->getTask(); - if (null === $task) { + if (!$task instanceof TaskInterface) { throw new \RuntimeException("Missing task for configuration {$taskConfiguration->getCode()}"); } $state = $taskConfiguration->getState(); @@ -393,7 +393,7 @@ protected function processExecution(TaskConfiguration $taskConfiguration, int $e } // Manage exception catching and setting the same - if ($exception) { + if ($exception instanceof \Throwable) { $this->taskLogger->log( $taskConfiguration->getLogLevel(), $exception->getMessage(), diff --git a/src/Model/ProcessHistory.php b/src/Model/ProcessHistory.php index 419f1927..77f23986 100644 --- a/src/Model/ProcessHistory.php +++ b/src/Model/ProcessHistory.php @@ -120,7 +120,7 @@ public function isFailed(): bool */ public function getDuration(): ?int { - if ($this->getEndDate()) { + if ($this->getEndDate() instanceof \DateTimeInterface) { return $this->getEndDate() ->getTimestamp() - $this->getStartDate() ->getTimestamp(); diff --git a/src/Model/ProcessState.php b/src/Model/ProcessState.php index abbb2567..9b314304 100644 --- a/src/Model/ProcessState.php +++ b/src/Model/ProcessState.php @@ -165,7 +165,7 @@ public function hasErrorOutput(): bool public function stop(\Throwable $e = null): void { - if ($e) { + if ($e instanceof \Throwable) { $this->setException($e); } $this->setStopped(true); diff --git a/src/Model/SubprocessInstance.php b/src/Model/SubprocessInstance.php index fb444e53..a26ae6d8 100644 --- a/src/Model/SubprocessInstance.php +++ b/src/Model/SubprocessInstance.php @@ -80,10 +80,8 @@ public function buildProcess(): static $arguments = [...$arguments, '--output='.$this->bufferPath, '--output-format=json-stream']; } - if (!empty($this->context)) { - foreach ($this->context as $key => $value) { - $arguments[] = sprintf('--context=%s:%s', $key, $value); - } + foreach ($this->context as $key => $value) { + $arguments[] = sprintf('--context=%s:%s', $key, $value); } $arguments[] = $this->processCode; diff --git a/src/Task/AbstractIterableOutputTask.php b/src/Task/AbstractIterableOutputTask.php index b2c8f7f2..e1776e6f 100644 --- a/src/Task/AbstractIterableOutputTask.php +++ b/src/Task/AbstractIterableOutputTask.php @@ -47,7 +47,7 @@ public function execute(ProcessState $state): void */ public function next(ProcessState $state): bool { - if (!$this->iterator) { + if (!$this->iterator instanceof \Iterator) { return false; } $this->iterator->next(); diff --git a/src/Task/AggregateIterableTask.php b/src/Task/AggregateIterableTask.php index f4fcc122..4d4b850f 100644 --- a/src/Task/AggregateIterableTask.php +++ b/src/Task/AggregateIterableTask.php @@ -32,7 +32,7 @@ public function execute(ProcessState $state): void public function proceed(ProcessState $state): void { - if (0 === \count($this->result)) { + if ([] === $this->result) { $state->setSkipped(true); } else { $state->setOutput($this->result); diff --git a/src/Task/ColumnAggregatorTask.php b/src/Task/ColumnAggregatorTask.php index 033e14e2..0e00f7a7 100644 --- a/src/Task/ColumnAggregatorTask.php +++ b/src/Task/ColumnAggregatorTask.php @@ -63,7 +63,7 @@ public function execute(ProcessState $state): void } } - if (!empty($missingColumns)) { + if ($missingColumns !== []) { $colStr = implode(', ', $missingColumns); $message = "Missing columns [{$colStr}] in input"; diff --git a/src/Task/File/Csv/AbstractCsvResourceTask.php b/src/Task/File/Csv/AbstractCsvResourceTask.php index 6d4d5416..1b6ac24f 100644 --- a/src/Task/File/Csv/AbstractCsvResourceTask.php +++ b/src/Task/File/Csv/AbstractCsvResourceTask.php @@ -35,7 +35,7 @@ public function finalize(ProcessState $state): void protected function initFile(ProcessState $state): void { - if ($this->csv) { + if ($this->csv instanceof CsvResource) { return; } $options = $this->getOptions($state); diff --git a/src/Task/File/Csv/AbstractCsvTask.php b/src/Task/File/Csv/AbstractCsvTask.php index a1c2f884..ddef722e 100644 --- a/src/Task/File/Csv/AbstractCsvTask.php +++ b/src/Task/File/Csv/AbstractCsvTask.php @@ -14,6 +14,7 @@ namespace CleverAge\ProcessBundle\Task\File\Csv; use CleverAge\ProcessBundle\Filesystem\CsvFile; +use CleverAge\ProcessBundle\Filesystem\CsvResource; use CleverAge\ProcessBundle\Model\ProcessState; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -25,7 +26,7 @@ abstract class AbstractCsvTask extends AbstractCsvResourceTask { protected function initFile(ProcessState $state): void { - if ($this->csv) { + if ($this->csv instanceof CsvResource) { return; } $options = $this->getOptions($state); diff --git a/src/Task/File/Csv/CsvSplitterTask.php b/src/Task/File/Csv/CsvSplitterTask.php index 8cbc3b8b..83b16c6b 100644 --- a/src/Task/File/Csv/CsvSplitterTask.php +++ b/src/Task/File/Csv/CsvSplitterTask.php @@ -26,7 +26,7 @@ class CsvSplitterTask extends InputCsvReaderTask public function execute(ProcessState $state): void { $options = $this->getOptions($state); - if (null === $this->csv) { + if (!$this->csv instanceof CsvResource) { $headers = $this->getHeaders($state, $options); $csv = new CsvFile( $options['file_path'], diff --git a/src/Task/File/FileFetchTask.php b/src/Task/File/FileFetchTask.php index e9cb12c5..2fc166c1 100644 --- a/src/Task/File/FileFetchTask.php +++ b/src/Task/File/FileFetchTask.php @@ -43,7 +43,7 @@ public function __construct( public function initialize(ProcessState $state): void { - if (!$this->mountManager) { + if (!$this->mountManager instanceof MountManager) { throw new ServiceNotFoundException('MountManager service not found, you need to install FlySystemBundle'); } // Configure options diff --git a/src/Task/File/JsonStream/JsonStreamReaderTask.php b/src/Task/File/JsonStream/JsonStreamReaderTask.php index 9f77ab0d..effff1fe 100644 --- a/src/Task/File/JsonStream/JsonStreamReaderTask.php +++ b/src/Task/File/JsonStream/JsonStreamReaderTask.php @@ -23,7 +23,7 @@ class JsonStreamReaderTask implements IterableTaskInterface public function execute(ProcessState $state): void { - if (null === $this->file) { + if (!$this->file instanceof JsonStreamFile) { $this->file = new JsonStreamFile($this->getFilePath($state), 'rb'); } diff --git a/src/Task/GroupByAggregateIterableTask.php b/src/Task/GroupByAggregateIterableTask.php index 3d676ca3..d521e329 100644 --- a/src/Task/GroupByAggregateIterableTask.php +++ b/src/Task/GroupByAggregateIterableTask.php @@ -61,7 +61,7 @@ public function execute(ProcessState $state): void public function proceed(ProcessState $state): void { - if (0 === \count($this->result)) { + if ([] === $this->result) { $state->setSkipped(true); } else { $state->setOutput($this->result); diff --git a/src/Task/InputAggregatorTask.php b/src/Task/InputAggregatorTask.php index 28ccf5e4..0aeea05f 100644 --- a/src/Task/InputAggregatorTask.php +++ b/src/Task/InputAggregatorTask.php @@ -54,7 +54,7 @@ public function execute(ProcessState $state): void $state->setOutput($this->inputs); $keepInputs = $this->getOption($state, 'keep_inputs'); // Only clear inputs that are not in the keep_inputs option - foreach ($this->inputs as $inputCode => $value) { + foreach (array_keys($this->inputs) as $inputCode) { if (null !== $keepInputs && \in_array($inputCode, $keepInputs, true)) { continue; } @@ -83,7 +83,7 @@ protected function configureOptions(OptionsResolver $resolver): void protected function getInputCode(ProcessState $state): string { $previousState = $state->getPreviousState(); - if (!$previousState) { + if (!$previousState instanceof ProcessState) { throw new \RuntimeException('No previous state for current task'); } $previousTaskCode = $previousState->getTaskConfiguration() diff --git a/src/Task/IterableBatchTask.php b/src/Task/IterableBatchTask.php index 15f46e24..4e9a5ed0 100644 --- a/src/Task/IterableBatchTask.php +++ b/src/Task/IterableBatchTask.php @@ -61,7 +61,7 @@ public function execute(ProcessState $state): void } // Detect flushing - if (null !== $batchCount && (null === $this->outputQueue ? 0 : \count($this->outputQueue)) >= $batchCount) { + if (null !== $batchCount && ($this->outputQueue instanceof \SplQueue ? \count($this->outputQueue) : 0) >= $batchCount) { $this->flushMode = true; } @@ -76,7 +76,7 @@ public function execute(ProcessState $state): void public function next(ProcessState $state): bool { // Stop flushing once over - if (!(null === $this->outputQueue ? 0 : \count($this->outputQueue))) { + if (($this->outputQueue instanceof \SplQueue ? \count($this->outputQueue) : 0) === 0) { $this->flushMode = false; } diff --git a/src/Task/Process/ProcessLauncherTask.php b/src/Task/Process/ProcessLauncherTask.php index 1661b87f..a3c3f5cc 100644 --- a/src/Task/Process/ProcessLauncherTask.php +++ b/src/Task/Process/ProcessLauncherTask.php @@ -78,7 +78,7 @@ public function flush(ProcessState $state): void } // After dequeue, stop flush - if ($this->finishedBuffers->isEmpty() && !\count($this->launchedProcesses)) { + if ($this->finishedBuffers->isEmpty() && $this->launchedProcesses === []) { $this->flushMode = false; } } @@ -96,7 +96,7 @@ public function next(ProcessState $state): bool // if we are in flush mode, we should wait for process to finish if ($this->flushMode) { - return \count($this->launchedProcesses) > 0; + return $this->launchedProcesses !== []; } usleep($this->getOption($state, 'sleep_on_finalize_interval')); diff --git a/src/Task/Reporting/AdvancedStatCounterTask.php b/src/Task/Reporting/AdvancedStatCounterTask.php index fed1243c..3f2eb47c 100644 --- a/src/Task/Reporting/AdvancedStatCounterTask.php +++ b/src/Task/Reporting/AdvancedStatCounterTask.php @@ -39,7 +39,7 @@ public function __construct( public function execute(ProcessState $state): void { $now = new \DateTime(); - if (!$this->startedAt) { + if (!$this->startedAt instanceof \DateTime) { $this->startedAt = $now; $this->lastUpdate = $now; } diff --git a/src/Task/SimpleBatchTask.php b/src/Task/SimpleBatchTask.php index e0173bc7..9db576ba 100644 --- a/src/Task/SimpleBatchTask.php +++ b/src/Task/SimpleBatchTask.php @@ -27,7 +27,7 @@ class SimpleBatchTask extends AbstractConfigurableTask implements FlushableTaskI public function flush(ProcessState $state): void { - if (0 === \count($this->elements)) { + if ([] === $this->elements) { $state->setSkipped(true); } else { $state->setOutput($this->elements); diff --git a/src/Transformer/SlugifyTransformer.php b/src/Transformer/SlugifyTransformer.php index 491eb52f..b5dd77cf 100644 --- a/src/Transformer/SlugifyTransformer.php +++ b/src/Transformer/SlugifyTransformer.php @@ -28,7 +28,7 @@ public function transform(mixed $value, array $options = []): string $string = $transliterator->transliterate($value); return trim( - preg_replace( + (string) preg_replace( $options['replace'], (string) $options['separator'], strtolower(trim(strip_tags($string))) diff --git a/src/Transformer/TransformerTrait.php b/src/Transformer/TransformerTrait.php index e3874aa0..4079603f 100644 --- a/src/Transformer/TransformerTrait.php +++ b/src/Transformer/TransformerTrait.php @@ -52,7 +52,7 @@ public function normalizeTransformers(Options $options, array $transformers): ar protected function applyTransformers(array $transformers, mixed $value): mixed { // Quick return for better perfs - if (empty($transformers)) { + if ($transformers === []) { return $value; } diff --git a/src/Transformer/TypeSetterTransformer.php b/src/Transformer/TypeSetterTransformer.php index a9e621fc..202384d0 100644 --- a/src/Transformer/TypeSetterTransformer.php +++ b/src/Transformer/TypeSetterTransformer.php @@ -32,7 +32,7 @@ public function transform(mixed $value, array $options = []): mixed { $return = settype($value, $options['type']); - if (true === $return) { + if ($return) { return $value; } diff --git a/src/Transformer/Xml/XpathEvaluatorTransformer.php b/src/Transformer/Xml/XpathEvaluatorTransformer.php index e4952d21..9b5964e8 100644 --- a/src/Transformer/Xml/XpathEvaluatorTransformer.php +++ b/src/Transformer/Xml/XpathEvaluatorTransformer.php @@ -67,13 +67,13 @@ public function configureOptions(OptionsResolver $resolver): void */ public function configureQueryOptions(OptionsResolver $resolver, Options $parentOptions = null): void { - $resolver->setDefault('single_result', $parentOptions ? $parentOptions['single_result'] : true); + $resolver->setDefault('single_result', $parentOptions instanceof Options ? $parentOptions['single_result'] : true); $resolver->setAllowedTypes('single_result', 'bool'); - $resolver->setDefault('ignore_missing', $parentOptions ? $parentOptions['ignore_missing'] : true); + $resolver->setDefault('ignore_missing', $parentOptions instanceof Options ? $parentOptions['ignore_missing'] : true); $resolver->setAllowedTypes('ignore_missing', 'bool'); - $resolver->setDefault('unwrap_value', $parentOptions ? $parentOptions['unwrap_value'] : true); + $resolver->setDefault('unwrap_value', $parentOptions instanceof Options ? $parentOptions['unwrap_value'] : true); $resolver->setAllowedTypes('unwrap_value', 'bool'); } @@ -137,15 +137,11 @@ public function query(\DOMXPath $xpath, string $query, \DOMNode $node, array $op throw new \UnexpectedValueException("There is too much results for query '{$query}'"); } - if (!$options['ignore_missing'] && 0 === \count($results)) { + if (!$options['ignore_missing'] && [] === $results) { throw new \UnexpectedValueException("There is not enough results for query '{$query}'"); } - if (1 === \count($results)) { - $results = $results[0]; - } else { - $results = null; - } + $results = 1 === \count($results) ? $results[0] : null; } return $results; From d8eb15f90c8b099e4cc1864bcfbf78ad9749c2a3 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 09:31:11 +0200 Subject: [PATCH 06/41] #139 #130 Update phpstan configuration & apply it : - Replace Psr\EventDispatcher\EventDispatcherInterface by Symfony\Component\EventDispatcher\EventDispatcherInterface - Fix Configuration than can't use coalescent operators - Fix typing & remove useless code --- phpstan.neon | 7 ++----- src/Command/ExecuteProcessCommand.php | 2 +- src/DependencyInjection/Configuration.php | 12 ++++++------ src/Filesystem/CsvResource.php | 2 +- src/Logger/AbstractLogger.php | 2 +- src/Manager/ProcessManager.php | 2 +- src/Resources/config/services/event.yaml | 4 ---- src/Task/Event/EventDispatcherTask.php | 2 +- src/Task/File/Csv/CsvSplitterTask.php | 2 +- tests.old/ProcessManagerTest.php | 2 +- 10 files changed, 15 insertions(+), 22 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 244b173e..e374f1ba 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,11 +2,8 @@ parameters: level: 6 paths: - src + - tests excludePaths: - - vendor/* - - tests/* - - rector.php - - var/* - src/Resources/tests/* ignoreErrors: - '#type has no value type specified in iterable type#' @@ -20,4 +17,4 @@ parameters: checkGenericClassInNonGenericObjectType: false reportUnmatchedIgnoredErrors: false inferPrivatePropertyTypeFromConstructor: true - treatPhpDocTypesAsCertain: false \ No newline at end of file + treatPhpDocTypesAsCertain: false diff --git a/src/Command/ExecuteProcessCommand.php b/src/Command/ExecuteProcessCommand.php index 73fec99a..2f170323 100644 --- a/src/Command/ExecuteProcessCommand.php +++ b/src/Command/ExecuteProcessCommand.php @@ -17,7 +17,6 @@ use CleverAge\ProcessBundle\Filesystem\JsonStreamFile; use CleverAge\ProcessBundle\Manager\ProcessManager; use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; -use Psr\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; @@ -25,6 +24,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\VarDumper\VarDumper; use Symfony\Component\Yaml\Parser; diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index dd83b428..5921ec28 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -81,7 +81,7 @@ protected function appendTransformerConfigDefinition(NodeBuilder $definition): v ->arrayNode('transformers') ->prototype('variable') ->end() - ?->end(); + ->end(); } /** @@ -113,19 +113,19 @@ protected function appendProcessConfigDefinition(NodeBuilder $definition): void ->scalarNode('end_point') ->defaultNull() ->end() - ?->scalarNode('description') + ->scalarNode('description') ->defaultValue('') ->end() - ?->scalarNode('help') + ->scalarNode('help') ->defaultValue('') ->end() - ?->scalarNode('public') + ->scalarNode('public') ->defaultTrue() ->end() - ?->arrayNode('options') + ->arrayNode('options') ->prototype('variable') ->end() - ?->end(); + ->end(); /** @var ArrayNodeDefinition $tasksArrayDefinition */ $tasksArrayDefinition = $definition diff --git a/src/Filesystem/CsvResource.php b/src/Filesystem/CsvResource.php index 75ee03f4..87937572 100644 --- a/src/Filesystem/CsvResource.php +++ b/src/Filesystem/CsvResource.php @@ -40,7 +40,7 @@ class CsvResource implements WritableStructuredFileInterface, SeekableFileInterf protected bool $seekCalled = false; public function __construct( - $resource, + mixed $resource, protected string $delimiter = ',', protected string $enclosure = '"', protected string $escape = '\\', diff --git a/src/Logger/AbstractLogger.php b/src/Logger/AbstractLogger.php index 804d11cd..1f84fdde 100644 --- a/src/Logger/AbstractLogger.php +++ b/src/Logger/AbstractLogger.php @@ -28,7 +28,7 @@ public function __construct( ) { } - public function log($level, $message, array $context = []): void + public function log($level, string|\Stringable $message, array $context = []): void { $this->logger->log($level, $message, $context); } diff --git a/src/Manager/ProcessManager.php b/src/Manager/ProcessManager.php index 145630a9..e8d71865 100644 --- a/src/Manager/ProcessManager.php +++ b/src/Manager/ProcessManager.php @@ -29,9 +29,9 @@ use CleverAge\ProcessBundle\Model\ProcessState; use CleverAge\ProcessBundle\Model\TaskInterface; use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; -use Psr\EventDispatcher\EventDispatcherInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\ErrorHandler\Error\FatalError; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Execute processes. diff --git a/src/Resources/config/services/event.yaml b/src/Resources/config/services/event.yaml index b5a218a1..f4a5bb70 100644 --- a/src/Resources/config/services/event.yaml +++ b/src/Resources/config/services/event.yaml @@ -1,8 +1,4 @@ services: - Symfony\Contracts\EventDispatcher\EventDispatcherInterface: - public: false - autowire: true - CleverAge\ProcessBundle\EventListener\DataQueueEventListener: public: false tags: diff --git a/src/Task/Event/EventDispatcherTask.php b/src/Task/Event/EventDispatcherTask.php index 1233fb6b..6771c16d 100644 --- a/src/Task/Event/EventDispatcherTask.php +++ b/src/Task/Event/EventDispatcherTask.php @@ -16,7 +16,7 @@ use CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent; use CleverAge\ProcessBundle\Model\AbstractConfigurableTask; use CleverAge\ProcessBundle\Model\ProcessState; -use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Task/File/Csv/CsvSplitterTask.php b/src/Task/File/Csv/CsvSplitterTask.php index 83b16c6b..12e1b7a1 100644 --- a/src/Task/File/Csv/CsvSplitterTask.php +++ b/src/Task/File/Csv/CsvSplitterTask.php @@ -72,7 +72,7 @@ public function finalize(ProcessState $state): void } } - protected function splitCsv(CsvFile $csv, int $maxLines): string + protected function splitCsv(CsvResource $csv, int $maxLines): string { $tmpFilePath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_'.uniqid('process', false).'.csv'; $tmpFile = fopen($tmpFilePath, 'wb+'); diff --git a/tests.old/ProcessManagerTest.php b/tests.old/ProcessManagerTest.php index 42c49450..3d019b5e 100644 --- a/tests.old/ProcessManagerTest.php +++ b/tests.old/ProcessManagerTest.php @@ -21,7 +21,7 @@ use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; use Prophecy\Argument\Token\TypeToken; use Prophecy\Prophecy\MethodProphecy; -use Psr\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ProcessManagerTest extends AbstractProcessTest { From 29fac79332aeca1498e9c6ed8dbdc8c3109accee Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 10:30:20 +0200 Subject: [PATCH 07/41] #139 Update php-cs-fixer configuration & apply it. --- .php-cs-fixer.dist.php | 14 ++++--- Makefile | 2 +- src/CleverAgeProcessBundle.php | 2 +- src/Command/ExecuteProcessCommand.php | 12 +++--- src/Command/ListProcessCommand.php | 4 +- src/Command/ProcessHelpCommand.php | 38 +++++++++---------- src/Configuration/ProcessConfiguration.php | 4 +- src/Configuration/TaskConfiguration.php | 6 +-- src/Context/ContextualOptionResolver.php | 4 +- .../CleverAgeProcessExtension.php | 2 +- .../Compiler/CheckSerializerCompilerPass.php | 2 +- .../Compiler/RegistryCompilerPass.php | 4 +- src/DependencyInjection/Configuration.php | 4 +- src/Event/ConsoleProcessEvent.php | 4 +- src/Event/EventDispatcherTaskEvent.php | 4 +- src/Event/ProcessEvent.php | 4 +- src/EventListener/DataQueueEventListener.php | 2 +- src/Exception/CircularProcessException.php | 2 +- .../InvalidProcessConfigurationException.php | 6 +-- src/Exception/MissingProcessException.php | 2 +- .../MissingTaskConfigurationException.php | 2 +- src/Exception/MissingTransformerException.php | 2 +- src/Exception/ProcessExceptionInterface.php | 2 +- src/Exception/TransformerException.php | 8 ++-- .../PhpFunctionProvider.php | 4 +- src/Filesystem/CsvFile.php | 10 ++--- src/Filesystem/CsvResource.php | 10 ++--- src/Filesystem/FileStreamInterface.php | 4 +- src/Filesystem/JsonStreamFile.php | 4 +- src/Filesystem/SeekableFileInterface.php | 2 +- src/Filesystem/StructuredFileInterface.php | 2 +- src/Filesystem/WritableFileInterface.php | 2 +- .../WritableStructuredFileInterface.php | 2 +- src/Filesystem/XmlFile.php | 2 +- src/Logger/AbstractLogger.php | 4 +- src/Logger/AbstractProcessor.php | 6 +-- src/Logger/ProcessLogger.php | 2 +- src/Logger/ProcessProcessor.php | 2 +- src/Logger/TaskLogger.php | 2 +- src/Logger/TaskProcessor.php | 2 +- src/Logger/TransformerProcessor.php | 2 +- src/Manager/ProcessManager.php | 10 ++--- src/Model/AbstractConfigurableTask.php | 2 +- src/Model/BlockingTaskInterface.php | 2 +- src/Model/FinalizableTaskInterface.php | 2 +- src/Model/FlushableTaskInterface.php | 2 +- src/Model/InitializableTaskInterface.php | 2 +- src/Model/IterableTaskInterface.php | 2 +- src/Model/ProcessHistory.php | 4 +- src/Model/ProcessState.php | 8 ++-- src/Model/SubprocessInstance.php | 6 +-- src/Model/TaskInterface.php | 2 +- src/Registry/ProcessConfigurationRegistry.php | 4 +- src/Registry/TransformerRegistry.php | 2 +- src/Task/AbstractIterableOutputTask.php | 2 +- src/Task/AggregateIterableTask.php | 2 +- src/Task/ArrayMergeTask.php | 2 +- src/Task/ColumnAggregatorTask.php | 8 ++-- src/Task/ConstantIterableOutputTask.php | 2 +- src/Task/ConstantOutputTask.php | 2 +- src/Task/CounterTask.php | 2 +- src/Task/Debug/DebugTask.php | 2 +- src/Task/Debug/DieTask.php | 2 +- src/Task/Debug/ErrorForwarderTask.php | 2 +- src/Task/Debug/MemInfoDumpTask.php | 4 +- src/Task/Debug/StopwatchTask.php | 4 +- src/Task/DummyTask.php | 2 +- src/Task/Event/EventDispatcherTask.php | 4 +- src/Task/File/Csv/AbstractCsvResourceTask.php | 2 +- src/Task/File/Csv/AbstractCsvTask.php | 2 +- src/Task/File/Csv/CsvReaderTask.php | 4 +- src/Task/File/Csv/CsvSplitterTask.php | 2 +- src/Task/File/Csv/CsvWriterTask.php | 2 +- src/Task/File/Csv/InputCsvReaderTask.php | 2 +- src/Task/File/FileFetchTask.php | 6 +-- src/Task/File/FileMoverTask.php | 2 +- src/Task/File/FileReaderTask.php | 2 +- src/Task/File/FileRemoverTask.php | 2 +- src/Task/File/FileWriterTask.php | 2 +- src/Task/File/FolderBrowserTask.php | 4 +- src/Task/File/InputFolderBrowserTask.php | 2 +- .../File/JsonStream/JsonStreamReaderTask.php | 2 +- src/Task/File/Xml/XmlReaderTask.php | 4 +- src/Task/File/Xml/XmlWriterTask.php | 4 +- src/Task/File/YamlReaderTask.php | 2 +- src/Task/File/YamlWriterTask.php | 2 +- src/Task/FilterTask.php | 2 +- src/Task/GroupByAggregateIterableTask.php | 4 +- src/Task/InputAggregatorTask.php | 2 +- src/Task/InputIteratorTask.php | 2 +- src/Task/IterableBatchTask.php | 4 +- src/Task/ObjectUpdaterTask.php | 4 +- src/Task/Process/CommandRunnerTask.php | 4 +- src/Task/Process/ProcessExecutorTask.php | 4 +- src/Task/Process/ProcessLauncherTask.php | 8 ++-- src/Task/PropertyGetterTask.php | 4 +- src/Task/PropertySetterTask.php | 4 +- .../Reporting/AdvancedStatCounterTask.php | 4 +- src/Task/Reporting/LoggerTask.php | 4 +- src/Task/Reporting/StatCounterTask.php | 4 +- src/Task/RowAggregatorTask.php | 4 +- src/Task/Serialization/DenormalizerTask.php | 4 +- src/Task/Serialization/DeserializerTask.php | 4 +- src/Task/Serialization/NormalizerTask.php | 4 +- src/Task/Serialization/SerializerTask.php | 4 +- src/Task/SimpleBatchTask.php | 2 +- src/Task/SkipEmptyTask.php | 2 +- src/Task/SplitJoinLineTask.php | 2 +- src/Task/StopTask.php | 2 +- src/Task/TransformerTask.php | 4 +- src/Task/Validation/ValidatorTask.php | 4 +- src/Transformer/ArrayElementTransformer.php | 2 +- src/Transformer/ArrayFilterTransformer.php | 2 +- src/Transformer/ArrayFirstTransformer.php | 2 +- src/Transformer/ArrayLastTransformer.php | 2 +- src/Transformer/ArrayMapTransformer.php | 2 +- src/Transformer/ArrayUnsetTransformer.php | 2 +- src/Transformer/CachedTransformer.php | 4 +- src/Transformer/CallbackTransformer.php | 2 +- src/Transformer/CastTransformer.php | 2 +- src/Transformer/ConditionTrait.php | 4 +- .../ConfigurableTransformerInterface.php | 2 +- src/Transformer/ConstantTransformer.php | 2 +- src/Transformer/ConvertValueTransformer.php | 2 +- src/Transformer/DateFormatTransformer.php | 2 +- src/Transformer/DateParserTransformer.php | 2 +- src/Transformer/DebugTransformer.php | 2 +- src/Transformer/DefaultTransformer.php | 2 +- src/Transformer/DenormalizeTransformer.php | 4 +- src/Transformer/EvaluatorTransformer.php | 2 +- src/Transformer/ExplodeTransformer.php | 2 +- .../ExpressionLanguageMapTransformer.php | 4 +- src/Transformer/GenericTransformer.php | 4 +- src/Transformer/HashTransformer.php | 2 +- src/Transformer/ImplodeTransformer.php | 2 +- src/Transformer/InstantiateTransformer.php | 2 +- src/Transformer/MappingTransformer.php | 4 +- src/Transformer/MultiReplaceTransformer.php | 2 +- src/Transformer/NormalizeTransformer.php | 4 +- src/Transformer/PregFilterTransformer.php | 2 +- .../PropertyAccessorTransformer.php | 4 +- .../RecursivePropertySetterTransformer.php | 4 +- src/Transformer/RulesTransformer.php | 6 +-- src/Transformer/SlugifyTransformer.php | 2 +- src/Transformer/SprintfTransformer.php | 2 +- src/Transformer/TransformerInterface.php | 2 +- src/Transformer/TransformerTrait.php | 6 +-- src/Transformer/TrimTransformer.php | 2 +- src/Transformer/TypeSetterTransformer.php | 2 +- src/Transformer/UnsetTransformer.php | 2 +- src/Transformer/WrapperTransformer.php | 2 +- .../Xml/XpathEvaluatorTransformer.php | 4 +- src/Validator/ConstraintLoader.php | 2 +- .../MissingTransformerExceptionTest.php | 9 +++++ .../ArrayElementTransformerTest.php | 2 +- .../Transformer/ArrayFirstTransformerTest.php | 2 +- tests/Transformer/CastTransformerTest.php | 2 +- tests/Transformer/ConstantTransformerTest.php | 2 +- .../Transformer/DateFormatTransformerTest.php | 2 +- .../Transformer/DateParserTransformerTest.php | 2 +- tests/Transformer/DebugTransformerTest.php | 2 +- tests/Transformer/DefaultTransformerTest.php | 2 +- tests/Transformer/ExplodeTransformerTest.php | 2 +- tests/Transformer/ImplodeTransformerTest.php | 2 +- .../MultiReplaceTransformerTest.php | 2 +- tests/Transformer/SprintfTransformerTest.php | 9 +++++ tests/Transformer/TrimTransformerTest.php | 2 +- tests/Transformer/WrapperTransformerTest.php | 2 +- .../XpathEvaluatorTransformerTest.php | 2 +- 169 files changed, 301 insertions(+), 281 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 4f96866e..b994793f 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -3,7 +3,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -14,17 +14,18 @@ } $fileHeaderComment = <<<'EOF' -This file is part of the CleverAge/ProcessBundle package. + This file is part of the CleverAge/ProcessBundle package. -Copyright (c) 2017-2024 Clever-Age + Copyright (c) Clever-Age -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. -EOF; + For the full copyright and license information, please view the LICENSE + file that was distributed with this source code. + EOF; return (new PhpCsFixer\Config()) ->setRules([ '@PHP71Migration' => true, + '@PHP82Migration' => true, '@PHPUnit75Migration:risky' => true, '@Symfony' => true, '@Symfony:risky' => true, @@ -38,6 +39,7 @@ ->setFinder( (new PhpCsFixer\Finder()) ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') ->append([__FILE__]) ) ->setCacheFile('.php-cs-fixer.cache') diff --git a/Makefile b/Makefile index efe85520..3461c159 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ phpstan: #[Quality] Run PHPStan $(DOCKER_RUN_PHP) "vendor/bin/phpstan --no-progress --memory-limit=1G analyse" php-cs-fixer: #[Quality] Run PHP-CS-Fixer - $(DOCKER_RUN_PHP) "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose" + $(DOCKER_RUN_PHP) "vendor/bin/php-cs-fixer fix --diff --verbose" rector: #[Quality] Run Rector $(DOCKER_RUN_PHP) "vendor/bin/rector" diff --git a/src/CleverAgeProcessBundle.php b/src/CleverAgeProcessBundle.php index 27904639..10838026 100644 --- a/src/CleverAgeProcessBundle.php +++ b/src/CleverAgeProcessBundle.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Command/ExecuteProcessCommand.php b/src/Command/ExecuteProcessCommand.php index 2f170323..088428f5 100644 --- a/src/Command/ExecuteProcessCommand.php +++ b/src/Command/ExecuteProcessCommand.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$this->processRegistry->hasProcessConfiguration($code)) { throw new InvalidConfigurationException("Unknown process {$code}"); } - + if (!$output->isQuiet()) { $output->writeln("Starting process '{$code}'..."); } @@ -123,7 +123,7 @@ protected function parseContextValues(InputInterface $input): array preg_match($pattern, (string) $contextValue, $parts); if (3 !== \count($parts) || $parts[0] !== $contextValue) { - throw new \InvalidArgumentException(sprintf('Invalid context %s', $contextValue)); + throw new \InvalidArgumentException(\sprintf('Invalid context %s', $contextValue)); } $context[$parts[1]] = $parser->parse($parts[2]); } @@ -148,7 +148,7 @@ protected function handleOutputData(mixed $data, InputInterface $input, OutputIn } elseif (self::OUTPUT_FORMAT_JSON === $input->getOption('output-format')) { $output->writeln(json_encode($data, \JSON_THROW_ON_ERROR)); } else { - throw new \InvalidArgumentException(sprintf("Cannot handle data output with format '%s'", $input->getOption('output-format'))); + throw new \InvalidArgumentException(\sprintf("Cannot handle data output with format '%s'", $input->getOption('output-format'))); } } } elseif (self::OUTPUT_FORMAT_JSON === $input->getOption('output-format')) { @@ -160,10 +160,10 @@ protected function handleOutputData(mixed $data, InputInterface $input, OutputIn } if (isset($outputFile) && $output->isVerbose()) { - $output->writeln(sprintf("Output stored in '%s'", $input->getOption('output'))); + $output->writeln(\sprintf("Output stored in '%s'", $input->getOption('output'))); } } else { - throw new \InvalidArgumentException(sprintf("Cannot handle data output with format '%s'", $input->getOption('output-format'))); + throw new \InvalidArgumentException(\sprintf("Cannot handle data output with format '%s'", $input->getOption('output-format'))); } } } diff --git a/src/Command/ListProcessCommand.php b/src/Command/ListProcessCommand.php index fcca76c1..01fdf997 100644 --- a/src/Command/ListProcessCommand.php +++ b/src/Command/ListProcessCommand.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,7 +28,7 @@ class ListProcessCommand extends Command { public function __construct( - protected ProcessConfigurationRegistry $processConfigRegistry + protected ProcessConfigurationRegistry $processConfigRegistry, ) { parent::__construct(); } diff --git a/src/Command/ProcessHelpCommand.php b/src/Command/ProcessHelpCommand.php index e1e446c3..ea22e351 100644 --- a/src/Command/ProcessHelpCommand.php +++ b/src/Command/ProcessHelpCommand.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -61,7 +61,7 @@ class ProcessHelpCommand extends Command public function __construct( protected ProcessConfigurationRegistry $processConfigRegistry, - protected ContainerInterface $container + protected ContainerInterface $container, ) { parent::__construct(); } @@ -83,13 +83,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(str_repeat(' ', self::INDENT_SIZE).$processCode); $output->writeln(''); - if ($process->getDescription() !== '' && $process->getDescription() !== '0') { + if ('' !== $process->getDescription() && '0' !== $process->getDescription()) { $output->writeln('Description:'); $output->writeln(str_repeat(' ', self::INDENT_SIZE).$process->getDescription()); $output->writeln(''); } - if ($process->getHelp() !== '' && $process->getHelp() !== '0') { + if ('' !== $process->getHelp() && '0' !== $process->getHelp()) { $output->writeln('Help:'); $helpLines = array_filter(explode("\n", $process->getHelp())); foreach ($helpLines as $helpLine) { @@ -116,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $branches = array_filter($branches); - if ($branches !== []) { + if ([] !== $branches) { $branchStr = '['.implode(', ', $branches).']'; $output->writeln("All branches are not resolved : {$branchStr}"); } @@ -130,13 +130,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function findBestNextTask( array $branches, array $taskList, - ProcessConfiguration $process - ): int|null|string { + ProcessConfiguration $process, + ): int|string|null { // Get resolvable tasks $taskCandidates = []; foreach ($taskList as $taskCode) { $task = $process->getTaskConfiguration($taskCode); - if ($task->getPreviousTasksConfigurations() === []) { + if ([] === $task->getPreviousTasksConfigurations()) { return $taskCode; } @@ -156,7 +156,7 @@ protected function findBestNextTask( } } - if ($taskCandidates === []) { + if ([] === $taskCandidates) { throw new \UnexpectedValueException('Cannot find a task to output'); } @@ -175,7 +175,7 @@ protected function findBestNextTask( $weight += $key; } - if ($task->getPreviousTasksConfigurations() !== []) { + if ([] !== $task->getPreviousTasksConfigurations()) { $weight /= \count($task->getPreviousTasksConfigurations()); } @@ -228,7 +228,7 @@ protected function resolveBranchOutput( array &$branches, string $taskCode, ProcessConfiguration $process, - OutputInterface $output + OutputInterface $output, ): void { $task = $process->getTaskConfiguration($taskCode); $branchesToMerge = []; @@ -243,7 +243,7 @@ protected function resolveBranchOutput( } // Check previous branches - if ($previousTasks === []) { + if ([] === $previousTasks) { $branches[] = $task->getCode(); } elseif (1 === \count($previousTasks)) { $prevTask = current($previousTasks) @@ -292,7 +292,7 @@ protected function resolveBranchOutput( } // Merge branches - if ($branchesToMerge !== []) { + if ([] !== $branchesToMerge) { $this->writeBranches($output, $branches); $this->writeBranches( @@ -423,7 +423,7 @@ static function ($branchTask, $i) use ($origin, $branches, $gapBranches, $final) ); } - if ($nextTasks === []) { + if ([] === $nextTasks) { foreach ($branches as $i => $branchTask) { if ($branchTask === $taskCode) { $branches[$i] = null; @@ -446,8 +446,8 @@ protected function writeBranches( OutputInterface $output, array $branches, string|iterable $comment = '', - callable $match = null, - string|callable $char = null + ?callable $match = null, + string|callable|null $char = null, ): void { $output->write(str_repeat(' ', self::INDENT_SIZE)); @@ -499,15 +499,15 @@ protected function getTaskDescription(TaskConfiguration $task): string $subprocess[] = $task->getOption('process'); } - if ($interfaces !== []) { + if ([] !== $interfaces) { $description .= ' ('.implode(', ', $interfaces).')'; } - if ($subprocess !== []) { + if ([] !== $subprocess) { $description .= ' {'.implode(', ', $subprocess).'}'; } - if ($task->getDescription() !== '' && $task->getDescription() !== '0') { + if ('' !== $task->getDescription() && '0' !== $task->getDescription()) { $description .= " {$task->getDescription()}"; } diff --git a/src/Configuration/ProcessConfiguration.php b/src/Configuration/ProcessConfiguration.php index 0db330e6..421680f7 100644 --- a/src/Configuration/ProcessConfiguration.php +++ b/src/Configuration/ProcessConfiguration.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,7 +33,7 @@ public function __construct( protected ?string $endPoint = null, protected string $description = '', protected string $help = '', - protected bool $public = true + protected bool $public = true, ) { } diff --git a/src/Configuration/TaskConfiguration.php b/src/Configuration/TaskConfiguration.php index 16698a14..feabfa7c 100644 --- a/src/Configuration/TaskConfiguration.php +++ b/src/Configuration/TaskConfiguration.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -58,7 +58,7 @@ public function __construct( protected array $outputs = [], protected array $errorOutputs = [], protected string $errorStrategy = self::STRATEGY_SKIP, - protected string $logLevel = LogLevel::CRITICAL + protected string $logLevel = LogLevel::CRITICAL, ) { $this->logErrors = LogLevel::DEBUG !== $logLevel; // @deprecated, remove me in next version } @@ -188,7 +188,7 @@ public function setInErrorBranch(bool $inErrorBranch): void public function isRoot(): bool { - return $this->getPreviousTasksConfigurations() === [] && !$this->isInErrorBranch(); + return [] === $this->getPreviousTasksConfigurations() && !$this->isInErrorBranch(); } /** diff --git a/src/Context/ContextualOptionResolver.php b/src/Context/ContextualOptionResolver.php index a5bad58f..067e3509 100644 --- a/src/Context/ContextualOptionResolver.php +++ b/src/Context/ContextualOptionResolver.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function contextualizeOption(mixed $value, array $context): mixed } if (\is_string($value)) { - $pattern = sprintf('/{{[ ]*(%s){1}[ ]*}}/', implode('|', array_keys($context))); + $pattern = \sprintf('/{{[ ]*(%s){1}[ ]*}}/', implode('|', array_keys($context))); $matches = []; $result = preg_match($pattern, $value, $matches); diff --git a/src/DependencyInjection/CleverAgeProcessExtension.php b/src/DependencyInjection/CleverAgeProcessExtension.php index ebe8ef15..d6b650c5 100644 --- a/src/DependencyInjection/CleverAgeProcessExtension.php +++ b/src/DependencyInjection/CleverAgeProcessExtension.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/DependencyInjection/Compiler/CheckSerializerCompilerPass.php b/src/DependencyInjection/Compiler/CheckSerializerCompilerPass.php index 0cd8e0f4..93006b1e 100644 --- a/src/DependencyInjection/Compiler/CheckSerializerCompilerPass.php +++ b/src/DependencyInjection/Compiler/CheckSerializerCompilerPass.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/DependencyInjection/Compiler/RegistryCompilerPass.php b/src/DependencyInjection/Compiler/RegistryCompilerPass.php index 4ca029ac..9de12c25 100644 --- a/src/DependencyInjection/Compiler/RegistryCompilerPass.php +++ b/src/DependencyInjection/Compiler/RegistryCompilerPass.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class RegistryCompilerPass implements CompilerPassInterface public function __construct( protected ?string $registry = null, protected ?string $tag = null, - protected ?string $method = null + protected ?string $method = null, ) { } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 5921ec28..fee9cb58 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,7 +28,7 @@ class Configuration implements ConfigurationInterface { public function __construct( - protected string $root = 'clever_age_process' + protected string $root = 'clever_age_process', ) { } diff --git a/src/Event/ConsoleProcessEvent.php b/src/Event/ConsoleProcessEvent.php index f09c4303..e404e071 100644 --- a/src/Event/ConsoleProcessEvent.php +++ b/src/Event/ConsoleProcessEvent.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ public function __construct( private readonly InputInterface $consoleInput, private readonly OutputInterface $consoleOutput, private readonly mixed $processInput, - private readonly array $processContext + private readonly array $processContext, ) { } diff --git a/src/Event/EventDispatcherTaskEvent.php b/src/Event/EventDispatcherTaskEvent.php index 0d6b4394..e148e973 100644 --- a/src/Event/EventDispatcherTaskEvent.php +++ b/src/Event/EventDispatcherTaskEvent.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,7 +19,7 @@ class EventDispatcherTaskEvent extends Event { public function __construct( - protected ProcessState $state + protected ProcessState $state, ) { } diff --git a/src/Event/ProcessEvent.php b/src/Event/ProcessEvent.php index f3b79d11..6c7b297f 100644 --- a/src/Event/ProcessEvent.php +++ b/src/Event/ProcessEvent.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ public function __construct( protected mixed $processInput = null, protected array $processContext = [], protected mixed $processOutput = null, - protected ?\Throwable $processError = null + protected ?\Throwable $processError = null, ) { } diff --git a/src/EventListener/DataQueueEventListener.php b/src/EventListener/DataQueueEventListener.php index 6f48ab5c..b405d886 100644 --- a/src/EventListener/DataQueueEventListener.php +++ b/src/EventListener/DataQueueEventListener.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/CircularProcessException.php b/src/Exception/CircularProcessException.php index c4ff2516..81939d49 100644 --- a/src/Exception/CircularProcessException.php +++ b/src/Exception/CircularProcessException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/InvalidProcessConfigurationException.php b/src/Exception/InvalidProcessConfigurationException.php index 80a34779..aecaab1f 100644 --- a/src/Exception/InvalidProcessConfigurationException.php +++ b/src/Exception/InvalidProcessConfigurationException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class InvalidProcessConfigurationException extends \UnexpectedValueException imp public static function createNotInMain( ProcessConfiguration $processConfiguration, TaskConfiguration $taskConfig, - array $mainTaskList + array $mainTaskList, ): self { $taskListStr = '['.implode(', ', $mainTaskList).']'; @@ -35,7 +35,7 @@ public static function createNotInMain( public static function createEntryPointHasAncestors( ProcessConfiguration $processConfiguration, - TaskConfiguration $taskConfig + TaskConfiguration $taskConfig, ): self { return new self( "The entry-point '{$taskConfig->getCode()}' cannot have an ancestor (from process: {$processConfiguration->getCode()})" diff --git a/src/Exception/MissingProcessException.php b/src/Exception/MissingProcessException.php index 3642ee67..045372f9 100644 --- a/src/Exception/MissingProcessException.php +++ b/src/Exception/MissingProcessException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/MissingTaskConfigurationException.php b/src/Exception/MissingTaskConfigurationException.php index 0445891c..ab1b3c77 100644 --- a/src/Exception/MissingTaskConfigurationException.php +++ b/src/Exception/MissingTaskConfigurationException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/MissingTransformerException.php b/src/Exception/MissingTransformerException.php index a0ea2772..565ef481 100644 --- a/src/Exception/MissingTransformerException.php +++ b/src/Exception/MissingTransformerException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/ProcessExceptionInterface.php b/src/Exception/ProcessExceptionInterface.php index f4f39edf..a0b539f8 100644 --- a/src/Exception/ProcessExceptionInterface.php +++ b/src/Exception/ProcessExceptionInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Exception/TransformerException.php b/src/Exception/TransformerException.php index 334606d2..5ce332df 100644 --- a/src/Exception/TransformerException.php +++ b/src/Exception/TransformerException.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ class TransformerException extends \RuntimeException implements ProcessException public function __construct( protected string $transformerCode, int $code = 0, - \Throwable $previous = null + ?\Throwable $previous = null, ) { parent::__construct('', $code, $previous); $this->updateMessage(); @@ -38,13 +38,13 @@ public function setTargetProperty(string $targetProperty): void protected function updateMessage(): void { if (isset($this->targetProperty)) { - $m = sprintf( + $m = \sprintf( "For target property '%s', transformation '%s' have failed", $this->targetProperty, $this->transformerCode ); } else { - $m = sprintf("Transformation '%s' have failed", $this->transformerCode); + $m = \sprintf("Transformation '%s' have failed", $this->transformerCode); } if ($this->getPrevious() instanceof \Throwable) { $m .= ": {$this->getPrevious() diff --git a/src/ExpressionLanguage/PhpFunctionProvider.php b/src/ExpressionLanguage/PhpFunctionProvider.php index 4d157b01..9a2632b7 100644 --- a/src/ExpressionLanguage/PhpFunctionProvider.php +++ b/src/ExpressionLanguage/PhpFunctionProvider.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class PhpFunctionProvider implements ExpressionFunctionProviderInterface { public function __construct( - protected array $functions + protected array $functions, ) { } diff --git a/src/Filesystem/CsvFile.php b/src/Filesystem/CsvFile.php index 529096ae..1dc892ce 100644 --- a/src/Filesystem/CsvFile.php +++ b/src/Filesystem/CsvFile.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -29,13 +29,13 @@ public function __construct( string $delimiter = ',', string $enclosure = '"', string $escape = '\\', - array $headers = null, - string $mode = 'rb' + ?array $headers = null, + string $mode = 'rb', ) { if (!\in_array($filePath, ['php://stdin', 'php://stdout', 'php://stderr'], true)) { $dirname = \dirname($this->filePath); - if (!@mkdir($dirname, 0755, true) && !is_dir($dirname)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $dirname)); + if (!@mkdir($dirname, 0o755, true) && !is_dir($dirname)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dirname)); } } diff --git a/src/Filesystem/CsvResource.php b/src/Filesystem/CsvResource.php index 87937572..97dc8b83 100644 --- a/src/Filesystem/CsvResource.php +++ b/src/Filesystem/CsvResource.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -44,7 +44,7 @@ public function __construct( protected string $delimiter = ',', protected string $enclosure = '"', protected string $escape = '\\', - array $headers = null + ?array $headers = null, ) { if (!\is_resource($resource)) { $type = \gettype($resource); @@ -149,7 +149,7 @@ public function isEndOfFile(): bool /** * Warning, this function will return exactly the same value as the fgetcsv() function. */ - public function readRaw(int $length = null): array|false + public function readRaw(?int $length = null): array|false { $this->assertOpened(); ++$this->lineNumber; @@ -157,7 +157,7 @@ public function readRaw(int $length = null): array|false return fgetcsv($this->handler, $length, $this->delimiter, $this->enclosure, $this->escape); } - public function readLine(int $length = null): ?array + public function readLine(?int $length = null): ?array { $filePosition = $this->seekCalled ? "at position {$this->tell()}" : "on line {$this->getLineNumber()}"; $values = $this->readRaw($length); @@ -286,7 +286,7 @@ protected function assertOpened(): void } } - protected function parseHeaders(array $headers = null): array + protected function parseHeaders(?array $headers = null): array { // If headers are not passed in the constructor but file is readable, try to read headers from file if (null === $headers) { diff --git a/src/Filesystem/FileStreamInterface.php b/src/Filesystem/FileStreamInterface.php index 542799cd..65b5b819 100644 --- a/src/Filesystem/FileStreamInterface.php +++ b/src/Filesystem/FileStreamInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function getLineNumber(): int; public function isEndOfFile(): bool; - public function readLine(int $length = null): ?array; + public function readLine(?int $length = null): ?array; /** * This methods rewinds the file to the first line of data, skipping the headers. diff --git a/src/Filesystem/JsonStreamFile.php b/src/Filesystem/JsonStreamFile.php index 5fa7d4f0..cd4359e0 100644 --- a/src/Filesystem/JsonStreamFile.php +++ b/src/Filesystem/JsonStreamFile.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -65,7 +65,7 @@ public function isEndOfFile(): bool /** * Return an array containing current data and moving the file pointer. */ - public function readLine(int $length = null): ?array + public function readLine(?int $length = null): ?array { if ($this->isEndOfFile()) { return null; diff --git a/src/Filesystem/SeekableFileInterface.php b/src/Filesystem/SeekableFileInterface.php index 2d7ca906..f647ce7f 100644 --- a/src/Filesystem/SeekableFileInterface.php +++ b/src/Filesystem/SeekableFileInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Filesystem/StructuredFileInterface.php b/src/Filesystem/StructuredFileInterface.php index 70ce3026..15e7db2e 100644 --- a/src/Filesystem/StructuredFileInterface.php +++ b/src/Filesystem/StructuredFileInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Filesystem/WritableFileInterface.php b/src/Filesystem/WritableFileInterface.php index 2509c329..a4a61376 100644 --- a/src/Filesystem/WritableFileInterface.php +++ b/src/Filesystem/WritableFileInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Filesystem/WritableStructuredFileInterface.php b/src/Filesystem/WritableStructuredFileInterface.php index e6e283eb..62ce9c82 100644 --- a/src/Filesystem/WritableStructuredFileInterface.php +++ b/src/Filesystem/WritableStructuredFileInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Filesystem/XmlFile.php b/src/Filesystem/XmlFile.php index 194a6248..99f20607 100644 --- a/src/Filesystem/XmlFile.php +++ b/src/Filesystem/XmlFile.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Logger/AbstractLogger.php b/src/Logger/AbstractLogger.php index 1f84fdde..0a0ca91f 100644 --- a/src/Logger/AbstractLogger.php +++ b/src/Logger/AbstractLogger.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ abstract class AbstractLogger extends BaseAbstractLogger { public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Logger/AbstractProcessor.php b/src/Logger/AbstractProcessor.php index 110b0fbe..715167ab 100644 --- a/src/Logger/AbstractProcessor.php +++ b/src/Logger/AbstractProcessor.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,13 +21,13 @@ class AbstractProcessor { public function __construct( - protected ProcessManager $processManager + protected ProcessManager $processManager, ) { } public function __invoke(LogRecord $record): LogRecord { - if ($record->context !== []) { + if ([] !== $record->context) { $context = $this->normalizeRecordData($record->context); $record = new LogRecord( $record->datetime, diff --git a/src/Logger/ProcessLogger.php b/src/Logger/ProcessLogger.php index 7565d9ef..5b17b68c 100644 --- a/src/Logger/ProcessLogger.php +++ b/src/Logger/ProcessLogger.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Logger/ProcessProcessor.php b/src/Logger/ProcessProcessor.php index 35d1f3a4..819ddf1b 100644 --- a/src/Logger/ProcessProcessor.php +++ b/src/Logger/ProcessProcessor.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Logger/TaskLogger.php b/src/Logger/TaskLogger.php index cb00efd3..8bee634e 100644 --- a/src/Logger/TaskLogger.php +++ b/src/Logger/TaskLogger.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Logger/TaskProcessor.php b/src/Logger/TaskProcessor.php index 7a262eb1..ac4a7d3b 100644 --- a/src/Logger/TaskProcessor.php +++ b/src/Logger/TaskProcessor.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Logger/TransformerProcessor.php b/src/Logger/TransformerProcessor.php index cc8cb65e..8a61c301 100644 --- a/src/Logger/TransformerProcessor.php +++ b/src/Logger/TransformerProcessor.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Manager/ProcessManager.php b/src/Manager/ProcessManager.php index e8d71865..e561366f 100644 --- a/src/Manager/ProcessManager.php +++ b/src/Manager/ProcessManager.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -64,7 +64,7 @@ public function __construct( protected TaskLogger $taskLogger, protected ProcessConfigurationRegistry $processConfigurationRegistry, protected ContextualOptionResolver $contextualOptionResolver, - protected EventDispatcherInterface $eventDispatcher + protected EventDispatcherInterface $eventDispatcher, ) { } @@ -225,7 +225,7 @@ protected function initialize(TaskConfiguration $taskConfiguration): void $this->taskConfiguration = $taskConfiguration; if (TaskConfiguration::STRATEGY_STOP === $taskConfiguration->getErrorStrategy() - && $taskConfiguration->getErrorOutputs() !== []) { + && [] !== $taskConfiguration->getErrorOutputs()) { $m = "Task configuration {$taskConfiguration->getCode()} has error outputs "; $m .= "but it's error strategy 'stop' implies they will never be reached."; $this->taskLogger->debug($m); @@ -460,7 +460,7 @@ protected function finalize(TaskConfiguration $taskConfiguration): void protected function initializeStates( ProcessConfiguration $processConfiguration, - array $context = [] + array $context = [], ): ProcessHistory { $processHistory = new ProcessHistory($processConfiguration, $context); @@ -479,7 +479,7 @@ protected function initializeStates( protected function prepareNextProcess( TaskConfiguration $previousTaskConfiguration, TaskConfiguration $nextTaskConfiguration, - bool $isError = false + bool $isError = false, ): void { if ($isError) { $input = $previousTaskConfiguration->getState() diff --git a/src/Model/AbstractConfigurableTask.php b/src/Model/AbstractConfigurableTask.php index 309af297..149eae24 100644 --- a/src/Model/AbstractConfigurableTask.php +++ b/src/Model/AbstractConfigurableTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/BlockingTaskInterface.php b/src/Model/BlockingTaskInterface.php index ad0bb7fb..5236f8ae 100644 --- a/src/Model/BlockingTaskInterface.php +++ b/src/Model/BlockingTaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/FinalizableTaskInterface.php b/src/Model/FinalizableTaskInterface.php index 063ce14c..c71bed9b 100644 --- a/src/Model/FinalizableTaskInterface.php +++ b/src/Model/FinalizableTaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/FlushableTaskInterface.php b/src/Model/FlushableTaskInterface.php index 757fb5ba..8f56f5fa 100644 --- a/src/Model/FlushableTaskInterface.php +++ b/src/Model/FlushableTaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/InitializableTaskInterface.php b/src/Model/InitializableTaskInterface.php index 9cb9a5eb..434f60b2 100644 --- a/src/Model/InitializableTaskInterface.php +++ b/src/Model/InitializableTaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/IterableTaskInterface.php b/src/Model/IterableTaskInterface.php index 7d17856b..08b34111 100644 --- a/src/Model/IterableTaskInterface.php +++ b/src/Model/IterableTaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Model/ProcessHistory.php b/src/Model/ProcessHistory.php index 77f23986..1149c99b 100644 --- a/src/Model/ProcessHistory.php +++ b/src/Model/ProcessHistory.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -38,7 +38,7 @@ class ProcessHistory implements \Stringable public function __construct( ProcessConfiguration $processConfiguration, - protected array $context = [] + protected array $context = [], ) { $this->id = microtime(true); $this->processCode = $processConfiguration->getCode(); diff --git a/src/Model/ProcessState.php b/src/Model/ProcessState.php index 9b314304..b6ec5c9d 100644 --- a/src/Model/ProcessState.php +++ b/src/Model/ProcessState.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -69,7 +69,7 @@ class ProcessState public function __construct( protected ProcessConfiguration $processConfiguration, - protected ProcessHistory $processHistory + protected ProcessHistory $processHistory, ) { } @@ -163,7 +163,7 @@ public function hasErrorOutput(): bool return $this->hasErrorOutput; } - public function stop(\Throwable $e = null): void + public function stop(?\Throwable $e = null): void { if ($e instanceof \Throwable) { $this->setException($e); @@ -186,7 +186,7 @@ public function getException(): ?\Throwable return $this->exception; } - public function setException(\Throwable $exception = null): void + public function setException(?\Throwable $exception = null): void { $this->exception = $exception; } diff --git a/src/Model/SubprocessInstance.php b/src/Model/SubprocessInstance.php index a26ae6d8..35b05d5c 100644 --- a/src/Model/SubprocessInstance.php +++ b/src/Model/SubprocessInstance.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -40,7 +40,7 @@ public function __construct( protected string $processCode, protected ?string $input, protected array $context = [], - array $options = [] + array $options = [], ) { $resolver = new OptionsResolver(); $this->configureOptions($resolver); @@ -81,7 +81,7 @@ public function buildProcess(): static } foreach ($this->context as $key => $value) { - $arguments[] = sprintf('--context=%s:%s', $key, $value); + $arguments[] = \sprintf('--context=%s:%s', $key, $value); } $arguments[] = $this->processCode; diff --git a/src/Model/TaskInterface.php b/src/Model/TaskInterface.php index 748e282d..0e0c0a28 100644 --- a/src/Model/TaskInterface.php +++ b/src/Model/TaskInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Registry/ProcessConfigurationRegistry.php b/src/Registry/ProcessConfigurationRegistry.php index 6c403cda..2c5c9fa4 100644 --- a/src/Registry/ProcessConfigurationRegistry.php +++ b/src/Registry/ProcessConfigurationRegistry.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class ProcessConfigurationRegistry public function __construct( protected array $rawConfiguration, - protected string $defaultErrorStrategy + protected string $defaultErrorStrategy, ) { } diff --git a/src/Registry/TransformerRegistry.php b/src/Registry/TransformerRegistry.php index 3ab519fb..9fd4fbff 100644 --- a/src/Registry/TransformerRegistry.php +++ b/src/Registry/TransformerRegistry.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/AbstractIterableOutputTask.php b/src/Task/AbstractIterableOutputTask.php index e1776e6f..8e8ccb7a 100644 --- a/src/Task/AbstractIterableOutputTask.php +++ b/src/Task/AbstractIterableOutputTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/AggregateIterableTask.php b/src/Task/AggregateIterableTask.php index 4d4b850f..893d2206 100644 --- a/src/Task/AggregateIterableTask.php +++ b/src/Task/AggregateIterableTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/ArrayMergeTask.php b/src/Task/ArrayMergeTask.php index 6e20e7fd..a00e45ae 100644 --- a/src/Task/ArrayMergeTask.php +++ b/src/Task/ArrayMergeTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/ColumnAggregatorTask.php b/src/Task/ColumnAggregatorTask.php index 0e00f7a7..829753b3 100644 --- a/src/Task/ColumnAggregatorTask.php +++ b/src/Task/ColumnAggregatorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,7 +32,7 @@ class ColumnAggregatorTask extends AbstractConfigurableTask implements BlockingT public function __construct( PropertyAccessorInterface $accessor, - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { $this->accessor = $accessor; } @@ -63,7 +63,7 @@ public function execute(ProcessState $state): void } } - if ($missingColumns !== []) { + if ([] !== $missingColumns) { $colStr = implode(', ', $missingColumns); $message = "Missing columns [{$colStr}] in input"; @@ -84,7 +84,7 @@ protected function addValueToAggregationGroup( mixed $column, mixed $input, string $referenceKey, - string $aggregationKey + string $aggregationKey, ): void { if (!isset($this->result[$column])) { $this->result[$column] = [ diff --git a/src/Task/ConstantIterableOutputTask.php b/src/Task/ConstantIterableOutputTask.php index 415e1164..60eeeb56 100644 --- a/src/Task/ConstantIterableOutputTask.php +++ b/src/Task/ConstantIterableOutputTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/ConstantOutputTask.php b/src/Task/ConstantOutputTask.php index 040b882d..7037cafa 100644 --- a/src/Task/ConstantOutputTask.php +++ b/src/Task/ConstantOutputTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/CounterTask.php b/src/Task/CounterTask.php index df16e969..9b2020e5 100644 --- a/src/Task/CounterTask.php +++ b/src/Task/CounterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/Debug/DebugTask.php b/src/Task/Debug/DebugTask.php index 2f3dce09..dfe1d284 100644 --- a/src/Task/Debug/DebugTask.php +++ b/src/Task/Debug/DebugTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/Debug/DieTask.php b/src/Task/Debug/DieTask.php index 1884d133..cc307cd5 100644 --- a/src/Task/Debug/DieTask.php +++ b/src/Task/Debug/DieTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/Debug/ErrorForwarderTask.php b/src/Task/Debug/ErrorForwarderTask.php index 80f235ed..9dbc1da8 100644 --- a/src/Task/Debug/ErrorForwarderTask.php +++ b/src/Task/Debug/ErrorForwarderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/Debug/MemInfoDumpTask.php b/src/Task/Debug/MemInfoDumpTask.php index a793c680..23d4c251 100644 --- a/src/Task/Debug/MemInfoDumpTask.php +++ b/src/Task/Debug/MemInfoDumpTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class MemInfoDumpTask extends AbstractConfigurableTask { public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/Debug/StopwatchTask.php b/src/Task/Debug/StopwatchTask.php index 8bbaf85e..ecf39e46 100644 --- a/src/Task/Debug/StopwatchTask.php +++ b/src/Task/Debug/StopwatchTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class StopwatchTask implements TaskInterface { public function __construct( protected LoggerInterface $logger, - private readonly Stopwatch $stopwatch + private readonly Stopwatch $stopwatch, ) { } diff --git a/src/Task/DummyTask.php b/src/Task/DummyTask.php index 71b9f4fe..7cb1bcae 100644 --- a/src/Task/DummyTask.php +++ b/src/Task/DummyTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/Event/EventDispatcherTask.php b/src/Task/Event/EventDispatcherTask.php index 6771c16d..fcf8bc92 100644 --- a/src/Task/Event/EventDispatcherTask.php +++ b/src/Task/Event/EventDispatcherTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class EventDispatcherTask extends AbstractConfigurableTask { public function __construct( - protected EventDispatcherInterface $eventDispatcher + protected EventDispatcherInterface $eventDispatcher, ) { } diff --git a/src/Task/File/Csv/AbstractCsvResourceTask.php b/src/Task/File/Csv/AbstractCsvResourceTask.php index 1b6ac24f..a0ed37b9 100644 --- a/src/Task/File/Csv/AbstractCsvResourceTask.php +++ b/src/Task/File/Csv/AbstractCsvResourceTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/Csv/AbstractCsvTask.php b/src/Task/File/Csv/AbstractCsvTask.php index ddef722e..dd7d0cf9 100644 --- a/src/Task/File/Csv/AbstractCsvTask.php +++ b/src/Task/File/Csv/AbstractCsvTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/Csv/CsvReaderTask.php b/src/Task/File/Csv/CsvReaderTask.php index 2a0c9e85..afe16bd8 100644 --- a/src/Task/File/Csv/CsvReaderTask.php +++ b/src/Task/File/Csv/CsvReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class CsvReaderTask extends AbstractCsvTask implements IterableTaskInterface { public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/File/Csv/CsvSplitterTask.php b/src/Task/File/Csv/CsvSplitterTask.php index 12e1b7a1..234017a4 100644 --- a/src/Task/File/Csv/CsvSplitterTask.php +++ b/src/Task/File/Csv/CsvSplitterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/Csv/CsvWriterTask.php b/src/Task/File/Csv/CsvWriterTask.php index 813013e5..d1145dec 100644 --- a/src/Task/File/Csv/CsvWriterTask.php +++ b/src/Task/File/Csv/CsvWriterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/Csv/InputCsvReaderTask.php b/src/Task/File/Csv/InputCsvReaderTask.php index b819548a..7afc735c 100644 --- a/src/Task/File/Csv/InputCsvReaderTask.php +++ b/src/Task/File/Csv/InputCsvReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/FileFetchTask.php b/src/Task/File/FileFetchTask.php index 2fc166c1..f7a695ef 100644 --- a/src/Task/File/FileFetchTask.php +++ b/src/Task/File/FileFetchTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -37,7 +37,7 @@ class FileFetchTask extends AbstractConfigurableTask implements IterableTaskInte protected array $matchingFiles = []; public function __construct( - protected ?MountManager $mountManager = null + protected ?MountManager $mountManager = null, ) { } @@ -121,7 +121,7 @@ protected function doFileCopy(ProcessState $state, string $filename, bool $remov } if ($removeSource) { - $this->sourceFS->delete(sprintf('%s://%s', $prefixFrom, $filename)); + $this->sourceFS->delete(\sprintf('%s://%s', $prefixFrom, $filename)); } return $result ? $filename : null; diff --git a/src/Task/File/FileMoverTask.php b/src/Task/File/FileMoverTask.php index 81cf17c2..e9070cd1 100644 --- a/src/Task/File/FileMoverTask.php +++ b/src/Task/File/FileMoverTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/FileReaderTask.php b/src/Task/File/FileReaderTask.php index ea69db22..2261acbe 100644 --- a/src/Task/File/FileReaderTask.php +++ b/src/Task/File/FileReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/FileRemoverTask.php b/src/Task/File/FileRemoverTask.php index 03e68145..dda53166 100644 --- a/src/Task/File/FileRemoverTask.php +++ b/src/Task/File/FileRemoverTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/FileWriterTask.php b/src/Task/File/FileWriterTask.php index d3dc0740..5378099b 100644 --- a/src/Task/File/FileWriterTask.php +++ b/src/Task/File/FileWriterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/FolderBrowserTask.php b/src/Task/File/FolderBrowserTask.php index 6eeb8e5d..6668c3eb 100644 --- a/src/Task/File/FolderBrowserTask.php +++ b/src/Task/File/FolderBrowserTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -35,7 +35,7 @@ class FolderBrowserTask extends AbstractConfigurableTask implements IterableTask protected \Iterator|array|null $files = null; public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/File/InputFolderBrowserTask.php b/src/Task/File/InputFolderBrowserTask.php index 5d1fb90b..2d6bb67b 100644 --- a/src/Task/File/InputFolderBrowserTask.php +++ b/src/Task/File/InputFolderBrowserTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/JsonStream/JsonStreamReaderTask.php b/src/Task/File/JsonStream/JsonStreamReaderTask.php index effff1fe..8db6fc26 100644 --- a/src/Task/File/JsonStream/JsonStreamReaderTask.php +++ b/src/Task/File/JsonStream/JsonStreamReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/Xml/XmlReaderTask.php b/src/Task/File/Xml/XmlReaderTask.php index 69535635..236420a1 100644 --- a/src/Task/File/Xml/XmlReaderTask.php +++ b/src/Task/File/Xml/XmlReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class XmlReaderTask extends AbstractConfigurableTask { public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/File/Xml/XmlWriterTask.php b/src/Task/File/Xml/XmlWriterTask.php index 64548f33..6c88226a 100644 --- a/src/Task/File/Xml/XmlWriterTask.php +++ b/src/Task/File/Xml/XmlWriterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class XmlWriterTask extends AbstractConfigurableTask { public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/File/YamlReaderTask.php b/src/Task/File/YamlReaderTask.php index 67174114..7b587e7e 100644 --- a/src/Task/File/YamlReaderTask.php +++ b/src/Task/File/YamlReaderTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/File/YamlWriterTask.php b/src/Task/File/YamlWriterTask.php index 0fa18844..208ef2fe 100644 --- a/src/Task/File/YamlWriterTask.php +++ b/src/Task/File/YamlWriterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/FilterTask.php b/src/Task/FilterTask.php index 38715c3c..8ea0abae 100644 --- a/src/Task/FilterTask.php +++ b/src/Task/FilterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/GroupByAggregateIterableTask.php b/src/Task/GroupByAggregateIterableTask.php index d521e329..b92e2f18 100644 --- a/src/Task/GroupByAggregateIterableTask.php +++ b/src/Task/GroupByAggregateIterableTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,7 +33,7 @@ class GroupByAggregateIterableTask extends AbstractConfigurableTask implements B protected array $result = []; public function __construct( - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Task/InputAggregatorTask.php b/src/Task/InputAggregatorTask.php index 0aeea05f..c5b68fa3 100644 --- a/src/Task/InputAggregatorTask.php +++ b/src/Task/InputAggregatorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/InputIteratorTask.php b/src/Task/InputIteratorTask.php index 301c24b3..a079626d 100644 --- a/src/Task/InputIteratorTask.php +++ b/src/Task/InputIteratorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/IterableBatchTask.php b/src/Task/IterableBatchTask.php index 4e9a5ed0..9b751fba 100644 --- a/src/Task/IterableBatchTask.php +++ b/src/Task/IterableBatchTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class IterableBatchTask extends AbstractConfigurableTask implements FlushableTas protected bool $flushMode = false; public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/ObjectUpdaterTask.php b/src/Task/ObjectUpdaterTask.php index 8136b7bd..30a53641 100644 --- a/src/Task/ObjectUpdaterTask.php +++ b/src/Task/ObjectUpdaterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class ObjectUpdaterTask extends AbstractConfigurableTask { public function __construct( - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Task/Process/CommandRunnerTask.php b/src/Task/Process/CommandRunnerTask.php index 999e5573..a988ff3e 100644 --- a/src/Task/Process/CommandRunnerTask.php +++ b/src/Task/Process/CommandRunnerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class CommandRunnerTask extends AbstractConfigurableTask { public function __construct( - protected KernelInterface $kernel + protected KernelInterface $kernel, ) { } diff --git a/src/Task/Process/ProcessExecutorTask.php b/src/Task/Process/ProcessExecutorTask.php index e9a515c2..12d3789b 100644 --- a/src/Task/Process/ProcessExecutorTask.php +++ b/src/Task/Process/ProcessExecutorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,7 +32,7 @@ class ProcessExecutorTask extends AbstractConfigurableTask public function __construct( protected ProcessManager $processManager, protected ProcessConfigurationRegistry $processRegistry, - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/Process/ProcessLauncherTask.php b/src/Task/Process/ProcessLauncherTask.php index a3c3f5cc..8b3c4aad 100644 --- a/src/Task/Process/ProcessLauncherTask.php +++ b/src/Task/Process/ProcessLauncherTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -42,7 +42,7 @@ class ProcessLauncherTask extends AbstractConfigurableTask implements FlushableT public function __construct( protected LoggerInterface $logger, protected ProcessConfigurationRegistry $processRegistry, - protected KernelInterface $kernel + protected KernelInterface $kernel, ) { $this->finishedBuffers = new \SplQueue(); } @@ -78,7 +78,7 @@ public function flush(ProcessState $state): void } // After dequeue, stop flush - if ($this->finishedBuffers->isEmpty() && $this->launchedProcesses === []) { + if ($this->finishedBuffers->isEmpty() && [] === $this->launchedProcesses) { $this->flushMode = false; } } @@ -96,7 +96,7 @@ public function next(ProcessState $state): bool // if we are in flush mode, we should wait for process to finish if ($this->flushMode) { - return $this->launchedProcesses !== []; + return [] !== $this->launchedProcesses; } usleep($this->getOption($state, 'sleep_on_finalize_interval')); diff --git a/src/Task/PropertyGetterTask.php b/src/Task/PropertyGetterTask.php index a898f4ea..10d97f85 100644 --- a/src/Task/PropertyGetterTask.php +++ b/src/Task/PropertyGetterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class PropertyGetterTask extends AbstractConfigurableTask { public function __construct( protected LoggerInterface $logger, - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Task/PropertySetterTask.php b/src/Task/PropertySetterTask.php index 56be23f8..2117b4c9 100644 --- a/src/Task/PropertySetterTask.php +++ b/src/Task/PropertySetterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -26,7 +26,7 @@ class PropertySetterTask extends AbstractConfigurableTask { public function __construct( protected LoggerInterface $logger, - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Task/Reporting/AdvancedStatCounterTask.php b/src/Task/Reporting/AdvancedStatCounterTask.php index 3f2eb47c..e7d85b16 100644 --- a/src/Task/Reporting/AdvancedStatCounterTask.php +++ b/src/Task/Reporting/AdvancedStatCounterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,7 +32,7 @@ class AdvancedStatCounterTask extends AbstractConfigurableTask protected int $preInitCounter = 0; public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/Reporting/LoggerTask.php b/src/Task/Reporting/LoggerTask.php index dc73bbd9..f990a2c6 100644 --- a/src/Task/Reporting/LoggerTask.php +++ b/src/Task/Reporting/LoggerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,7 +28,7 @@ class LoggerTask extends AbstractConfigurableTask { public function __construct( protected LoggerInterface $logger, - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Task/Reporting/StatCounterTask.php b/src/Task/Reporting/StatCounterTask.php index 21bc005d..c12285c1 100644 --- a/src/Task/Reporting/StatCounterTask.php +++ b/src/Task/Reporting/StatCounterTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -25,7 +25,7 @@ class StatCounterTask implements FinalizableTaskInterface protected int $counter = 0; public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/RowAggregatorTask.php b/src/Task/RowAggregatorTask.php index 163b1bfc..c43317d3 100644 --- a/src/Task/RowAggregatorTask.php +++ b/src/Task/RowAggregatorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -31,7 +31,7 @@ class RowAggregatorTask extends AbstractConfigurableTask implements BlockingTask protected array $result = []; public function __construct( - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { } diff --git a/src/Task/Serialization/DenormalizerTask.php b/src/Task/Serialization/DenormalizerTask.php index 975b573a..6edecc00 100644 --- a/src/Task/Serialization/DenormalizerTask.php +++ b/src/Task/Serialization/DenormalizerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class DenormalizerTask extends AbstractConfigurableTask { public function __construct( - protected DenormalizerInterface $denormalizer + protected DenormalizerInterface $denormalizer, ) { } diff --git a/src/Task/Serialization/DeserializerTask.php b/src/Task/Serialization/DeserializerTask.php index 1287eeff..654a535d 100644 --- a/src/Task/Serialization/DeserializerTask.php +++ b/src/Task/Serialization/DeserializerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class DeserializerTask extends AbstractConfigurableTask { public function __construct( - protected SerializerInterface $serializer + protected SerializerInterface $serializer, ) { } diff --git a/src/Task/Serialization/NormalizerTask.php b/src/Task/Serialization/NormalizerTask.php index 2e7d43d3..8c43ed1b 100644 --- a/src/Task/Serialization/NormalizerTask.php +++ b/src/Task/Serialization/NormalizerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class NormalizerTask extends AbstractConfigurableTask { public function __construct( - protected NormalizerInterface $normalizer + protected NormalizerInterface $normalizer, ) { } diff --git a/src/Task/Serialization/SerializerTask.php b/src/Task/Serialization/SerializerTask.php index 054208cb..644447b0 100644 --- a/src/Task/Serialization/SerializerTask.php +++ b/src/Task/Serialization/SerializerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ class SerializerTask extends AbstractConfigurableTask { public function __construct( - protected SerializerInterface $serializer + protected SerializerInterface $serializer, ) { } diff --git a/src/Task/SimpleBatchTask.php b/src/Task/SimpleBatchTask.php index 9db576ba..b022dd70 100644 --- a/src/Task/SimpleBatchTask.php +++ b/src/Task/SimpleBatchTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/SkipEmptyTask.php b/src/Task/SkipEmptyTask.php index b649864a..1663e28f 100644 --- a/src/Task/SkipEmptyTask.php +++ b/src/Task/SkipEmptyTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/SplitJoinLineTask.php b/src/Task/SplitJoinLineTask.php index 6079d851..6d695c5b 100644 --- a/src/Task/SplitJoinLineTask.php +++ b/src/Task/SplitJoinLineTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/StopTask.php b/src/Task/StopTask.php index c7ab909a..c8945cd8 100644 --- a/src/Task/StopTask.php +++ b/src/Task/StopTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Task/TransformerTask.php b/src/Task/TransformerTask.php index 64502a71..f04d8832 100644 --- a/src/Task/TransformerTask.php +++ b/src/Task/TransformerTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,7 +33,7 @@ class TransformerTask extends AbstractConfigurableTask public function __construct( protected LoggerInterface $logger, - TransformerRegistry $transformerRegistry + TransformerRegistry $transformerRegistry, ) { $this->transformerRegistry = $transformerRegistry; } diff --git a/src/Task/Validation/ValidatorTask.php b/src/Task/Validation/ValidatorTask.php index efd82b10..ae7510b6 100644 --- a/src/Task/Validation/ValidatorTask.php +++ b/src/Task/Validation/ValidatorTask.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -30,7 +30,7 @@ class ValidatorTask extends AbstractConfigurableTask { public function __construct( protected LoggerInterface $logger, - protected ValidatorInterface $validator + protected ValidatorInterface $validator, ) { } diff --git a/src/Transformer/ArrayElementTransformer.php b/src/Transformer/ArrayElementTransformer.php index 86cff75e..beb4cdf5 100644 --- a/src/Transformer/ArrayElementTransformer.php +++ b/src/Transformer/ArrayElementTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ArrayFilterTransformer.php b/src/Transformer/ArrayFilterTransformer.php index 2a942149..0464e98f 100644 --- a/src/Transformer/ArrayFilterTransformer.php +++ b/src/Transformer/ArrayFilterTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ArrayFirstTransformer.php b/src/Transformer/ArrayFirstTransformer.php index 9d1f3739..238c09c7 100644 --- a/src/Transformer/ArrayFirstTransformer.php +++ b/src/Transformer/ArrayFirstTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ArrayLastTransformer.php b/src/Transformer/ArrayLastTransformer.php index e227143e..3d8d8a2b 100644 --- a/src/Transformer/ArrayLastTransformer.php +++ b/src/Transformer/ArrayLastTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ArrayMapTransformer.php b/src/Transformer/ArrayMapTransformer.php index 4e3f7fb3..767848f3 100644 --- a/src/Transformer/ArrayMapTransformer.php +++ b/src/Transformer/ArrayMapTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ArrayUnsetTransformer.php b/src/Transformer/ArrayUnsetTransformer.php index e4527269..fd79556d 100644 --- a/src/Transformer/ArrayUnsetTransformer.php +++ b/src/Transformer/ArrayUnsetTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/CachedTransformer.php b/src/Transformer/CachedTransformer.php index 522fda98..53439e21 100644 --- a/src/Transformer/CachedTransformer.php +++ b/src/Transformer/CachedTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -30,7 +30,7 @@ class CachedTransformer implements ConfigurableTransformerInterface public function __construct( TransformerRegistry $transformerRegistry, protected CacheItemPoolInterface $cache, - protected LoggerInterface $logger + protected LoggerInterface $logger, ) { $this->transformerRegistry = $transformerRegistry; } diff --git a/src/Transformer/CallbackTransformer.php b/src/Transformer/CallbackTransformer.php index 94e695f8..88e1f275 100644 --- a/src/Transformer/CallbackTransformer.php +++ b/src/Transformer/CallbackTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/CastTransformer.php b/src/Transformer/CastTransformer.php index 8b099a5a..559af464 100644 --- a/src/Transformer/CastTransformer.php +++ b/src/Transformer/CastTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ConditionTrait.php b/src/Transformer/ConditionTrait.php index a65bda4d..d5e2dec0 100644 --- a/src/Transformer/ConditionTrait.php +++ b/src/Transformer/ConditionTrait.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -111,7 +111,7 @@ protected function checkValue( string $key, mixed $value, bool $shouldMatch = true, - bool $regexpMode = false + bool $regexpMode = false, ): bool { $currentValue = $this->getValue($input, $key); diff --git a/src/Transformer/ConfigurableTransformerInterface.php b/src/Transformer/ConfigurableTransformerInterface.php index f5112455..af44c693 100644 --- a/src/Transformer/ConfigurableTransformerInterface.php +++ b/src/Transformer/ConfigurableTransformerInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ConstantTransformer.php b/src/Transformer/ConstantTransformer.php index 9a234fcf..ec0ae7ca 100644 --- a/src/Transformer/ConstantTransformer.php +++ b/src/Transformer/ConstantTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ConvertValueTransformer.php b/src/Transformer/ConvertValueTransformer.php index fc974174..e9a7775b 100644 --- a/src/Transformer/ConvertValueTransformer.php +++ b/src/Transformer/ConvertValueTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/DateFormatTransformer.php b/src/Transformer/DateFormatTransformer.php index 464ae658..b3462e05 100644 --- a/src/Transformer/DateFormatTransformer.php +++ b/src/Transformer/DateFormatTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/DateParserTransformer.php b/src/Transformer/DateParserTransformer.php index 9553e1f6..3ebbe009 100644 --- a/src/Transformer/DateParserTransformer.php +++ b/src/Transformer/DateParserTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/DebugTransformer.php b/src/Transformer/DebugTransformer.php index 9d6bcfc2..16f11174 100644 --- a/src/Transformer/DebugTransformer.php +++ b/src/Transformer/DebugTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/DefaultTransformer.php b/src/Transformer/DefaultTransformer.php index 1ce9b633..96a847be 100644 --- a/src/Transformer/DefaultTransformer.php +++ b/src/Transformer/DefaultTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/DenormalizeTransformer.php b/src/Transformer/DenormalizeTransformer.php index 529f7dfb..aabf2a84 100644 --- a/src/Transformer/DenormalizeTransformer.php +++ b/src/Transformer/DenormalizeTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class DenormalizeTransformer implements ConfigurableTransformerInterface { public function __construct( - protected DenormalizerInterface $denormalizer + protected DenormalizerInterface $denormalizer, ) { } diff --git a/src/Transformer/EvaluatorTransformer.php b/src/Transformer/EvaluatorTransformer.php index 9a33db73..33ceba2b 100644 --- a/src/Transformer/EvaluatorTransformer.php +++ b/src/Transformer/EvaluatorTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ExplodeTransformer.php b/src/Transformer/ExplodeTransformer.php index 65b79427..71c838f5 100644 --- a/src/Transformer/ExplodeTransformer.php +++ b/src/Transformer/ExplodeTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ExpressionLanguageMapTransformer.php b/src/Transformer/ExpressionLanguageMapTransformer.php index 9bfb65b0..0356e9a3 100644 --- a/src/Transformer/ExpressionLanguageMapTransformer.php +++ b/src/Transformer/ExpressionLanguageMapTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class ExpressionLanguageMapTransformer implements ConfigurableTransformerInterface { public function __construct( - protected ExpressionLanguage $language + protected ExpressionLanguage $language, ) { } diff --git a/src/Transformer/GenericTransformer.php b/src/Transformer/GenericTransformer.php index e033e281..f1863aa4 100644 --- a/src/Transformer/GenericTransformer.php +++ b/src/Transformer/GenericTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,7 +33,7 @@ class GenericTransformer implements ConfigurableTransformerInterface public function __construct( protected ContextualOptionResolver $contextualOptionResolver, - TransformerRegistry $transformerRegistry + TransformerRegistry $transformerRegistry, ) { $this->transformerRegistry = $transformerRegistry; } diff --git a/src/Transformer/HashTransformer.php b/src/Transformer/HashTransformer.php index c1fc610f..9c3bf4bc 100644 --- a/src/Transformer/HashTransformer.php +++ b/src/Transformer/HashTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/ImplodeTransformer.php b/src/Transformer/ImplodeTransformer.php index fb08288e..be117356 100644 --- a/src/Transformer/ImplodeTransformer.php +++ b/src/Transformer/ImplodeTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/InstantiateTransformer.php b/src/Transformer/InstantiateTransformer.php index 8da6c2f8..223be69b 100644 --- a/src/Transformer/InstantiateTransformer.php +++ b/src/Transformer/InstantiateTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/MappingTransformer.php b/src/Transformer/MappingTransformer.php index 3ed3bc4e..ff8b0001 100644 --- a/src/Transformer/MappingTransformer.php +++ b/src/Transformer/MappingTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -32,7 +32,7 @@ class MappingTransformer implements ConfigurableTransformerInterface public function __construct( TransformerRegistry $transformerRegistry, protected LoggerInterface $logger, - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { $this->transformerRegistry = $transformerRegistry; } diff --git a/src/Transformer/MultiReplaceTransformer.php b/src/Transformer/MultiReplaceTransformer.php index 90d87424..5ff4b927 100644 --- a/src/Transformer/MultiReplaceTransformer.php +++ b/src/Transformer/MultiReplaceTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/NormalizeTransformer.php b/src/Transformer/NormalizeTransformer.php index 5cd57635..904f7476 100644 --- a/src/Transformer/NormalizeTransformer.php +++ b/src/Transformer/NormalizeTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class NormalizeTransformer implements ConfigurableTransformerInterface { public function __construct( - protected NormalizerInterface $normalizer + protected NormalizerInterface $normalizer, ) { } diff --git a/src/Transformer/PregFilterTransformer.php b/src/Transformer/PregFilterTransformer.php index 5a6d4f11..361dd119 100644 --- a/src/Transformer/PregFilterTransformer.php +++ b/src/Transformer/PregFilterTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/PropertyAccessorTransformer.php b/src/Transformer/PropertyAccessorTransformer.php index 4e37c2fc..ebb7f6ab 100644 --- a/src/Transformer/PropertyAccessorTransformer.php +++ b/src/Transformer/PropertyAccessorTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,7 +22,7 @@ class PropertyAccessorTransformer implements ConfigurableTransformerInterface { public function __construct( - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Transformer/RecursivePropertySetterTransformer.php b/src/Transformer/RecursivePropertySetterTransformer.php index 9d06e256..6f7767e9 100644 --- a/src/Transformer/RecursivePropertySetterTransformer.php +++ b/src/Transformer/RecursivePropertySetterTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -24,7 +24,7 @@ class RecursivePropertySetterTransformer implements ConfigurableTransformerInterface { public function __construct( - protected PropertyAccessorInterface $accessor + protected PropertyAccessorInterface $accessor, ) { } diff --git a/src/Transformer/RulesTransformer.php b/src/Transformer/RulesTransformer.php index 4e19338c..22115368 100644 --- a/src/Transformer/RulesTransformer.php +++ b/src/Transformer/RulesTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -28,7 +28,7 @@ class RulesTransformer implements ConfigurableTransformerInterface public function __construct( TransformerRegistry $transformerRegistry, - protected ExpressionLanguage $language + protected ExpressionLanguage $language, ) { $this->transformerRegistry = $transformerRegistry; } @@ -93,7 +93,7 @@ public function configureOptions(OptionsResolver $resolver): void /** * Configure options for one "rule" block. */ - public function configureRuleOptions(OptionsResolver $resolver, array $expressionVariables = null): void + public function configureRuleOptions(OptionsResolver $resolver, ?array $expressionVariables = null): void { $resolver->setDefaults([ 'condition' => null, diff --git a/src/Transformer/SlugifyTransformer.php b/src/Transformer/SlugifyTransformer.php index b5dd77cf..970d7adf 100644 --- a/src/Transformer/SlugifyTransformer.php +++ b/src/Transformer/SlugifyTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/SprintfTransformer.php b/src/Transformer/SprintfTransformer.php index e496d193..f075b518 100644 --- a/src/Transformer/SprintfTransformer.php +++ b/src/Transformer/SprintfTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/TransformerInterface.php b/src/Transformer/TransformerInterface.php index 34cd402b..7cf44d54 100644 --- a/src/Transformer/TransformerInterface.php +++ b/src/Transformer/TransformerInterface.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/TransformerTrait.php b/src/Transformer/TransformerTrait.php index 4079603f..4bea4f87 100644 --- a/src/Transformer/TransformerTrait.php +++ b/src/Transformer/TransformerTrait.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -52,7 +52,7 @@ public function normalizeTransformers(Options $options, array $transformers): ar protected function applyTransformers(array $transformers, mixed $value): mixed { // Quick return for better perfs - if ($transformers === []) { + if ([] === $transformers) { return $value; } @@ -92,7 +92,7 @@ protected function getCleanedTransfomerCode(string $transformerCode): string protected function configureTransformersOptions( OptionsResolver $resolver, - string $optionName = 'transformers' + string $optionName = 'transformers', ): void { $resolver->setDefault($optionName, []); $resolver->setAllowedTypes($optionName, ['array']); diff --git a/src/Transformer/TrimTransformer.php b/src/Transformer/TrimTransformer.php index f9966f7d..121b16d0 100644 --- a/src/Transformer/TrimTransformer.php +++ b/src/Transformer/TrimTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/TypeSetterTransformer.php b/src/Transformer/TypeSetterTransformer.php index 202384d0..64804d8a 100644 --- a/src/Transformer/TypeSetterTransformer.php +++ b/src/Transformer/TypeSetterTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/UnsetTransformer.php b/src/Transformer/UnsetTransformer.php index 05d98d60..112f4ad0 100644 --- a/src/Transformer/UnsetTransformer.php +++ b/src/Transformer/UnsetTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/WrapperTransformer.php b/src/Transformer/WrapperTransformer.php index 6f55e294..297e7253 100644 --- a/src/Transformer/WrapperTransformer.php +++ b/src/Transformer/WrapperTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Transformer/Xml/XpathEvaluatorTransformer.php b/src/Transformer/Xml/XpathEvaluatorTransformer.php index 9b5964e8..74b378a4 100644 --- a/src/Transformer/Xml/XpathEvaluatorTransformer.php +++ b/src/Transformer/Xml/XpathEvaluatorTransformer.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -65,7 +65,7 @@ public function configureOptions(OptionsResolver $resolver): void * Configure options about how to handle xpath query results. * Available at root and subquery level. */ - public function configureQueryOptions(OptionsResolver $resolver, Options $parentOptions = null): void + public function configureQueryOptions(OptionsResolver $resolver, ?Options $parentOptions = null): void { $resolver->setDefault('single_result', $parentOptions instanceof Options ? $parentOptions['single_result'] : true); $resolver->setAllowedTypes('single_result', 'bool'); diff --git a/src/Validator/ConstraintLoader.php b/src/Validator/ConstraintLoader.php index d767dc15..e2adab9b 100644 --- a/src/Validator/ConstraintLoader.php +++ b/src/Validator/ConstraintLoader.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Exception/MissingTransformerExceptionTest.php b/tests/Exception/MissingTransformerExceptionTest.php index fad77c86..6b30730b 100644 --- a/tests/Exception/MissingTransformerExceptionTest.php +++ b/tests/Exception/MissingTransformerExceptionTest.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/* + * This file is part of the CleverAge/ProcessBundle package. + * + * Copyright (c) Clever-Age + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Exception; use CleverAge\ProcessBundle\Exception\MissingTransformerException; diff --git a/tests/Transformer/ArrayElementTransformerTest.php b/tests/Transformer/ArrayElementTransformerTest.php index 6895a9c8..a3c9e36e 100644 --- a/tests/Transformer/ArrayElementTransformerTest.php +++ b/tests/Transformer/ArrayElementTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/ArrayFirstTransformerTest.php b/tests/Transformer/ArrayFirstTransformerTest.php index 07b87049..596c2bf0 100644 --- a/tests/Transformer/ArrayFirstTransformerTest.php +++ b/tests/Transformer/ArrayFirstTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/CastTransformerTest.php b/tests/Transformer/CastTransformerTest.php index 5a667646..9eac2bba 100644 --- a/tests/Transformer/CastTransformerTest.php +++ b/tests/Transformer/CastTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/ConstantTransformerTest.php b/tests/Transformer/ConstantTransformerTest.php index 9d291e37..e03734b3 100644 --- a/tests/Transformer/ConstantTransformerTest.php +++ b/tests/Transformer/ConstantTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/DateFormatTransformerTest.php b/tests/Transformer/DateFormatTransformerTest.php index 6baf4821..8a0408e1 100644 --- a/tests/Transformer/DateFormatTransformerTest.php +++ b/tests/Transformer/DateFormatTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/DateParserTransformerTest.php b/tests/Transformer/DateParserTransformerTest.php index 7ac7a7d6..15e142b6 100644 --- a/tests/Transformer/DateParserTransformerTest.php +++ b/tests/Transformer/DateParserTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/DebugTransformerTest.php b/tests/Transformer/DebugTransformerTest.php index 5af9744e..0be796f9 100644 --- a/tests/Transformer/DebugTransformerTest.php +++ b/tests/Transformer/DebugTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/DefaultTransformerTest.php b/tests/Transformer/DefaultTransformerTest.php index 64a71cfe..39eb1209 100644 --- a/tests/Transformer/DefaultTransformerTest.php +++ b/tests/Transformer/DefaultTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/ExplodeTransformerTest.php b/tests/Transformer/ExplodeTransformerTest.php index b454c27a..f0518338 100644 --- a/tests/Transformer/ExplodeTransformerTest.php +++ b/tests/Transformer/ExplodeTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/ImplodeTransformerTest.php b/tests/Transformer/ImplodeTransformerTest.php index 0a3751d4..6037dd79 100644 --- a/tests/Transformer/ImplodeTransformerTest.php +++ b/tests/Transformer/ImplodeTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/MultiReplaceTransformerTest.php b/tests/Transformer/MultiReplaceTransformerTest.php index 8a3c58c6..c21a9833 100644 --- a/tests/Transformer/MultiReplaceTransformerTest.php +++ b/tests/Transformer/MultiReplaceTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/SprintfTransformerTest.php b/tests/Transformer/SprintfTransformerTest.php index 59397a0f..4b4f7996 100644 --- a/tests/Transformer/SprintfTransformerTest.php +++ b/tests/Transformer/SprintfTransformerTest.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/* + * This file is part of the CleverAge/ProcessBundle package. + * + * Copyright (c) Clever-Age + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Transformer; use CleverAge\ProcessBundle\Transformer\SprintfTransformer; diff --git a/tests/Transformer/TrimTransformerTest.php b/tests/Transformer/TrimTransformerTest.php index 62aca460..7ee5609f 100644 --- a/tests/Transformer/TrimTransformerTest.php +++ b/tests/Transformer/TrimTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/WrapperTransformerTest.php b/tests/Transformer/WrapperTransformerTest.php index 4699f7a3..c89ee2d3 100644 --- a/tests/Transformer/WrapperTransformerTest.php +++ b/tests/Transformer/WrapperTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Transformer/XpathEvaluatorTransformerTest.php b/tests/Transformer/XpathEvaluatorTransformerTest.php index 50fda077..5f4dfd2c 100644 --- a/tests/Transformer/XpathEvaluatorTransformerTest.php +++ b/tests/Transformer/XpathEvaluatorTransformerTest.php @@ -5,7 +5,7 @@ /* * This file is part of the CleverAge/ProcessBundle package. * - * Copyright (c) 2017-2024 Clever-Age + * Copyright (c) Clever-Age * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. From 76b5894158a1e44b000e20c697cf897d0135d8ec Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 16 Oct 2024 15:35:09 +0200 Subject: [PATCH 08/41] #129 Remove wrong replace configuration on composer.json. Add missing suggest. --- composer.json | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index a1d4119c..5f337773 100644 --- a/composer.json +++ b/composer.json @@ -47,15 +47,6 @@ "CleverAge\\ProcessBundle\\Tests\\": "tests/" } }, - "replace": { - "symfony/polyfill-ctype": "*", - "symfony/polyfill-iconv": "*", - "symfony/polyfill-php72": "*", - "symfony/polyfill-php73": "*", - "symfony/polyfill-php74": "*", - "symfony/polyfill-php80": "*", - "symfony/polyfill-php81": "*" - }, "require": { "php": ">=8.1", "ext-json": "*", @@ -94,10 +85,14 @@ }, "suggest": { "cleverage/doctrine-process-bundle": "Dedicated bundle for Doctrine dependencies for the process bundle", - "cleverage/flysystem-process-bundle": "Dedicated bundle for Flysystem dependencies for the process bundle", - "cleverage/rest-process-bundle": "Dedicated bundle for Rest dependencies for the process bundle", + "cleverage/eav-process-bundle": "Dedicated bundle for EAV dependencies for the process bundle", "cleverage/soap-process-bundle": "Dedicated bundle for Soap dependencies for the process bundle", - "cleverage/enqueue-process-bundle": "Manage asynchronous events within the process bundle" + "cleverage/process-soap-bundle": "Another dedicated bundle for Soap dependencies for the process bundle", + "cleverage/rest-process-bundle": "Dedicated bundle for Rest dependencies for the process bundle", + "cleverage/enqueue-process-bundle": "Manage asynchronous events within the process bundle", + "cleverage/flysystem-process-bundle": "Dedicated bundle for Flysystem dependencies for the process bundle", + "cleverage/cache-process-bundle": "Dedicated bundle for cache handling for the process bundle", + "cleverage/processuibundle": "A simple UX for cleverage/processbundle using EasyAdmin\n\n" }, "config": { "allow-plugins": { From 8d0da4ae5eac8d6105ce903639f91ad68a04f19f Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 15:45:44 +0200 Subject: [PATCH 09/41] #138 Update CHANGELOG with v3.2.9+ versions --- CHANGELOG.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4129a633..f2d96fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,53 @@ +v4.0 +------ + +### Changes + +* Update Makefile & .docker for local standalone usage +* Update rector, phpstan & php-cs-fixer configurations & apply it. + +### Fixes + +* [#129](https://github.com/cleverage/process-bundle/issues/129) Remove wrong replace configuration on composer.json. Add missing suggest. +* Miscellaneous fixes, show full diff : https://github.com/cleverage/process-bundle/compare/v4.0.0-rc2...v4.0.0 + +v4.0-RC2 +------ + +## BC breaks + +* Bump php version to >=8.2 +* Bump symfony version to ^6.4|^7.1 + +### Fixes + +* Miscellaneous fixes, show full diff : https://github.com/cleverage/process-bundle/compare/v4.0.0-rc1...v4.0.0-rc2 + +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 + +* Miscellaneous fixes, show full diff : https://github.com/cleverage/process-bundle/compare/v3.2.9...v4.0.0-rc1 + +v3.2.9 +------ + +### Fixes + +https://github.com/cleverage/process-bundle/compare/v3.2.8...v3.2.9 + v3.2.8 ------ From 7248fae0150fd69f3dcbe6a07b257ded28f4d66b Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 15:52:14 +0200 Subject: [PATCH 10/41] #139 Re-apply php-cs-fixer due to previous merge from v3.2-dev branch --- src/Configuration/ProcessConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Configuration/ProcessConfiguration.php b/src/Configuration/ProcessConfiguration.php index 421680f7..37b06baf 100644 --- a/src/Configuration/ProcessConfiguration.php +++ b/src/Configuration/ProcessConfiguration.php @@ -244,7 +244,7 @@ protected function sortDependencies(array $dependencies): array } $midOffset = round(\count($dependencies) / 2); - $midTaskCode = $dependencies[(int)$midOffset]; + $midTaskCode = $dependencies[(int) $midOffset]; $midTask = $this->getTaskConfiguration($midTaskCode); $previousTasks = []; From 2a91d78d0cdf08cc1ccb6513d1724afbbc0d32d3 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 15:55:17 +0200 Subject: [PATCH 11/41] #140 Fix test github workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78aa3aa8..2d7e7a41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,7 +67,7 @@ jobs: with: dependency-versions: ${{ matrix.dependencies }} - name: Run Tests with coverage - run: make coverage + run: vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml #- name: Send coverage to Codecov # uses: codecov/codecov-action@v4 # with: From f19ca0c04ee0c68902fc9ee2df7ee5e2dbfd5413 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 16:04:07 +0200 Subject: [PATCH 12/41] #140 Fix notifications github workflow --- .github/workflows/notifications.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/notifications.yml b/.github/workflows/notifications.yml index dd59e3a5..dc3d0581 100644 --- a/.github/workflows/notifications.yml +++ b/.github/workflows/notifications.yml @@ -13,10 +13,10 @@ jobs: steps: - name: Get the tag short reference id: get_tag - run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} + run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Rocket.Chat Notification - uses: madalozzo/Rocket.Chat.GitHub.Action.Notification@v2 + uses: madalozzo/Rocket.Chat.GitHub.Action.Notification@master with: type: success job_name: "[cleverage/process-bundle](https://github.com/cleverage/process-bundle) : ${{ steps.get_tag.outputs.TAG }} has been released" From 28bfd60db499fae50dda4368e41cdbaf7d86fd93 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 17 Oct 2024 17:07:27 +0200 Subject: [PATCH 13/41] #141 Remove FileFetchTask, use cleverage/flysystem-process-bundle instead. league/flysystem-bundle is not required anymore. --- CHANGELOG.md | 11 ++- composer.json | 1 - src/Task/File/FileFetchTask.php | 142 -------------------------------- 3 files changed, 8 insertions(+), 146 deletions(-) delete mode 100644 src/Task/File/FileFetchTask.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f2d96fc9..d34a73c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,19 @@ v4.0 ------ +## BC breaks + +* Remove FileFetchTask, use cleverage/flysystem-process-bundle instead. + ### Changes * Update Makefile & .docker for local standalone usage -* Update rector, phpstan & php-cs-fixer configurations & apply it. +* Update rector, phpstan & php-cs-fixer configurations & apply it +* league/flysystem-bundle is not required anymore ### Fixes -* [#129](https://github.com/cleverage/process-bundle/issues/129) Remove wrong replace configuration on composer.json. Add missing suggest. +* [#129](https://github.com/cleverage/process-bundle/issues/129) Remove wrong replace configuration on composer.json. Add missing suggest * Miscellaneous fixes, show full diff : https://github.com/cleverage/process-bundle/compare/v4.0.0-rc2...v4.0.0 v4.0-RC2 @@ -35,7 +40,7 @@ v4.0-RC1 * Add some phpunit tests * Apply Rector & Phpstan * Add StopwatchTask -* Change directory structure. Move Symfony code to /src, documentation to /doc, and tests to /tests. +* Change directory structure. Move Symfony code to /src, documentation to /doc, and tests to /tests ### Fixes diff --git a/composer.json b/composer.json index 5f337773..3a00935f 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,6 @@ "ext-intl": "*", "ext-mbstring": "*", "psr/cache": "^1|^2|^3", - "league/flysystem-bundle": "^3.1", "symfony/config": "^6.4|^7.1", "symfony/console": "^6.4|^7.1", "symfony/dependency-injection": "^6.4|^7.1", diff --git a/src/Task/File/FileFetchTask.php b/src/Task/File/FileFetchTask.php deleted file mode 100644 index f7a695ef..00000000 --- a/src/Task/File/FileFetchTask.php +++ /dev/null @@ -1,142 +0,0 @@ -mountManager instanceof MountManager) { - throw new ServiceNotFoundException('MountManager service not found, you need to install FlySystemBundle'); - } - // Configure options - parent::initialize($state); - - $this->sourceFS = new Filesystem($this->getOption($state, 'source_filesystem')); - $this->destinationFS = new Filesystem($this->getOption($state, 'destination_filesystem')); - } - - public function execute(ProcessState $state): void - { - $this->findMatchingFiles($state); - - $file = current($this->matchingFiles); - if (!$file) { - $state->setSkipped(true); - - return; - } - - $this->doFileCopy($state, $file, $this->getOption($state, 'remove_source')); - $state->setOutput($file); - } - - public function next(ProcessState $state): bool - { - $this->findMatchingFiles($state); - - return next($this->matchingFiles); - } - - protected function findMatchingFiles(ProcessState $state): void - { - $filePattern = $this->getOption($state, 'file_pattern'); - if ($filePattern) { - foreach ($this->sourceFS->listContents('/') as $file) { - if ('file' === $file['type'] - && preg_match($filePattern, (string) $file['path']) - && !\in_array($file['path'], $this->matchingFiles, true)) { - $this->matchingFiles[] = $file['path']; - } - } - } else { - $input = $state->getInput(); - if (!$input) { - throw new \UnexpectedValueException('No pattern neither input provided for the Task'); - } - if (\is_array($input)) { - foreach ($input as $file) { - if (!\in_array($file, $this->matchingFiles, true)) { - $this->matchingFiles[] = $file; - } - } - } elseif (!\in_array($input, $this->matchingFiles, true)) { - $this->matchingFiles[] = $input; - } - } - } - - protected function doFileCopy(ProcessState $state, string $filename, bool $removeSource): string|bool|null - { - $prefixFrom = $this->getOption($state, 'source_filesystem'); - - $buffer = $this->sourceFS->readStream($filename); - - try { - $this->destinationFS->writeStream($filename, $buffer); - $result = true; - } catch (FilesystemException) { - $result = false; - } - - if (\is_resource($buffer)) { - fclose($buffer); - } - - if ($removeSource) { - $this->sourceFS->delete(\sprintf('%s://%s', $prefixFrom, $filename)); - } - - return $result ? $filename : null; - } - - protected function configureOptions(OptionsResolver $resolver): void - { - $resolver->setRequired(['source_filesystem', 'destination_filesystem']); - $resolver->setAllowedTypes('source_filesystem', 'string'); - $resolver->setAllowedTypes('destination_filesystem', 'string'); - - $resolver->setDefault('file_pattern', null); - $resolver->setAllowedTypes('file_pattern', ['string', 'null']); - - $resolver->setDefault('remove_source', false); - $resolver->setAllowedTypes('remove_source', 'boolean'); - } -} From b7afaab1cb344437398fd30a9e91cda5a207c657 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 18 Oct 2024 11:08:55 +0200 Subject: [PATCH 14/41] #142 Refactor : * YamlReaderTask & YamlWriterTask namespaces changed to `CleverAge\ProcessBundle\Task\File\Yaml` * Array***Transformers namespaces changed to `CleverAge\ProcessBundle\Transformer\Array` * NormalizeTransformer & DenormalizeTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Serialization` * DateFormatTransformer & DateParserTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Date` * ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` * InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` --- CHANGELOG.md | 10 ++++++++-- src/Task/File/{ => Yaml}/YamlReaderTask.php | 2 +- src/Task/File/{ => Yaml}/YamlWriterTask.php | 2 +- .../{ => Array}/ArrayElementTransformer.php | 3 ++- src/Transformer/{ => Array}/ArrayFilterTransformer.php | 4 +++- src/Transformer/{ => Array}/ArrayFirstTransformer.php | 3 ++- src/Transformer/{ => Array}/ArrayLastTransformer.php | 4 +++- src/Transformer/{ => Array}/ArrayMapTransformer.php | 4 +++- src/Transformer/{ => Array}/ArrayUnsetTransformer.php | 3 ++- src/Transformer/{ => Date}/DateFormatTransformer.php | 3 ++- src/Transformer/{ => Date}/DateParserTransformer.php | 3 ++- .../{ => Object}/InstantiateTransformer.php | 3 ++- .../{ => Object}/PropertyAccessorTransformer.php | 3 ++- .../RecursivePropertySetterTransformer.php | 3 ++- .../{ => Serialization}/DenormalizeTransformer.php | 3 ++- .../{ => Serialization}/NormalizeTransformer.php | 3 ++- src/Transformer/{ => String}/ExplodeTransformer.php | 3 ++- src/Transformer/{ => String}/HashTransformer.php | 3 ++- src/Transformer/{ => String}/ImplodeTransformer.php | 3 ++- src/Transformer/{ => String}/SlugifyTransformer.php | 3 ++- src/Transformer/{ => String}/SprintfTransformer.php | 3 ++- src/Transformer/{ => String}/TrimTransformer.php | 3 ++- .../{ => Array}/ArrayElementTransformerTest.php | 6 +++--- .../{ => Array}/ArrayFirstTransformerTest.php | 6 +++--- tests/Transformer/CastTransformerTest.php | 2 +- tests/Transformer/ConstantTransformerTest.php | 2 +- .../{ => Date}/DateFormatTransformerTest.php | 6 +++--- .../{ => Date}/DateParserTransformerTest.php | 6 +++--- tests/Transformer/DebugTransformerTest.php | 2 +- tests/Transformer/DefaultTransformerTest.php | 2 +- tests/Transformer/MultiReplaceTransformerTest.php | 2 +- .../{ => String}/ExplodeTransformerTest.php | 6 +++--- .../{ => String}/ImplodeTransformerTest.php | 6 +++--- .../{ => String}/SprintfTransformerTest.php | 6 +++--- tests/Transformer/{ => String}/TrimTransformerTest.php | 6 +++--- tests/Transformer/WrapperTransformerTest.php | 2 +- .../{ => Xml}/XpathEvaluatorTransformerTest.php | 2 +- 37 files changed, 82 insertions(+), 54 deletions(-) rename src/Task/File/{ => Yaml}/YamlReaderTask.php (96%) rename src/Task/File/{ => Yaml}/YamlWriterTask.php (95%) rename src/Transformer/{ => Array}/ArrayElementTransformer.php (87%) rename src/Transformer/{ => Array}/ArrayFilterTransformer.php (89%) rename src/Transformer/{ => Array}/ArrayFirstTransformer.php (89%) rename src/Transformer/{ => Array}/ArrayLastTransformer.php (83%) rename src/Transformer/{ => Array}/ArrayMapTransformer.php (91%) rename src/Transformer/{ => Array}/ArrayUnsetTransformer.php (88%) rename src/Transformer/{ => Date}/DateFormatTransformer.php (91%) rename src/Transformer/{ => Date}/DateParserTransformer.php (90%) rename src/Transformer/{ => Object}/InstantiateTransformer.php (89%) rename src/Transformer/{ => Object}/PropertyAccessorTransformer.php (92%) rename src/Transformer/{ => Object}/RecursivePropertySetterTransformer.php (96%) rename src/Transformer/{ => Serialization}/DenormalizeTransformer.php (91%) rename src/Transformer/{ => Serialization}/NormalizeTransformer.php (90%) rename src/Transformer/{ => String}/ExplodeTransformer.php (88%) rename src/Transformer/{ => String}/HashTransformer.php (88%) rename src/Transformer/{ => String}/ImplodeTransformer.php (89%) rename src/Transformer/{ => String}/SlugifyTransformer.php (92%) rename src/Transformer/{ => String}/SprintfTransformer.php (88%) rename src/Transformer/{ => String}/TrimTransformer.php (90%) rename tests/Transformer/{ => Array}/ArrayElementTransformerTest.php (90%) rename tests/Transformer/{ => Array}/ArrayFirstTransformerTest.php (93%) rename tests/Transformer/{ => Date}/DateFormatTransformerTest.php (94%) rename tests/Transformer/{ => Date}/DateParserTransformerTest.php (94%) rename tests/Transformer/{ => String}/ExplodeTransformerTest.php (90%) rename tests/Transformer/{ => String}/ImplodeTransformerTest.php (90%) rename tests/Transformer/{ => String}/SprintfTransformerTest.php (82%) rename tests/Transformer/{ => String}/TrimTransformerTest.php (90%) rename tests/Transformer/{ => Xml}/XpathEvaluatorTransformerTest.php (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d34a73c5..b2623808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,19 @@ v4.0 ## BC breaks -* Remove FileFetchTask, use cleverage/flysystem-process-bundle instead. +* Remove FileFetchTask, use `cleverage/flysystem-process-bundle` instead. +* YamlReaderTask & YamlWriterTask namespaces changed to `CleverAge\ProcessBundle\Task\File\Yaml` +* Array***Transformers namespaces changed to `CleverAge\ProcessBundle\Transformer\Array` +* NormalizeTransformer & DenormalizeTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Serialization` +* DateFormatTransformer & DateParserTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Date` +* ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` +* InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` ### Changes * Update Makefile & .docker for local standalone usage * Update rector, phpstan & php-cs-fixer configurations & apply it -* league/flysystem-bundle is not required anymore +* `league/flysystem-bundle` is not required anymore ### Fixes diff --git a/src/Task/File/YamlReaderTask.php b/src/Task/File/Yaml/YamlReaderTask.php similarity index 96% rename from src/Task/File/YamlReaderTask.php rename to src/Task/File/Yaml/YamlReaderTask.php index 7b587e7e..13277cf1 100644 --- a/src/Task/File/YamlReaderTask.php +++ b/src/Task/File/Yaml/YamlReaderTask.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Task\File; +namespace CleverAge\ProcessBundle\Task\File\Yaml; use CleverAge\ProcessBundle\Model\ProcessState; use CleverAge\ProcessBundle\Task\AbstractIterableOutputTask; diff --git a/src/Task/File/YamlWriterTask.php b/src/Task/File/Yaml/YamlWriterTask.php similarity index 95% rename from src/Task/File/YamlWriterTask.php rename to src/Task/File/Yaml/YamlWriterTask.php index 208ef2fe..f557cae2 100644 --- a/src/Task/File/YamlWriterTask.php +++ b/src/Task/File/Yaml/YamlWriterTask.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Task\File; +namespace CleverAge\ProcessBundle\Task\File\Yaml; use CleverAge\ProcessBundle\Model\AbstractConfigurableTask; use CleverAge\ProcessBundle\Model\ProcessState; diff --git a/src/Transformer/ArrayElementTransformer.php b/src/Transformer/Array/ArrayElementTransformer.php similarity index 87% rename from src/Transformer/ArrayElementTransformer.php rename to src/Transformer/Array/ArrayElementTransformer.php index beb4cdf5..933e12a8 100644 --- a/src/Transformer/ArrayElementTransformer.php +++ b/src/Transformer/Array/ArrayElementTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/ArrayFilterTransformer.php b/src/Transformer/Array/ArrayFilterTransformer.php similarity index 89% rename from src/Transformer/ArrayFilterTransformer.php rename to src/Transformer/Array/ArrayFilterTransformer.php index 0464e98f..a755a985 100644 --- a/src/Transformer/ArrayFilterTransformer.php +++ b/src/Transformer/Array/ArrayFilterTransformer.php @@ -11,8 +11,10 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; +use CleverAge\ProcessBundle\Transformer\ConditionTrait; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; diff --git a/src/Transformer/ArrayFirstTransformer.php b/src/Transformer/Array/ArrayFirstTransformer.php similarity index 89% rename from src/Transformer/ArrayFirstTransformer.php rename to src/Transformer/Array/ArrayFirstTransformer.php index 238c09c7..fef817e4 100644 --- a/src/Transformer/ArrayFirstTransformer.php +++ b/src/Transformer/Array/ArrayFirstTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/ArrayLastTransformer.php b/src/Transformer/Array/ArrayLastTransformer.php similarity index 83% rename from src/Transformer/ArrayLastTransformer.php rename to src/Transformer/Array/ArrayLastTransformer.php index 3d8d8a2b..c2389852 100644 --- a/src/Transformer/ArrayLastTransformer.php +++ b/src/Transformer/Array/ArrayLastTransformer.php @@ -11,7 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; + +use CleverAge\ProcessBundle\Transformer\TransformerInterface; /** * Return the last element of an array. diff --git a/src/Transformer/ArrayMapTransformer.php b/src/Transformer/Array/ArrayMapTransformer.php similarity index 91% rename from src/Transformer/ArrayMapTransformer.php rename to src/Transformer/Array/ArrayMapTransformer.php index 767848f3..1263a9f7 100644 --- a/src/Transformer/ArrayMapTransformer.php +++ b/src/Transformer/Array/ArrayMapTransformer.php @@ -11,10 +11,12 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; use CleverAge\ProcessBundle\Exception\TransformerException; use CleverAge\ProcessBundle\Registry\TransformerRegistry; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; +use CleverAge\ProcessBundle\Transformer\TransformerTrait; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/ArrayUnsetTransformer.php b/src/Transformer/Array/ArrayUnsetTransformer.php similarity index 88% rename from src/Transformer/ArrayUnsetTransformer.php rename to src/Transformer/Array/ArrayUnsetTransformer.php index fd79556d..0e2bcf29 100644 --- a/src/Transformer/ArrayUnsetTransformer.php +++ b/src/Transformer/Array/ArrayUnsetTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Array; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/DateFormatTransformer.php b/src/Transformer/Date/DateFormatTransformer.php similarity index 91% rename from src/Transformer/DateFormatTransformer.php rename to src/Transformer/Date/DateFormatTransformer.php index b3462e05..e60324a0 100644 --- a/src/Transformer/DateFormatTransformer.php +++ b/src/Transformer/Date/DateFormatTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Date; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/DateParserTransformer.php b/src/Transformer/Date/DateParserTransformer.php similarity index 90% rename from src/Transformer/DateParserTransformer.php rename to src/Transformer/Date/DateParserTransformer.php index 3ebbe009..a891ff40 100644 --- a/src/Transformer/DateParserTransformer.php +++ b/src/Transformer/Date/DateParserTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Date; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/InstantiateTransformer.php b/src/Transformer/Object/InstantiateTransformer.php similarity index 89% rename from src/Transformer/InstantiateTransformer.php rename to src/Transformer/Object/InstantiateTransformer.php index 223be69b..41993a58 100644 --- a/src/Transformer/InstantiateTransformer.php +++ b/src/Transformer/Object/InstantiateTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Object; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/PropertyAccessorTransformer.php b/src/Transformer/Object/PropertyAccessorTransformer.php similarity index 92% rename from src/Transformer/PropertyAccessorTransformer.php rename to src/Transformer/Object/PropertyAccessorTransformer.php index ebb7f6ab..90e59b29 100644 --- a/src/Transformer/PropertyAccessorTransformer.php +++ b/src/Transformer/Object/PropertyAccessorTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Object; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; diff --git a/src/Transformer/RecursivePropertySetterTransformer.php b/src/Transformer/Object/RecursivePropertySetterTransformer.php similarity index 96% rename from src/Transformer/RecursivePropertySetterTransformer.php rename to src/Transformer/Object/RecursivePropertySetterTransformer.php index 6f7767e9..b42c1df7 100644 --- a/src/Transformer/RecursivePropertySetterTransformer.php +++ b/src/Transformer/Object/RecursivePropertySetterTransformer.php @@ -11,9 +11,10 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Object; use CleverAge\ProcessBundle\Exception\TransformerException; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; diff --git a/src/Transformer/DenormalizeTransformer.php b/src/Transformer/Serialization/DenormalizeTransformer.php similarity index 91% rename from src/Transformer/DenormalizeTransformer.php rename to src/Transformer/Serialization/DenormalizeTransformer.php index aabf2a84..f939b074 100644 --- a/src/Transformer/DenormalizeTransformer.php +++ b/src/Transformer/Serialization/DenormalizeTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Serialization; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; diff --git a/src/Transformer/NormalizeTransformer.php b/src/Transformer/Serialization/NormalizeTransformer.php similarity index 90% rename from src/Transformer/NormalizeTransformer.php rename to src/Transformer/Serialization/NormalizeTransformer.php index 904f7476..f23293a6 100644 --- a/src/Transformer/NormalizeTransformer.php +++ b/src/Transformer/Serialization/NormalizeTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\Serialization; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; diff --git a/src/Transformer/ExplodeTransformer.php b/src/Transformer/String/ExplodeTransformer.php similarity index 88% rename from src/Transformer/ExplodeTransformer.php rename to src/Transformer/String/ExplodeTransformer.php index 71c838f5..32542a43 100644 --- a/src/Transformer/ExplodeTransformer.php +++ b/src/Transformer/String/ExplodeTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/HashTransformer.php b/src/Transformer/String/HashTransformer.php similarity index 88% rename from src/Transformer/HashTransformer.php rename to src/Transformer/String/HashTransformer.php index 9c3bf4bc..4082b845 100644 --- a/src/Transformer/HashTransformer.php +++ b/src/Transformer/String/HashTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/ImplodeTransformer.php b/src/Transformer/String/ImplodeTransformer.php similarity index 89% rename from src/Transformer/ImplodeTransformer.php rename to src/Transformer/String/ImplodeTransformer.php index be117356..e005c67c 100644 --- a/src/Transformer/ImplodeTransformer.php +++ b/src/Transformer/String/ImplodeTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/SlugifyTransformer.php b/src/Transformer/String/SlugifyTransformer.php similarity index 92% rename from src/Transformer/SlugifyTransformer.php rename to src/Transformer/String/SlugifyTransformer.php index 970d7adf..7d23bf92 100644 --- a/src/Transformer/SlugifyTransformer.php +++ b/src/Transformer/String/SlugifyTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; diff --git a/src/Transformer/SprintfTransformer.php b/src/Transformer/String/SprintfTransformer.php similarity index 88% rename from src/Transformer/SprintfTransformer.php rename to src/Transformer/String/SprintfTransformer.php index f075b518..7013c72b 100644 --- a/src/Transformer/SprintfTransformer.php +++ b/src/Transformer/String/SprintfTransformer.php @@ -11,8 +11,9 @@ * file that was distributed with this source code. */ -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/src/Transformer/TrimTransformer.php b/src/Transformer/String/TrimTransformer.php similarity index 90% rename from src/Transformer/TrimTransformer.php rename to src/Transformer/String/TrimTransformer.php index 121b16d0..95627dd6 100644 --- a/src/Transformer/TrimTransformer.php +++ b/src/Transformer/String/TrimTransformer.php @@ -13,8 +13,9 @@ namespace Transformer; -namespace CleverAge\ProcessBundle\Transformer; +namespace CleverAge\ProcessBundle\Transformer\String; +use CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** diff --git a/tests/Transformer/ArrayElementTransformerTest.php b/tests/Transformer/Array/ArrayElementTransformerTest.php similarity index 90% rename from tests/Transformer/ArrayElementTransformerTest.php rename to tests/Transformer/Array/ArrayElementTransformerTest.php index a3c9e36e..fa98f00d 100644 --- a/tests/Transformer/ArrayElementTransformerTest.php +++ b/tests/Transformer/Array/ArrayElementTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\Array; -use CleverAge\ProcessBundle\Transformer\ArrayElementTransformer; +use CleverAge\ProcessBundle\Transformer\Array\ArrayElementTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\ArrayElementTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\Array\ArrayElementTransformer */ class ArrayElementTransformerTest extends TestCase { diff --git a/tests/Transformer/ArrayFirstTransformerTest.php b/tests/Transformer/Array/ArrayFirstTransformerTest.php similarity index 93% rename from tests/Transformer/ArrayFirstTransformerTest.php rename to tests/Transformer/Array/ArrayFirstTransformerTest.php index 596c2bf0..1b04a7fc 100644 --- a/tests/Transformer/ArrayFirstTransformerTest.php +++ b/tests/Transformer/Array/ArrayFirstTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\Array; -use CleverAge\ProcessBundle\Transformer\ArrayFirstTransformer; +use CleverAge\ProcessBundle\Transformer\Array\ArrayFirstTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\ArrayFirstTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\Array\ArrayFirstTransformer */ class ArrayFirstTransformerTest extends TestCase { diff --git a/tests/Transformer/CastTransformerTest.php b/tests/Transformer/CastTransformerTest.php index 9eac2bba..215a6f47 100644 --- a/tests/Transformer/CastTransformerTest.php +++ b/tests/Transformer/CastTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\CastTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/ConstantTransformerTest.php b/tests/Transformer/ConstantTransformerTest.php index e03734b3..9a36ba94 100644 --- a/tests/Transformer/ConstantTransformerTest.php +++ b/tests/Transformer/ConstantTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\ConstantTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/DateFormatTransformerTest.php b/tests/Transformer/Date/DateFormatTransformerTest.php similarity index 94% rename from tests/Transformer/DateFormatTransformerTest.php rename to tests/Transformer/Date/DateFormatTransformerTest.php index 8a0408e1..09ecf3ab 100644 --- a/tests/Transformer/DateFormatTransformerTest.php +++ b/tests/Transformer/Date/DateFormatTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\Date; -use CleverAge\ProcessBundle\Transformer\DateFormatTransformer; +use CleverAge\ProcessBundle\Transformer\Date\DateFormatTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\DateFormatTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\Date\DateFormatTransformer */ class DateFormatTransformerTest extends TestCase { diff --git a/tests/Transformer/DateParserTransformerTest.php b/tests/Transformer/Date/DateParserTransformerTest.php similarity index 94% rename from tests/Transformer/DateParserTransformerTest.php rename to tests/Transformer/Date/DateParserTransformerTest.php index 15e142b6..860d0487 100644 --- a/tests/Transformer/DateParserTransformerTest.php +++ b/tests/Transformer/Date/DateParserTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\Date; -use CleverAge\ProcessBundle\Transformer\DateParserTransformer; +use CleverAge\ProcessBundle\Transformer\Date\DateParserTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\DateParserTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\Date\DateParserTransformer */ class DateParserTransformerTest extends TestCase { diff --git a/tests/Transformer/DebugTransformerTest.php b/tests/Transformer/DebugTransformerTest.php index 0be796f9..4dd9c5b2 100644 --- a/tests/Transformer/DebugTransformerTest.php +++ b/tests/Transformer/DebugTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\DebugTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/DefaultTransformerTest.php b/tests/Transformer/DefaultTransformerTest.php index 39eb1209..7817b0df 100644 --- a/tests/Transformer/DefaultTransformerTest.php +++ b/tests/Transformer/DefaultTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\DefaultTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/MultiReplaceTransformerTest.php b/tests/Transformer/MultiReplaceTransformerTest.php index c21a9833..6eb2a852 100644 --- a/tests/Transformer/MultiReplaceTransformerTest.php +++ b/tests/Transformer/MultiReplaceTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\MultiReplaceTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/ExplodeTransformerTest.php b/tests/Transformer/String/ExplodeTransformerTest.php similarity index 90% rename from tests/Transformer/ExplodeTransformerTest.php rename to tests/Transformer/String/ExplodeTransformerTest.php index f0518338..cb698dd8 100644 --- a/tests/Transformer/ExplodeTransformerTest.php +++ b/tests/Transformer/String/ExplodeTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\String; -use CleverAge\ProcessBundle\Transformer\ExplodeTransformer; +use CleverAge\ProcessBundle\Transformer\String\ExplodeTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\ExplodeTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\String\ExplodeTransformer */ class ExplodeTransformerTest extends TestCase { diff --git a/tests/Transformer/ImplodeTransformerTest.php b/tests/Transformer/String/ImplodeTransformerTest.php similarity index 90% rename from tests/Transformer/ImplodeTransformerTest.php rename to tests/Transformer/String/ImplodeTransformerTest.php index 6037dd79..5a1a72b7 100644 --- a/tests/Transformer/ImplodeTransformerTest.php +++ b/tests/Transformer/String/ImplodeTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\String; -use CleverAge\ProcessBundle\Transformer\ImplodeTransformer; +use CleverAge\ProcessBundle\Transformer\String\ImplodeTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\ImplodeTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\String\ImplodeTransformer */ class ImplodeTransformerTest extends TestCase { diff --git a/tests/Transformer/SprintfTransformerTest.php b/tests/Transformer/String/SprintfTransformerTest.php similarity index 82% rename from tests/Transformer/SprintfTransformerTest.php rename to tests/Transformer/String/SprintfTransformerTest.php index 4b4f7996..4648e893 100644 --- a/tests/Transformer/SprintfTransformerTest.php +++ b/tests/Transformer/String/SprintfTransformerTest.php @@ -11,13 +11,13 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\String; -use CleverAge\ProcessBundle\Transformer\SprintfTransformer; +use CleverAge\ProcessBundle\Transformer\String\SprintfTransformer; use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\SprintfTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\String\SprintfTransformer */ class SprintfTransformerTest extends TestCase { diff --git a/tests/Transformer/TrimTransformerTest.php b/tests/Transformer/String/TrimTransformerTest.php similarity index 90% rename from tests/Transformer/TrimTransformerTest.php rename to tests/Transformer/String/TrimTransformerTest.php index 7ee5609f..8bd4b6e0 100644 --- a/tests/Transformer/TrimTransformerTest.php +++ b/tests/Transformer/String/TrimTransformerTest.php @@ -11,14 +11,14 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\String; -use CleverAge\ProcessBundle\Transformer\TrimTransformer; +use CleverAge\ProcessBundle\Transformer\String\TrimTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\TrimTransformer + * @coversDefaultClass \CleverAge\ProcessBundle\Transformer\String\TrimTransformer */ class TrimTransformerTest extends TestCase { diff --git a/tests/Transformer/WrapperTransformerTest.php b/tests/Transformer/WrapperTransformerTest.php index c89ee2d3..84cac9a2 100644 --- a/tests/Transformer/WrapperTransformerTest.php +++ b/tests/Transformer/WrapperTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer; use CleverAge\ProcessBundle\Transformer\WrapperTransformer; use PHPUnit\Framework\TestCase; diff --git a/tests/Transformer/XpathEvaluatorTransformerTest.php b/tests/Transformer/Xml/XpathEvaluatorTransformerTest.php similarity index 98% rename from tests/Transformer/XpathEvaluatorTransformerTest.php rename to tests/Transformer/Xml/XpathEvaluatorTransformerTest.php index 5f4dfd2c..baf16a5f 100644 --- a/tests/Transformer/XpathEvaluatorTransformerTest.php +++ b/tests/Transformer/Xml/XpathEvaluatorTransformerTest.php @@ -11,7 +11,7 @@ * file that was distributed with this source code. */ -namespace Transformer; +namespace CleverAge\ProcessBundle\Tests\Transformer\Xml; use CleverAge\ProcessBundle\Transformer\Xml\XpathEvaluatorTransformer; use PHPUnit\Framework\TestCase; From 7524cf5f3bee50aadf6231fae6ec78187851f8b2 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 18 Oct 2024 11:10:07 +0200 Subject: [PATCH 15/41] #138 Update README with all missing Tasks & Transformers --- README.md | 128 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 103 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 28cbc9ab..5ad04ac2 100644 --- a/README.md +++ b/README.md @@ -34,42 +34,120 @@ Demo project can be found on [there](https://github.com/cleverage/process-bundle - Basic and debug - [ConstantOutputTask](doc/reference/tasks/constant_output_task.md) - [ConstantIterableOutputTask](doc/reference/tasks/constant_iterable_output_task.md) + - [CounterTask] - [DebugTask](doc/reference/tasks/debug_task.md) - [DieTask](doc/reference/tasks/die_task.md) - [DummyTask](doc/reference/tasks/dummy_task.md) + - [ErrorForwarderTask] - [EventDispatcherTask](doc/reference/tasks/event_dispatcher_task.md) - - Data manipulation and transformations - - [DenormalizerTask](doc/reference/tasks/denormalizer_task.md) - - [NormalizerTask](doc/reference/tasks/normalizer_task.md) - - [PropertyGetterTask](doc/reference/tasks/property_getter_task.md) - - [PropertySetterTask](doc/reference/tasks/property_setter_task.md) - - [TransformerTask](doc/reference/tasks/transformer_task.md) - - File/CSV - - [CsvReaderTask](doc/reference/tasks/csv_reader_task.md) - - [CsvWriterTask](doc/reference/tasks/csv_writer_task.md) - - File/XML - - [XmlReaderTask](doc/reference/tasks/xml_reader_task.md) - - [XmlWriterTask](doc/reference/tasks/xml_writer_task.md) - - Flow manipulation - - [AggregateIterableTask](doc/reference/tasks/aggregate_iterable_task.md) - - [InputAggregatorTask](doc/reference/tasks/input_aggregator_task.md) - - [InputIteratorTask](doc/reference/tasks/input_iterator_task.md) + - [MemInfoDumpTask] + - [StopwatchTask] + - Data manipulation and transformations + - [DenormalizerTask](doc/reference/tasks/denormalizer_task.md) + - [NormalizerTask](doc/reference/tasks/normalizer_task.md) + - [DeserializerTask] + - [SerializerTask] + - [PropertyGetterTask](doc/reference/tasks/property_getter_task.md) + - [PropertySetterTask](doc/reference/tasks/property_setter_task.md) + - [ObjectUpdaterTask] + - [SplitJoinLineTask] + - [TransformerTask](doc/reference/tasks/transformer_task.md) + - [ValidatorTask] + - File/CSV + - [CsvReaderTask](doc/reference/tasks/csv_reader_task.md) + - [CsvWriterTask](doc/reference/tasks/csv_writer_task.md) + - [CSVSplitterTask] + - [InputCsvReaderTask] + - File/JsonStream + - [JsonStreamReaderTask] + - File/XML + - [XmlReaderTask](doc/reference/tasks/xml_reader_task.md) + - [XmlWriterTask](doc/reference/tasks/xml_writer_task.md) + - File/Yaml + - [YamlReaderTask] + - [YamlWriterTask] + - File + - [FileMoverTask] + - [FileReaderTask] + - [FileRemoverTask] + - [FileWriterTask] + - [FolderBrowserTask] + - [InputFolderBrowserTask] + - Flow manipulation + - [AggregateIterableTask](doc/reference/tasks/aggregate_iterable_task.md) + - [InputAggregatorTask](doc/reference/tasks/input_aggregator_task.md) + - [InputIteratorTask](doc/reference/tasks/input_iterator_task.md) + - [ArrayMergeTask] + - [ColumnAggregatorTask] + - [RowAggregatorTask] + - [FilterTask] + - [GroupByAggregateIterableTask] + - [SimpleBatchTask] + - [IterableBatchTask] + - [SkipEmptyTask] + - [StopTask] + - Process + - [CommandRunnerTask] + - [ProcessExecutorTask] + - [ProcessLauncherTask] + - Reporting + - [AdvancedStatCounterTask] + - [LoggerTask] + - [StatCounterTask] - Transformers - - [ArrayFilterTransformer](doc/reference/transformers/array_filter_transformer.md) + - Basic and debug + - [CachedTransformer] + - [CallbackTransformer] + - [CastTransformer] + - [ConstantTransformer] + - [ConvertValueTransformer] + - [DebugTransformer] + - [DefaultTransformer] + - [GenericTransformer] + - [EvaluatorTransformer] + - [ExpressionLanguageMapTransformer] - [MappingTransformer](doc/reference/transformers/mapping_transformer.md) + - [MultiReplaceTransformer] + - [PregFilterTransformer] - [RulesTransformer](doc/reference/transformers/rules_transformer.md) + - [TypeSetterTransformer] + - [UnsetTransformer] + - [WrapperTransformer] + - Array + - [ArrayElementTransformer] + - [ArrayFilterTransformer](doc/reference/transformers/array_filter_transformer.md) + - [ArrayFirstTransformer] + - [ArrayLastTransformer] + - [ArrayMapTransformer] + - [ArrayUnsetTransformer] + - Date - [DateFormatTransformer](doc/reference/transformers/date_format.md) - [DateParserTransformer](doc/reference/transformers/date_parser.md) + - Object + - [InstantiateTransformer] + - [PropertyAccessorTransformer] + - [RecursivePropertySetterTransformer] + - Serialization + - [DenormalizeTransformer] + - [NormalizeTransformer] + - String + - [ExplodeTransformer] + - [HashTransformer] + - [ImplodeTransformer] + - [SlugifyTransformer] + - [SprintfTransformer] + - [TrimTransformer] + - XML - [XpathEvaluatorTransformer](doc/reference/transformers/xpath_evaluator.md) - Other bridges - - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) - - [Eav](https://github.com/cleverage/eav-process-bundle) - - [Soap](https://github.com/cleverage/soap-process-bundle) - - [Another Soap](https://github.com/cleverage/process-soap-bundle) - - [Rest](https://github.com/cleverage/rest-process-bundle) - - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) - - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) - - [Cache](https://github.com/cleverage/cache-process-bundle) + - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) + - [Eav](https://github.com/cleverage/eav-process-bundle) + - [Soap](https://github.com/cleverage/soap-process-bundle) + - [Another Soap](https://github.com/cleverage/process-soap-bundle) + - [Rest](https://github.com/cleverage/rest-process-bundle) + - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) + - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) + - [Cache](https://github.com/cleverage/cache-process-bundle) - [Generic transformers definition](doc/reference/03-generic_transformers_definition.md) - [UI](https://github.com/cleverage/processuibundle) From 49c24c291300fc955200e866c561801e779ce8ed Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 18 Oct 2024 14:27:24 +0200 Subject: [PATCH 16/41] Update CHANGELOG with issue links for v4.0 --- CHANGELOG.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2623808..fc6049b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,19 +3,20 @@ v4.0 ## BC breaks -* Remove FileFetchTask, use `cleverage/flysystem-process-bundle` instead. -* YamlReaderTask & YamlWriterTask namespaces changed to `CleverAge\ProcessBundle\Task\File\Yaml` -* Array***Transformers namespaces changed to `CleverAge\ProcessBundle\Transformer\Array` -* NormalizeTransformer & DenormalizeTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Serialization` -* DateFormatTransformer & DateParserTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Date` -* ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` -* InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` +* [#142](https://github.com/cleverage/process-bundle/issues/142) Remove FileFetchTask, use `cleverage/flysystem-process-bundle` instead. +* [#142](https://github.com/cleverage/process-bundle/issues/142) YamlReaderTask & YamlWriterTask namespaces changed to `CleverAge\ProcessBundle\Task\File\Yaml` +* [#142](https://github.com/cleverage/process-bundle/issues/142) Array***Transformers namespaces changed to `CleverAge\ProcessBundle\Transformer\Array` +* [#142](https://github.com/cleverage/process-bundle/issues/142) NormalizeTransformer & DenormalizeTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Serialization` +* [#142](https://github.com/cleverage/process-bundle/issues/142) DateFormatTransformer & DateParserTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Date` +* [#142](https://github.com/cleverage/process-bundle/issues/142) ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` +* [#142](https://github.com/cleverage/process-bundle/issues/142) InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` ### Changes -* Update Makefile & .docker for local standalone usage -* Update rector, phpstan & php-cs-fixer configurations & apply it -* `league/flysystem-bundle` is not required anymore +* [#139](https://github.com/cleverage/process-bundle/issues/139Update) Makefile & .docker for local standalone usage +* [#139](https://github.com/cleverage/process-bundle/issues/139Update) Update rector, phpstan & php-cs-fixer configurations & apply it +* [#141](https://github.com/cleverage/process-bundle/issues/141) `league/flysystem-bundle` is not required anymore +* [#130](https://github.com/cleverage/process-bundle/issues/130) EventDispatcherInterface service declaration breaks dependency injection ### Fixes From bdea76352df563305ac0d3ec10039d31eaa0711b Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Mon, 21 Oct 2024 15:22:23 +0200 Subject: [PATCH 17/41] #148 Update directory structure according to Symfony best practices --- .../config => config}/services/command.yaml | 0 .../Resources/config => config}/services/event.yaml | 0 .../services/expression_language.yaml | 0 .../config => config}/services/logger.yaml | 0 .../config => config}/services/manager.yaml | 0 .../config => config}/services/registry.yaml | 0 {src/Resources/config => config}/services/task.yaml | 0 .../config => config}/services/transformer.yaml | 0 {doc => docs}/01-quick_start.md | 0 {doc => docs}/02-task_types.md | 0 {doc => docs}/03-custom_tasks.md | 0 {doc => docs}/04-advanced_workflow.md | 0 {doc => docs}/05-good_practices.md | 0 {doc => docs}/06-testing.md | 0 {doc => docs}/basic-etl.png | Bin {doc => docs}/cookbooks/01-common_setup.md | 0 {doc => docs}/cookbooks/memory_usage_graph.md | 0 {doc => docs}/cookbooks/performances_monitoring.md | 0 docs/index.md | 0 {doc => docs}/reference/01-process_definition.md | 0 {doc => docs}/reference/02-task_definition.md | 0 .../reference/03-generic_transformers_definition.md | 0 {doc => docs}/reference/tasks/_template.md | 0 .../reference/tasks/aggregate_iterable_task.md | 0 .../tasks/constant_iterable_output_task.md | 0 .../reference/tasks/constant_output_task.md | 0 {doc => docs}/reference/tasks/csv_reader_task.md | 0 {doc => docs}/reference/tasks/csv_writer_task.md | 0 {doc => docs}/reference/tasks/debug_task.md | 0 {doc => docs}/reference/tasks/denormalizer_task.md | 0 {doc => docs}/reference/tasks/die_task.md | 0 {doc => docs}/reference/tasks/dummy_task.md | 0 .../reference/tasks/event_dispatcher_task.md | 0 .../reference/tasks/input_aggregator_task.md | 0 .../reference/tasks/input_iterator_task.md | 0 .../reference/tasks/iterable_batch_task.md | 0 {doc => docs}/reference/tasks/normalizer_task.md | 0 .../reference/tasks/property_getter_task.md | 0 .../reference/tasks/property_setter_task.md | 0 {doc => docs}/reference/tasks/transformer_task.md | 0 {doc => docs}/reference/tasks/xml_reader_task.md | 0 {doc => docs}/reference/tasks/xml_writer_task.md | 0 {doc => docs}/reference/traits/condition_trait.md | 0 {doc => docs}/reference/traits/transformer_trait.md | 0 {doc => docs}/reference/transformers/_template.md | 0 .../transformers/array_filter_transformer.md | 0 {doc => docs}/reference/transformers/date_format.md | 0 {doc => docs}/reference/transformers/date_parser.md | 0 .../reference/transformers/mapping_transformer.md | 0 .../reference/transformers/rules_transformer.md | 0 .../reference/transformers/xpath_evaluator.md | 0 src/CleverAgeProcessBundle.php | 12 +++++++----- .../CleverAgeProcessExtension.php | 6 ++---- 53 files changed, 9 insertions(+), 9 deletions(-) rename {src/Resources/config => config}/services/command.yaml (100%) rename {src/Resources/config => config}/services/event.yaml (100%) rename {src/Resources/config => config}/services/expression_language.yaml (100%) rename {src/Resources/config => config}/services/logger.yaml (100%) rename {src/Resources/config => config}/services/manager.yaml (100%) rename {src/Resources/config => config}/services/registry.yaml (100%) rename {src/Resources/config => config}/services/task.yaml (100%) rename {src/Resources/config => config}/services/transformer.yaml (100%) rename {doc => docs}/01-quick_start.md (100%) rename {doc => docs}/02-task_types.md (100%) rename {doc => docs}/03-custom_tasks.md (100%) rename {doc => docs}/04-advanced_workflow.md (100%) rename {doc => docs}/05-good_practices.md (100%) rename {doc => docs}/06-testing.md (100%) rename {doc => docs}/basic-etl.png (100%) rename {doc => docs}/cookbooks/01-common_setup.md (100%) rename {doc => docs}/cookbooks/memory_usage_graph.md (100%) rename {doc => docs}/cookbooks/performances_monitoring.md (100%) create mode 100644 docs/index.md rename {doc => docs}/reference/01-process_definition.md (100%) rename {doc => docs}/reference/02-task_definition.md (100%) rename {doc => docs}/reference/03-generic_transformers_definition.md (100%) rename {doc => docs}/reference/tasks/_template.md (100%) rename {doc => docs}/reference/tasks/aggregate_iterable_task.md (100%) rename {doc => docs}/reference/tasks/constant_iterable_output_task.md (100%) rename {doc => docs}/reference/tasks/constant_output_task.md (100%) rename {doc => docs}/reference/tasks/csv_reader_task.md (100%) rename {doc => docs}/reference/tasks/csv_writer_task.md (100%) rename {doc => docs}/reference/tasks/debug_task.md (100%) rename {doc => docs}/reference/tasks/denormalizer_task.md (100%) rename {doc => docs}/reference/tasks/die_task.md (100%) rename {doc => docs}/reference/tasks/dummy_task.md (100%) rename {doc => docs}/reference/tasks/event_dispatcher_task.md (100%) rename {doc => docs}/reference/tasks/input_aggregator_task.md (100%) rename {doc => docs}/reference/tasks/input_iterator_task.md (100%) rename {doc => docs}/reference/tasks/iterable_batch_task.md (100%) rename {doc => docs}/reference/tasks/normalizer_task.md (100%) rename {doc => docs}/reference/tasks/property_getter_task.md (100%) rename {doc => docs}/reference/tasks/property_setter_task.md (100%) rename {doc => docs}/reference/tasks/transformer_task.md (100%) rename {doc => docs}/reference/tasks/xml_reader_task.md (100%) rename {doc => docs}/reference/tasks/xml_writer_task.md (100%) rename {doc => docs}/reference/traits/condition_trait.md (100%) rename {doc => docs}/reference/traits/transformer_trait.md (100%) rename {doc => docs}/reference/transformers/_template.md (100%) rename {doc => docs}/reference/transformers/array_filter_transformer.md (100%) rename {doc => docs}/reference/transformers/date_format.md (100%) rename {doc => docs}/reference/transformers/date_parser.md (100%) rename {doc => docs}/reference/transformers/mapping_transformer.md (100%) rename {doc => docs}/reference/transformers/rules_transformer.md (100%) rename {doc => docs}/reference/transformers/xpath_evaluator.md (100%) diff --git a/src/Resources/config/services/command.yaml b/config/services/command.yaml similarity index 100% rename from src/Resources/config/services/command.yaml rename to config/services/command.yaml diff --git a/src/Resources/config/services/event.yaml b/config/services/event.yaml similarity index 100% rename from src/Resources/config/services/event.yaml rename to config/services/event.yaml diff --git a/src/Resources/config/services/expression_language.yaml b/config/services/expression_language.yaml similarity index 100% rename from src/Resources/config/services/expression_language.yaml rename to config/services/expression_language.yaml diff --git a/src/Resources/config/services/logger.yaml b/config/services/logger.yaml similarity index 100% rename from src/Resources/config/services/logger.yaml rename to config/services/logger.yaml diff --git a/src/Resources/config/services/manager.yaml b/config/services/manager.yaml similarity index 100% rename from src/Resources/config/services/manager.yaml rename to config/services/manager.yaml diff --git a/src/Resources/config/services/registry.yaml b/config/services/registry.yaml similarity index 100% rename from src/Resources/config/services/registry.yaml rename to config/services/registry.yaml diff --git a/src/Resources/config/services/task.yaml b/config/services/task.yaml similarity index 100% rename from src/Resources/config/services/task.yaml rename to config/services/task.yaml diff --git a/src/Resources/config/services/transformer.yaml b/config/services/transformer.yaml similarity index 100% rename from src/Resources/config/services/transformer.yaml rename to config/services/transformer.yaml diff --git a/doc/01-quick_start.md b/docs/01-quick_start.md similarity index 100% rename from doc/01-quick_start.md rename to docs/01-quick_start.md diff --git a/doc/02-task_types.md b/docs/02-task_types.md similarity index 100% rename from doc/02-task_types.md rename to docs/02-task_types.md diff --git a/doc/03-custom_tasks.md b/docs/03-custom_tasks.md similarity index 100% rename from doc/03-custom_tasks.md rename to docs/03-custom_tasks.md diff --git a/doc/04-advanced_workflow.md b/docs/04-advanced_workflow.md similarity index 100% rename from doc/04-advanced_workflow.md rename to docs/04-advanced_workflow.md diff --git a/doc/05-good_practices.md b/docs/05-good_practices.md similarity index 100% rename from doc/05-good_practices.md rename to docs/05-good_practices.md diff --git a/doc/06-testing.md b/docs/06-testing.md similarity index 100% rename from doc/06-testing.md rename to docs/06-testing.md diff --git a/doc/basic-etl.png b/docs/basic-etl.png similarity index 100% rename from doc/basic-etl.png rename to docs/basic-etl.png diff --git a/doc/cookbooks/01-common_setup.md b/docs/cookbooks/01-common_setup.md similarity index 100% rename from doc/cookbooks/01-common_setup.md rename to docs/cookbooks/01-common_setup.md diff --git a/doc/cookbooks/memory_usage_graph.md b/docs/cookbooks/memory_usage_graph.md similarity index 100% rename from doc/cookbooks/memory_usage_graph.md rename to docs/cookbooks/memory_usage_graph.md diff --git a/doc/cookbooks/performances_monitoring.md b/docs/cookbooks/performances_monitoring.md similarity index 100% rename from doc/cookbooks/performances_monitoring.md rename to docs/cookbooks/performances_monitoring.md diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..e69de29b diff --git a/doc/reference/01-process_definition.md b/docs/reference/01-process_definition.md similarity index 100% rename from doc/reference/01-process_definition.md rename to docs/reference/01-process_definition.md diff --git a/doc/reference/02-task_definition.md b/docs/reference/02-task_definition.md similarity index 100% rename from doc/reference/02-task_definition.md rename to docs/reference/02-task_definition.md diff --git a/doc/reference/03-generic_transformers_definition.md b/docs/reference/03-generic_transformers_definition.md similarity index 100% rename from doc/reference/03-generic_transformers_definition.md rename to docs/reference/03-generic_transformers_definition.md diff --git a/doc/reference/tasks/_template.md b/docs/reference/tasks/_template.md similarity index 100% rename from doc/reference/tasks/_template.md rename to docs/reference/tasks/_template.md diff --git a/doc/reference/tasks/aggregate_iterable_task.md b/docs/reference/tasks/aggregate_iterable_task.md similarity index 100% rename from doc/reference/tasks/aggregate_iterable_task.md rename to docs/reference/tasks/aggregate_iterable_task.md diff --git a/doc/reference/tasks/constant_iterable_output_task.md b/docs/reference/tasks/constant_iterable_output_task.md similarity index 100% rename from doc/reference/tasks/constant_iterable_output_task.md rename to docs/reference/tasks/constant_iterable_output_task.md diff --git a/doc/reference/tasks/constant_output_task.md b/docs/reference/tasks/constant_output_task.md similarity index 100% rename from doc/reference/tasks/constant_output_task.md rename to docs/reference/tasks/constant_output_task.md diff --git a/doc/reference/tasks/csv_reader_task.md b/docs/reference/tasks/csv_reader_task.md similarity index 100% rename from doc/reference/tasks/csv_reader_task.md rename to docs/reference/tasks/csv_reader_task.md diff --git a/doc/reference/tasks/csv_writer_task.md b/docs/reference/tasks/csv_writer_task.md similarity index 100% rename from doc/reference/tasks/csv_writer_task.md rename to docs/reference/tasks/csv_writer_task.md diff --git a/doc/reference/tasks/debug_task.md b/docs/reference/tasks/debug_task.md similarity index 100% rename from doc/reference/tasks/debug_task.md rename to docs/reference/tasks/debug_task.md diff --git a/doc/reference/tasks/denormalizer_task.md b/docs/reference/tasks/denormalizer_task.md similarity index 100% rename from doc/reference/tasks/denormalizer_task.md rename to docs/reference/tasks/denormalizer_task.md diff --git a/doc/reference/tasks/die_task.md b/docs/reference/tasks/die_task.md similarity index 100% rename from doc/reference/tasks/die_task.md rename to docs/reference/tasks/die_task.md diff --git a/doc/reference/tasks/dummy_task.md b/docs/reference/tasks/dummy_task.md similarity index 100% rename from doc/reference/tasks/dummy_task.md rename to docs/reference/tasks/dummy_task.md diff --git a/doc/reference/tasks/event_dispatcher_task.md b/docs/reference/tasks/event_dispatcher_task.md similarity index 100% rename from doc/reference/tasks/event_dispatcher_task.md rename to docs/reference/tasks/event_dispatcher_task.md diff --git a/doc/reference/tasks/input_aggregator_task.md b/docs/reference/tasks/input_aggregator_task.md similarity index 100% rename from doc/reference/tasks/input_aggregator_task.md rename to docs/reference/tasks/input_aggregator_task.md diff --git a/doc/reference/tasks/input_iterator_task.md b/docs/reference/tasks/input_iterator_task.md similarity index 100% rename from doc/reference/tasks/input_iterator_task.md rename to docs/reference/tasks/input_iterator_task.md diff --git a/doc/reference/tasks/iterable_batch_task.md b/docs/reference/tasks/iterable_batch_task.md similarity index 100% rename from doc/reference/tasks/iterable_batch_task.md rename to docs/reference/tasks/iterable_batch_task.md diff --git a/doc/reference/tasks/normalizer_task.md b/docs/reference/tasks/normalizer_task.md similarity index 100% rename from doc/reference/tasks/normalizer_task.md rename to docs/reference/tasks/normalizer_task.md diff --git a/doc/reference/tasks/property_getter_task.md b/docs/reference/tasks/property_getter_task.md similarity index 100% rename from doc/reference/tasks/property_getter_task.md rename to docs/reference/tasks/property_getter_task.md diff --git a/doc/reference/tasks/property_setter_task.md b/docs/reference/tasks/property_setter_task.md similarity index 100% rename from doc/reference/tasks/property_setter_task.md rename to docs/reference/tasks/property_setter_task.md diff --git a/doc/reference/tasks/transformer_task.md b/docs/reference/tasks/transformer_task.md similarity index 100% rename from doc/reference/tasks/transformer_task.md rename to docs/reference/tasks/transformer_task.md diff --git a/doc/reference/tasks/xml_reader_task.md b/docs/reference/tasks/xml_reader_task.md similarity index 100% rename from doc/reference/tasks/xml_reader_task.md rename to docs/reference/tasks/xml_reader_task.md diff --git a/doc/reference/tasks/xml_writer_task.md b/docs/reference/tasks/xml_writer_task.md similarity index 100% rename from doc/reference/tasks/xml_writer_task.md rename to docs/reference/tasks/xml_writer_task.md diff --git a/doc/reference/traits/condition_trait.md b/docs/reference/traits/condition_trait.md similarity index 100% rename from doc/reference/traits/condition_trait.md rename to docs/reference/traits/condition_trait.md diff --git a/doc/reference/traits/transformer_trait.md b/docs/reference/traits/transformer_trait.md similarity index 100% rename from doc/reference/traits/transformer_trait.md rename to docs/reference/traits/transformer_trait.md diff --git a/doc/reference/transformers/_template.md b/docs/reference/transformers/_template.md similarity index 100% rename from doc/reference/transformers/_template.md rename to docs/reference/transformers/_template.md diff --git a/doc/reference/transformers/array_filter_transformer.md b/docs/reference/transformers/array_filter_transformer.md similarity index 100% rename from doc/reference/transformers/array_filter_transformer.md rename to docs/reference/transformers/array_filter_transformer.md diff --git a/doc/reference/transformers/date_format.md b/docs/reference/transformers/date_format.md similarity index 100% rename from doc/reference/transformers/date_format.md rename to docs/reference/transformers/date_format.md diff --git a/doc/reference/transformers/date_parser.md b/docs/reference/transformers/date_parser.md similarity index 100% rename from doc/reference/transformers/date_parser.md rename to docs/reference/transformers/date_parser.md diff --git a/doc/reference/transformers/mapping_transformer.md b/docs/reference/transformers/mapping_transformer.md similarity index 100% rename from doc/reference/transformers/mapping_transformer.md rename to docs/reference/transformers/mapping_transformer.md diff --git a/doc/reference/transformers/rules_transformer.md b/docs/reference/transformers/rules_transformer.md similarity index 100% rename from doc/reference/transformers/rules_transformer.md rename to docs/reference/transformers/rules_transformer.md diff --git a/doc/reference/transformers/xpath_evaluator.md b/docs/reference/transformers/xpath_evaluator.md similarity index 100% rename from doc/reference/transformers/xpath_evaluator.md rename to docs/reference/transformers/xpath_evaluator.md diff --git a/src/CleverAgeProcessBundle.php b/src/CleverAgeProcessBundle.php index 10838026..300158b5 100644 --- a/src/CleverAgeProcessBundle.php +++ b/src/CleverAgeProcessBundle.php @@ -16,7 +16,6 @@ use CleverAge\ProcessBundle\DependencyInjection\Compiler\CheckSerializerCompilerPass; use CleverAge\ProcessBundle\DependencyInjection\Compiler\RegistryCompilerPass; use CleverAge\ProcessBundle\Registry\TransformerRegistry; -use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -30,11 +29,14 @@ public function build(ContainerBuilder $container): void parent::build($container); $container->addCompilerPass( - new RegistryCompilerPass(TransformerRegistry::class, 'cleverage.transformer', 'addTransformer'), - PassConfig::TYPE_BEFORE_OPTIMIZATION, - 0 + new RegistryCompilerPass(TransformerRegistry::class, 'cleverage.transformer', 'addTransformer') ); - $container->addCompilerPass(new CheckSerializerCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); + $container->addCompilerPass(new CheckSerializerCompilerPass()); + } + + public function getPath(): string + { + return \dirname(__DIR__); } } diff --git a/src/DependencyInjection/CleverAgeProcessExtension.php b/src/DependencyInjection/CleverAgeProcessExtension.php index d6b650c5..5c8db1a2 100644 --- a/src/DependencyInjection/CleverAgeProcessExtension.php +++ b/src/DependencyInjection/CleverAgeProcessExtension.php @@ -25,16 +25,14 @@ /** * This is the class that loads and manages your bundle configuration. * - * @see http://symfony.com/doc/current/cookbook/bundles/extension.html + * @see https://symfony.com/doc/current/bundles/extension.html */ class CleverAgeProcessExtension extends Extension { public function load(array $configs, ContainerBuilder $container): void { // Get the path of the service folder wherever the bundle is installed - $reflection = new \ReflectionClass($this); - $serviceFolderPath = \dirname($reflection->getFileName(), 2).'/Resources/config/services'; - $this->findServices($container, $serviceFolderPath); + $this->findServices($container, __DIR__.'/../../config/services'); $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); From fff486ee89bf155d02262ae39ff685eaf9b209ed Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Mon, 21 Oct 2024 15:54:52 +0200 Subject: [PATCH 18/41] #148 Update documentation according to Symfony best practices --- CONTRIBUTING.md | 47 +++++- Makefile | 4 + README.md | 142 +----------------- docs/01-quick_start.md | 15 +- docs/02-task_types.md | 2 +- docs/03-custom_tasks.md | 8 +- docs/index.md | 140 +++++++++++++++++ .../03-generic_transformers_definition.md | 2 +- 8 files changed, 205 insertions(+), 155 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a4b6a92..b6e9caaa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,50 @@ Contributing ============ -Every contributions are welcomed. This bundle aims to provide a standalone set of generic component. -If a contribution is too specific or requires dependencies, it might be put in a separated sub-bundle. +First of all, **thank you** for contributing, **you are awesome**! -Ideally every PR should contain documentation and unit test updates. +Here are a few rules to follow in order to ease code reviews, and discussions before +maintainers accept and merge your work. + +You MUST run the quality & test suites. + +You SHOULD write (or update) unit tests. + +You SHOULD write documentation. + +Please, write [commit messages that make sense](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), +and [rebase your branch](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) before submitting your Pull Request. + +One may ask you to [squash your commits](https://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) +too. This is used to "clean" your Pull Request before merging it (we don't want +commits such as `fix tests`, `fix 2`, `fix 3`, etc.). + +Thank you! + +## Running the quality & test suites + +Tests suite uses Docker environments in order to be idempotent to OS's. More than this +PHP version is written inside the Dockerfile; this assures to test the bundle with +the same resources. No need to have PHP installed. + +You only need Docker set it up. + +To allow testing environments more smooth we implemented **Makefile**. +You have two commands available: + +```bash +make quality +``` + +```bash +make tests +``` + +which will execute all tests inside the docker. + +```bash +make test TEST="Tests/Util/FilenameUtilsTest.php" +``` ## Deprecations notices @@ -14,4 +54,5 @@ When a feature should be deprecated, or when you have a breaking change for a fu * Trigger a deprecation error: `@trigger_error('This feature will be deprecated in v4.0', E_USER_DEPRECATED);` You can check which deprecation notice is triggered in tests +* `make bash` * `SYMFONY_DEPRECATIONS_HELPER=0 ./vendor/bin/phpunit` diff --git a/Makefile b/Makefile index 3461c159..0a58e32f 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,8 @@ bash: #[Docker] Connect to php container with current host user logs: #[Docker] Show logs $(DOCKER_COMPOSE) logs -f +quality: phpstan php-cs-fixer rector #[Quality] Run all quality checks + phpstan: #[Quality] Run PHPStan $(DOCKER_RUN_PHP) "vendor/bin/phpstan --no-progress --memory-limit=1G analyse" @@ -46,5 +48,7 @@ php-cs-fixer: #[Quality] Run PHP-CS-Fixer rector: #[Quality] Run Rector $(DOCKER_RUN_PHP) "vendor/bin/rector" +tests: phpunit #[Tests] Run all tests + phpunit: #[Tests] Run PHPUnit $(DOCKER_RUN_PHP) "vendor/bin/phpunit" diff --git a/README.md b/README.md index 5ad04ac2..d9ec2b9b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ CleverAge/ProcessBundle ======================= -## Introduction - This bundle allows to configure series of tasks to be performed on a certain order. Basically, it will greatly ease the configuration of import and exports but can do much more. @@ -12,144 +10,8 @@ Demo project can be found on [there](https://github.com/cleverage/process-bundle ## Documentation -- [Quick start](doc/01-quick_start.md) -- [Task types](doc/02-task_types.md) -- [Custom tasks and development](doc/03-custom_tasks.md) -- [Advanced workflow](doc/04-advanced_workflow.md) -- Cookbooks - - [Common Setup](doc/cookbooks/01-common_setup.md) - - [Transformations] - - [Flow manipulation] - - [Dummy tasks] - - [Debugging] - - [Logging] - - [Subprocess] - - [File manipulation] - - [Direct call (in controller)] - - [Performances monitoring](doc/cookbooks/performances_monitoring.md) - - [Memory usage analysis](doc/cookbooks/memory_usage_graph.md) -- Reference - - [Process definition](doc/reference/01-process_definition.md) - - [Task definition](doc/reference/02-task_definition.md) - - Basic and debug - - [ConstantOutputTask](doc/reference/tasks/constant_output_task.md) - - [ConstantIterableOutputTask](doc/reference/tasks/constant_iterable_output_task.md) - - [CounterTask] - - [DebugTask](doc/reference/tasks/debug_task.md) - - [DieTask](doc/reference/tasks/die_task.md) - - [DummyTask](doc/reference/tasks/dummy_task.md) - - [ErrorForwarderTask] - - [EventDispatcherTask](doc/reference/tasks/event_dispatcher_task.md) - - [MemInfoDumpTask] - - [StopwatchTask] - - Data manipulation and transformations - - [DenormalizerTask](doc/reference/tasks/denormalizer_task.md) - - [NormalizerTask](doc/reference/tasks/normalizer_task.md) - - [DeserializerTask] - - [SerializerTask] - - [PropertyGetterTask](doc/reference/tasks/property_getter_task.md) - - [PropertySetterTask](doc/reference/tasks/property_setter_task.md) - - [ObjectUpdaterTask] - - [SplitJoinLineTask] - - [TransformerTask](doc/reference/tasks/transformer_task.md) - - [ValidatorTask] - - File/CSV - - [CsvReaderTask](doc/reference/tasks/csv_reader_task.md) - - [CsvWriterTask](doc/reference/tasks/csv_writer_task.md) - - [CSVSplitterTask] - - [InputCsvReaderTask] - - File/JsonStream - - [JsonStreamReaderTask] - - File/XML - - [XmlReaderTask](doc/reference/tasks/xml_reader_task.md) - - [XmlWriterTask](doc/reference/tasks/xml_writer_task.md) - - File/Yaml - - [YamlReaderTask] - - [YamlWriterTask] - - File - - [FileMoverTask] - - [FileReaderTask] - - [FileRemoverTask] - - [FileWriterTask] - - [FolderBrowserTask] - - [InputFolderBrowserTask] - - Flow manipulation - - [AggregateIterableTask](doc/reference/tasks/aggregate_iterable_task.md) - - [InputAggregatorTask](doc/reference/tasks/input_aggregator_task.md) - - [InputIteratorTask](doc/reference/tasks/input_iterator_task.md) - - [ArrayMergeTask] - - [ColumnAggregatorTask] - - [RowAggregatorTask] - - [FilterTask] - - [GroupByAggregateIterableTask] - - [SimpleBatchTask] - - [IterableBatchTask] - - [SkipEmptyTask] - - [StopTask] - - Process - - [CommandRunnerTask] - - [ProcessExecutorTask] - - [ProcessLauncherTask] - - Reporting - - [AdvancedStatCounterTask] - - [LoggerTask] - - [StatCounterTask] - - Transformers - - Basic and debug - - [CachedTransformer] - - [CallbackTransformer] - - [CastTransformer] - - [ConstantTransformer] - - [ConvertValueTransformer] - - [DebugTransformer] - - [DefaultTransformer] - - [GenericTransformer] - - [EvaluatorTransformer] - - [ExpressionLanguageMapTransformer] - - [MappingTransformer](doc/reference/transformers/mapping_transformer.md) - - [MultiReplaceTransformer] - - [PregFilterTransformer] - - [RulesTransformer](doc/reference/transformers/rules_transformer.md) - - [TypeSetterTransformer] - - [UnsetTransformer] - - [WrapperTransformer] - - Array - - [ArrayElementTransformer] - - [ArrayFilterTransformer](doc/reference/transformers/array_filter_transformer.md) - - [ArrayFirstTransformer] - - [ArrayLastTransformer] - - [ArrayMapTransformer] - - [ArrayUnsetTransformer] - - Date - - [DateFormatTransformer](doc/reference/transformers/date_format.md) - - [DateParserTransformer](doc/reference/transformers/date_parser.md) - - Object - - [InstantiateTransformer] - - [PropertyAccessorTransformer] - - [RecursivePropertySetterTransformer] - - Serialization - - [DenormalizeTransformer] - - [NormalizeTransformer] - - String - - [ExplodeTransformer] - - [HashTransformer] - - [ImplodeTransformer] - - [SlugifyTransformer] - - [SprintfTransformer] - - [TrimTransformer] - - XML - - [XpathEvaluatorTransformer](doc/reference/transformers/xpath_evaluator.md) - - Other bridges - - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) - - [Eav](https://github.com/cleverage/eav-process-bundle) - - [Soap](https://github.com/cleverage/soap-process-bundle) - - [Another Soap](https://github.com/cleverage/process-soap-bundle) - - [Rest](https://github.com/cleverage/rest-process-bundle) - - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) - - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) - - [Cache](https://github.com/cleverage/cache-process-bundle) - - [Generic transformers definition](doc/reference/03-generic_transformers_definition.md) -- [UI](https://github.com/cleverage/processuibundle) +For usage documentation, see: +[docs/index.md](doc/index.md) ## Support & Contribution diff --git a/docs/01-quick_start.md b/docs/01-quick_start.md index 0bab2f4f..efcc83c7 100644 --- a/docs/01-quick_start.md +++ b/docs/01-quick_start.md @@ -20,13 +20,16 @@ The most common example is the ETL. It's a kind of application whose main purpos ## Installation -This bundle requires Symfony 6.3 minimum. You can install it using composer: +Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) +of the Composer documentation. + +Open a command console, enter your project directory and install it using composer: ```bash composer require cleverage/process-bundle ``` -Remember to add the following line to bundles.php (not required if Symfony Flex is used) +Remember to add the following line to config/bundles.php (not required if Symfony Flex is used) ```php CleverAge\ProcessBundle\CleverAgeProcessBundle::class => ['all' => true], @@ -97,11 +100,11 @@ Then you can add tasks in this array. They consist of a `service`, optionally co ``` Below you can see a minimal working ETL example. It consist of 3 tasks: -- the first *extract* some data (the [constant output task](./reference/tasks/constant_output_task.md) outputs... a constant value): it's an array with 3 +- the first *extract* some data (the [constant output task](reference/tasks/constant_output_task.md) outputs... a constant value): it's an array with 3 keys/values -- the second *transform* the given value (the [transformer task](./reference/tasks/transformer_task.md) is one of the most important!): the output is then an +- the second *transform* the given value (the [transformer task](reference/tasks/transformer_task.md) is one of the most important!): the output is then an array with 2 keys/values, created using the value from previous task -- finally, the last will just display the result (it's a cheap *load*, using the [debug task](./reference/tasks/debug_task.md), only for development +- finally, the last will just display the result (it's a cheap *load*, using the [debug task](reference/tasks/debug_task.md), only for development purpose!) ```yaml @@ -193,4 +196,4 @@ Once everything is working fine, you may want to automate your processes. The st To check if everything went fine, logs are stored in database: - `clever_process_history`: logs process started, with `process_code`, `start_date`, `end_date` and `statut` -- `clever_task_history`: logs custom tasks logs (see [logging]()), with `task_code`, `message`, `logged_at` date, `level`, a `reference` and `context` +- `clever_task_history`: logs custom tasks logs (see [logging]), with `task_code`, `message`, `logged_at` date, `level`, a `reference` and `context` diff --git a/docs/02-task_types.md b/docs/02-task_types.md index 9ebfd21e..6639f027 100644 --- a/docs/02-task_types.md +++ b/docs/02-task_types.md @@ -81,7 +81,7 @@ Transformers are a special subset of this bundle. They're not tasks strictly spe point for Transformers is the `CleverAge\ProcessBundle\Task\TransformerTask`, whose only purpose is to take some input, pass it to a transformer and transfer the output to next task. -The idea is to allow a great flexibility (especially using the [MappingTransformer]()), without using too much code. +The idea is to allow a great flexibility (especially using the [MappingTransformer]), without using too much code. They implement `CleverAge\ProcessBundle\Transformer\TransformerInterface` or `CleverAge\ProcessBundle\Transformer\ConfigurableTransformerInterface`. diff --git a/docs/03-custom_tasks.md b/docs/03-custom_tasks.md index b6bc6372..607ac3b0 100644 --- a/docs/03-custom_tasks.md +++ b/docs/03-custom_tasks.md @@ -25,11 +25,11 @@ method will be called and the `$state` will contain a new input (`ProcessState:: may pass a new output to the next task (`ProcessState::setOutput`). The State also provide reporting tools: -* `ProcessState::log`: register a new log message (see[logging]()) +* `ProcessState::log`: register a new log message (see[logging]) * `ProcessState::getConsoleOutput`: direct link to Symfony's Console Output (deprecated, prefer log) Sometimes, when you execute a task, you need to change how the process may continue. It will be detailed in depth in -the [next chapter about error management]() but here are the main methods +the [next chapter about error management] but here are the main methods * `ProcessState::setSkipped`: process won't continue to next step * `ProcessState::setStopped`: process will fully stop * `ProcessState::setErrorOutput`: allow to direct an output to an error branch from your workflow @@ -50,14 +50,14 @@ Defining your tasks as Iterable or Blocking is as simple as implementing one of * `CleverAge\ProcessBundle\Model\IterableTaskInterface`: the `next` method should behave almost the same as PHP's native [next](https://secure.php.net/manual/en/function.next.php) function for arrays (except it only returns a boolean) * `CleverAge\ProcessBundle\Model\BlockingTaskInterface`: every `execute` method call should only accumulate data from -the input and once every previous task is _resolved_, the `proceed` method should provide an output (see [TODO]() for +the input and once every previous task is _resolved_, the `proceed` method should provide an output (see [TODO] for the exact definition of a resolved method) It's up to you to know when you should be using one of those, but basically: * When you loop over a collection of independent elements, you should use an Iterable task. It may help you reduce the memory footprint. * When you need to collect, upload, ... data as a whole, then you might need a Blocking task. Be sure to read [previous -chapter's notice]() about performance. +chapter's notice] about performance. Tasks cannot be both Iterable and Blocking. diff --git a/docs/index.md b/docs/index.md index e69de29b..7e268214 100644 --- a/docs/index.md +++ b/docs/index.md @@ -0,0 +1,140 @@ +## Documentation + +- [Quick start](01-quick_start.md) +- [Task types](02-task_types.md) +- [Custom tasks and development](03-custom_tasks.md) +- [Advanced workflow](04-advanced_workflow.md) +- Cookbooks + - [Common Setup](cookbooks/01-common_setup.md) + - [Transformations] + - [Flow manipulation] + - [Dummy tasks] + - [Debugging] + - [Logging] + - [Subprocess] + - [File manipulation] + - [Direct call (in controller)] + - [Performances monitoring](cookbooks/performances_monitoring.md) + - [Memory usage analysis](cookbooks/memory_usage_graph.md) +- Reference + - [Process definition](reference/01-process_definition.md) + - [Task definition](reference/02-task_definition.md) + - Basic and debug + - [ConstantOutputTask](reference/tasks/constant_output_task.md) + - [ConstantIterableOutputTask](reference/tasks/constant_iterable_output_task.md) + - [CounterTask] + - [DebugTask](reference/tasks/debug_task.md) + - [DieTask](reference/tasks/die_task.md) + - [DummyTask](reference/tasks/dummy_task.md) + - [ErrorForwarderTask] + - [EventDispatcherTask](reference/tasks/event_dispatcher_task.md) + - [MemInfoDumpTask] + - [StopwatchTask] + - Data manipulation and transformations + - [DenormalizerTask](reference/tasks/denormalizer_task.md) + - [NormalizerTask](reference/tasks/normalizer_task.md) + - [DeserializerTask] + - [SerializerTask] + - [PropertyGetterTask](reference/tasks/property_getter_task.md) + - [PropertySetterTask](reference/tasks/property_setter_task.md) + - [ObjectUpdaterTask] + - [SplitJoinLineTask] + - [TransformerTask](reference/tasks/transformer_task.md) + - [ValidatorTask] + - File/CSV + - [CsvReaderTask](reference/tasks/csv_reader_task.md) + - [CsvWriterTask](reference/tasks/csv_writer_task.md) + - [CSVSplitterTask] + - [InputCsvReaderTask] + - File/JsonStream + - [JsonStreamReaderTask] + - File/XML + - [XmlReaderTask](reference/tasks/xml_reader_task.md) + - [XmlWriterTask](reference/tasks/xml_writer_task.md) + - File/Yaml + - [YamlReaderTask] + - [YamlWriterTask] + - File + - [FileMoverTask] + - [FileReaderTask] + - [FileRemoverTask] + - [FileWriterTask] + - [FolderBrowserTask] + - [InputFolderBrowserTask] + - Flow manipulation + - [AggregateIterableTask](reference/tasks/aggregate_iterable_task.md) + - [InputAggregatorTask](reference/tasks/input_aggregator_task.md) + - [InputIteratorTask](reference/tasks/input_iterator_task.md) + - [ArrayMergeTask] + - [ColumnAggregatorTask] + - [RowAggregatorTask] + - [FilterTask] + - [GroupByAggregateIterableTask] + - [SimpleBatchTask] + - [IterableBatchTask] + - [SkipEmptyTask] + - [StopTask] + - Process + - [CommandRunnerTask] + - [ProcessExecutorTask] + - [ProcessLauncherTask] + - Reporting + - [AdvancedStatCounterTask] + - [LoggerTask] + - [StatCounterTask] + - Transformers + - Basic and debug + - [CachedTransformer] + - [CallbackTransformer] + - [CastTransformer] + - [ConstantTransformer] + - [ConvertValueTransformer] + - [DebugTransformer] + - [DefaultTransformer] + - [GenericTransformer] + - [EvaluatorTransformer] + - [ExpressionLanguageMapTransformer] + - [MappingTransformer](reference/transformers/mapping_transformer.md) + - [MultiReplaceTransformer] + - [PregFilterTransformer] + - [RulesTransformer](reference/transformers/rules_transformer.md) + - [TypeSetterTransformer] + - [UnsetTransformer] + - [WrapperTransformer] + - Array + - [ArrayElementTransformer] + - [ArrayFilterTransformer](reference/transformers/array_filter_transformer.md) + - [ArrayFirstTransformer] + - [ArrayLastTransformer] + - [ArrayMapTransformer] + - [ArrayUnsetTransformer] + - Date + - [DateFormatTransformer](reference/transformers/date_format.md) + - [DateParserTransformer](reference/transformers/date_parser.md) + - Object + - [InstantiateTransformer] + - [PropertyAccessorTransformer] + - [RecursivePropertySetterTransformer] + - Serialization + - [DenormalizeTransformer] + - [NormalizeTransformer] + - String + - [ExplodeTransformer] + - [HashTransformer] + - [ImplodeTransformer] + - [SlugifyTransformer] + - [SprintfTransformer] + - [TrimTransformer] + - XML + - [XpathEvaluatorTransformer](reference/transformers/xpath_evaluator.md) + - Other bridges + - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) + - [Eav](https://github.com/cleverage/eav-process-bundle) + - [Soap](https://github.com/cleverage/soap-process-bundle) + - [Another Soap](https://github.com/cleverage/process-soap-bundle) + - [Rest](https://github.com/cleverage/rest-process-bundle) + - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) + - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) + - [Cache](https://github.com/cleverage/cache-process-bundle) + - [Generic transformers definition](reference/03-generic_transformers_definition.md) +- [UI](https://github.com/cleverage/processuibundle) diff --git a/docs/reference/03-generic_transformers_definition.md b/docs/reference/03-generic_transformers_definition.md index 68b40ca1..9615761c 100644 --- a/docs/reference/03-generic_transformers_definition.md +++ b/docs/reference/03-generic_transformers_definition.md @@ -27,6 +27,6 @@ For each contextual option, you can define | `default` | `any` | | `null` | If not `null`, define the default value | | `default_is_null` | `bool` | | `false` | If you need `null` to be the default value, use this option | -The transformer options are the same than any other transformer using a sub-list of transformers (see [TransformerTrait](../traits/transformer_trait.md)). +The transformer options are the same than any other transformer using a sub-list of transformers (see [TransformerTrait](traits/transformer_trait.md)). You can use the syntax for contextual values (`{{ contextual_option_code }}`) to put placeholders that will be filled by those contextual options. From 719c9ee19522b71862b96af3d1876076ae55c47b Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 10:36:02 +0200 Subject: [PATCH 19/41] #148 Update services (step 1) according to Symfony best practices --- config/services/command.yaml | 32 +++++++++++++---- config/services/event.yaml | 3 +- config/services/expression_language.yaml | 7 ++-- config/services/logger.yaml | 35 +++++++++++++------ config/services/manager.yaml | 14 +++++--- config/services/registry.yaml | 7 ++-- config/services/task.yaml | 8 ++++- config/services/transformer.yaml | 11 +++--- .../CleverAgeProcessExtension.php | 2 +- 9 files changed, 87 insertions(+), 32 deletions(-) diff --git a/config/services/command.yaml b/config/services/command.yaml index 4c700e2f..58bd6e7c 100644 --- a/config/services/command.yaml +++ b/config/services/command.yaml @@ -1,7 +1,27 @@ services: - CleverAge\ProcessBundle\Command\: - resource: '../../../Command/*' - autowire: true - autoconfigure: true - bind: - $container: '@service_container' + cleverage_process.command.execute_process: + class: CleverAge\ProcessBundle\Command\ExecuteProcessCommand + public: false + tags: + - { name: console.command } + arguments: + - '@process_bundle.manager.process' + - '@event_dispatcher' + - '@process_bundle.registry.process_configuration' + + cleverage_process.command.list_process: + class: CleverAge\ProcessBundle\Command\ListProcessCommand + public: false + tags: + - { name: console.command } + arguments: + - '@process_bundle.registry.process_configuration' + + cleverage_process.command.process_help: + class: CleverAge\ProcessBundle\Command\ProcessHelpCommand + public: false + tags: + - { name: console.command } + arguments: + - '@process_bundle.registry.process_configuration' + - '@service_container' diff --git a/config/services/event.yaml b/config/services/event.yaml index f4a5bb70..8bb1ae18 100644 --- a/config/services/event.yaml +++ b/config/services/event.yaml @@ -1,5 +1,6 @@ services: - CleverAge\ProcessBundle\EventListener\DataQueueEventListener: + cleverage_process.event_listener.data_queue: + class: CleverAge\ProcessBundle\EventListener\DataQueueEventListener public: false tags: - { name: kernel.event_listener, event: cleverage_process.data_queue, method: pushData } diff --git a/config/services/expression_language.yaml b/config/services/expression_language.yaml index 63a47a74..125d3312 100644 --- a/config/services/expression_language.yaml +++ b/config/services/expression_language.yaml @@ -1,9 +1,12 @@ services: - CleverAge\ProcessBundle\ExpressionLanguage\PhpFunctionProvider: + cleverage_process.expression_language.php_function_provider: + class: CleverAge\ProcessBundle\ExpressionLanguage\PhpFunctionProvider + public: false arguments: - [ 'preg_match' ] cleverage_process.expression_language: class: Symfony\Component\ExpressionLanguage\ExpressionLanguage + public: false calls: - - ['registerProvider', ['@CleverAge\ProcessBundle\ExpressionLanguage\PhpFunctionProvider']] + - ['registerProvider', ['@cleverage_process.expression_language.php_function_provider']] diff --git a/config/services/logger.yaml b/config/services/logger.yaml index 1968bd79..b0ea1fbd 100644 --- a/config/services/logger.yaml +++ b/config/services/logger.yaml @@ -1,25 +1,40 @@ services: - CleverAge\ProcessBundle\Logger\ProcessProcessor: - autowire: true + cleverage_process.logger.process_processor: + class: CleverAge\ProcessBundle\Logger\ProcessProcessor + public: false tags: - { name: monolog.processor, channel: cleverage_process } + arguments: + - '@process_bundle.manager.process' - CleverAge\ProcessBundle\Logger\TaskProcessor: - autowire: true + cleverage_process.logger.task_processor: + class: CleverAge\ProcessBundle\Logger\TaskProcessor + public: false tags: - { name: monolog.processor, channel: cleverage_process_task } + arguments: + - '@process_bundle.manager.process' - CleverAge\ProcessBundle\Logger\TransformerProcessor: - autowire: true + cleverage_process.logger.transformer_processor: + class: CleverAge\ProcessBundle\Logger\TransformerProcessor + public: false tags: - { name: monolog.processor, channel: cleverage_process_transformer } + arguments: + - '@process_bundle.manager.process' - CleverAge\ProcessBundle\Logger\ProcessLogger: - autowire: true + cleverage_process.logger.process_logger: + class: CleverAge\ProcessBundle\Logger\ProcessLogger + public: false tags: - { name: monolog.logger, channel: cleverage_process } + arguments: + - '@monolog.logger' - CleverAge\ProcessBundle\Logger\TaskLogger: - autowire: true + cleverage_process.logger.task_logger: + class: CleverAge\ProcessBundle\Logger\TaskLogger + public: false tags: - { name: monolog.logger, channel: cleverage_process_task } + arguments: + - '@monolog.logger' diff --git a/config/services/manager.yaml b/config/services/manager.yaml index a4360642..ff8ee350 100644 --- a/config/services/manager.yaml +++ b/config/services/manager.yaml @@ -1,9 +1,15 @@ services: - CleverAge\ProcessBundle\Manager\ProcessManager: - autowire: true + process_bundle.manager.process: + class: CleverAge\ProcessBundle\Manager\ProcessManager public: false arguments: - $container: '@service_container' + - '@service_container' + - '@cleverage_process.logger.process_logger' + - '@cleverage_process.logger.task_logger' + - '@process_bundle.registry.process_configuration' + - '@process_bundle.context.contextual_option_resolver' + - '@event_dispatcher' - CleverAge\ProcessBundle\Context\ContextualOptionResolver: + process_bundle.context.contextual_option_resolver: + class: CleverAge\ProcessBundle\Context\ContextualOptionResolver public: false diff --git a/config/services/registry.yaml b/config/services/registry.yaml index 7e0ec1aa..852631f4 100644 --- a/config/services/registry.yaml +++ b/config/services/registry.yaml @@ -1,8 +1,11 @@ services: - CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry: + process_bundle.registry.process_configuration: + class: CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry + public: false arguments: - ~ - ~ - CleverAge\ProcessBundle\Registry\TransformerRegistry: + process_bundle.registry.transformer: + class: CleverAge\ProcessBundle\Registry\TransformerRegistry public: false diff --git a/config/services/task.yaml b/config/services/task.yaml index 61e64bf7..7c9ba30b 100644 --- a/config/services/task.yaml +++ b/config/services/task.yaml @@ -1,6 +1,12 @@ services: + _defaults: + bind: + $processManager: '@process_bundle.manager.process' + $processRegistry: '@process_bundle.registry.process_configuration' + $transformerRegistry: '@process_bundle.registry.transformer' + CleverAge\ProcessBundle\Task\: - resource: '../../../Task/*' + resource: '../../src/Task/*' autowire: true public: true shared: false diff --git a/config/services/transformer.yaml b/config/services/transformer.yaml index 63741e56..cd5cfeab 100644 --- a/config/services/transformer.yaml +++ b/config/services/transformer.yaml @@ -1,14 +1,15 @@ services: _defaults: - autowire: true - autoconfigure: true - public: true bind: $language: '@cleverage_process.expression_language' + $transformerRegistry: '@process_bundle.registry.transformer' CleverAge\ProcessBundle\Transformer\: - resource: '../../../Transformer/*' - exclude: '../../../Transformer/GenericTransformer.php' + resource: '../../src/Transformer/*' + exclude: '../../src/Transformer/GenericTransformer.php' + autowire: true + autoconfigure: true + public: true tags: - { name: cleverage.transformer } - { name: monolog.logger, channel: cleverage_process_transformer } diff --git a/src/DependencyInjection/CleverAgeProcessExtension.php b/src/DependencyInjection/CleverAgeProcessExtension.php index 5c8db1a2..ceaf264c 100644 --- a/src/DependencyInjection/CleverAgeProcessExtension.php +++ b/src/DependencyInjection/CleverAgeProcessExtension.php @@ -37,7 +37,7 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $processConfigurationRegistry = $container->getDefinition(ProcessConfigurationRegistry::class); + $processConfigurationRegistry = $container->getDefinition('process_bundle.registry.process_configuration'); $processConfigurationRegistry->replaceArgument(0, $config['configurations']); $processConfigurationRegistry->replaceArgument(1, $config['default_error_strategy']); From f1d7670fc15bc211134076aaa4c712e8193212de Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 11:27:52 +0200 Subject: [PATCH 20/41] #147 Add missing dependency on "symfony/dotenv": "^6.4|^7.1" and symfony/runtime "^6.4|^7.1" --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3a00935f..7b1f9208 100644 --- a/composer.json +++ b/composer.json @@ -49,14 +49,15 @@ }, "require": { "php": ">=8.1", - "ext-json": "*", "ext-dom": "*", "ext-intl": "*", + "ext-json": "*", "ext-mbstring": "*", "psr/cache": "^1|^2|^3", "symfony/config": "^6.4|^7.1", "symfony/console": "^6.4|^7.1", "symfony/dependency-injection": "^6.4|^7.1", + "symfony/dotenv": "^6.4|^7.1", "symfony/event-dispatcher-contracts": "^3", "symfony/expression-language": "^6.4|^7.1", "symfony/form": "^6.4|^7.1", @@ -66,6 +67,7 @@ "symfony/options-resolver": "^6.4|^7.1", "symfony/process": "^6.4|^7.1", "symfony/property-access": "^6.4|^7.1", + "symfony/runtime": "^6.4|^7.1", "symfony/scheduler": "^6.4|^7.1", "symfony/serializer": "^6.4|^7.1", "symfony/stopwatch": "^6.4|^7.1", From dea1befded371a51de732638a938699d30aa6c85 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 17:09:51 +0200 Subject: [PATCH 21/41] #147 Replace `Symfony\Component\Form\Exception\InvalidConfigurationException` by `Symfony\Component\Config\Definition\Exception\InvalidConfigurationException` --- src/Task/Process/ProcessExecutorTask.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Task/Process/ProcessExecutorTask.php b/src/Task/Process/ProcessExecutorTask.php index 12d3789b..6b27a171 100644 --- a/src/Task/Process/ProcessExecutorTask.php +++ b/src/Task/Process/ProcessExecutorTask.php @@ -18,7 +18,7 @@ use CleverAge\ProcessBundle\Model\ProcessState; use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; use Psr\Log\LoggerInterface; -use Symfony\Component\Form\Exception\InvalidConfigurationException; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; From 45903b0e9578902533bec2caa0ccfe12b20c177c Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 17:10:18 +0200 Subject: [PATCH 22/41] #147 Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` --- CHANGELOG.md | 2 ++ composer.json | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc6049b3..7a0129f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v4.0 * [#142](https://github.com/cleverage/process-bundle/issues/142) DateFormatTransformer & DateParserTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Date` * [#142](https://github.com/cleverage/process-bundle/issues/142) ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` * [#142](https://github.com/cleverage/process-bundle/issues/142) InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` +* [#147](https://github.com/cleverage/process-bundle/issues/147) Replace `Symfony\Component\Form\Exception\InvalidConfigurationException` by `Symfony\Component\Config\Definition\Exception\InvalidConfigurationException` ### Changes @@ -17,6 +18,7 @@ v4.0 * [#139](https://github.com/cleverage/process-bundle/issues/139Update) Update rector, phpstan & php-cs-fixer configurations & apply it * [#141](https://github.com/cleverage/process-bundle/issues/141) `league/flysystem-bundle` is not required anymore * [#130](https://github.com/cleverage/process-bundle/issues/130) EventDispatcherInterface service declaration breaks dependency injection +* [#147](https://github.com/cleverage/process-bundle/issues/147) Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` ### Fixes diff --git a/composer.json b/composer.json index 7b1f9208..a7db03cb 100644 --- a/composer.json +++ b/composer.json @@ -60,15 +60,12 @@ "symfony/dotenv": "^6.4|^7.1", "symfony/event-dispatcher-contracts": "^3", "symfony/expression-language": "^6.4|^7.1", - "symfony/form": "^6.4|^7.1", "symfony/framework-bundle": "^6.4|^7.1", - "symfony/messenger": "^6.4|^7.1", "symfony/monolog-bundle": "~3.3", "symfony/options-resolver": "^6.4|^7.1", "symfony/process": "^6.4|^7.1", "symfony/property-access": "^6.4|^7.1", "symfony/runtime": "^6.4|^7.1", - "symfony/scheduler": "^6.4|^7.1", "symfony/serializer": "^6.4|^7.1", "symfony/stopwatch": "^6.4|^7.1", "symfony/validator": "^6.4|^7.1", From 7722734ce64d96c38569be1af31eed67431223bd Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 17:22:22 +0200 Subject: [PATCH 23/41] #148 Fix services prefix using cleverage_process instead of process_bundle --- CHANGELOG.md | 4 +++- config/services/command.yaml | 8 ++++---- config/services/logger.yaml | 6 +++--- config/services/manager.yaml | 8 ++++---- config/services/registry.yaml | 4 ++-- config/services/task.yaml | 6 +++--- config/services/transformer.yaml | 2 +- src/DependencyInjection/CleverAgeProcessExtension.php | 3 +-- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0129f9..86cb5d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,13 +11,15 @@ v4.0 * [#142](https://github.com/cleverage/process-bundle/issues/142) ExplodeTransformer, HashTransformer, ImplodeTransformer, SlugifyTransformer, SprintfTransformer & TrimTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\String` * [#142](https://github.com/cleverage/process-bundle/issues/142) InstantiateTransformer, PropertyAccessorTransformer RecursivePropertySetterTransformer namespaces changed to `CleverAge\ProcessBundle\Transformer\Object` * [#147](https://github.com/cleverage/process-bundle/issues/147) Replace `Symfony\Component\Form\Exception\InvalidConfigurationException` by `Symfony\Component\Config\Definition\Exception\InvalidConfigurationException` - +* [#148](https://github.com/cleverage/process-bundle/issues/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` ### Changes * [#139](https://github.com/cleverage/process-bundle/issues/139Update) Makefile & .docker for local standalone usage * [#139](https://github.com/cleverage/process-bundle/issues/139Update) Update rector, phpstan & php-cs-fixer configurations & apply it * [#141](https://github.com/cleverage/process-bundle/issues/141) `league/flysystem-bundle` is not required anymore * [#130](https://github.com/cleverage/process-bundle/issues/130) EventDispatcherInterface service declaration breaks dependency injection +* [#147](https://github.com/cleverage/process-bundle/issues/147) Add missing dependencies on `symfony/dotenv` and `symfony/runtime` * [#147](https://github.com/cleverage/process-bundle/issues/147) Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` ### Fixes diff --git a/config/services/command.yaml b/config/services/command.yaml index 58bd6e7c..947bce64 100644 --- a/config/services/command.yaml +++ b/config/services/command.yaml @@ -5,9 +5,9 @@ services: tags: - { name: console.command } arguments: - - '@process_bundle.manager.process' + - '@cleverage_process.manager.process' - '@event_dispatcher' - - '@process_bundle.registry.process_configuration' + - '@cleverage_process.registry.process_configuration' cleverage_process.command.list_process: class: CleverAge\ProcessBundle\Command\ListProcessCommand @@ -15,7 +15,7 @@ services: tags: - { name: console.command } arguments: - - '@process_bundle.registry.process_configuration' + - '@cleverage_process.registry.process_configuration' cleverage_process.command.process_help: class: CleverAge\ProcessBundle\Command\ProcessHelpCommand @@ -23,5 +23,5 @@ services: tags: - { name: console.command } arguments: - - '@process_bundle.registry.process_configuration' + - '@cleverage_process.registry.process_configuration' - '@service_container' diff --git a/config/services/logger.yaml b/config/services/logger.yaml index b0ea1fbd..6925dd67 100644 --- a/config/services/logger.yaml +++ b/config/services/logger.yaml @@ -5,7 +5,7 @@ services: tags: - { name: monolog.processor, channel: cleverage_process } arguments: - - '@process_bundle.manager.process' + - '@cleverage_process.manager.process' cleverage_process.logger.task_processor: class: CleverAge\ProcessBundle\Logger\TaskProcessor @@ -13,7 +13,7 @@ services: tags: - { name: monolog.processor, channel: cleverage_process_task } arguments: - - '@process_bundle.manager.process' + - '@cleverage_process.manager.process' cleverage_process.logger.transformer_processor: class: CleverAge\ProcessBundle\Logger\TransformerProcessor @@ -21,7 +21,7 @@ services: tags: - { name: monolog.processor, channel: cleverage_process_transformer } arguments: - - '@process_bundle.manager.process' + - '@cleverage_process.manager.process' cleverage_process.logger.process_logger: class: CleverAge\ProcessBundle\Logger\ProcessLogger diff --git a/config/services/manager.yaml b/config/services/manager.yaml index ff8ee350..396d7d9f 100644 --- a/config/services/manager.yaml +++ b/config/services/manager.yaml @@ -1,15 +1,15 @@ services: - process_bundle.manager.process: + cleverage_process.manager.process: class: CleverAge\ProcessBundle\Manager\ProcessManager public: false arguments: - '@service_container' - '@cleverage_process.logger.process_logger' - '@cleverage_process.logger.task_logger' - - '@process_bundle.registry.process_configuration' - - '@process_bundle.context.contextual_option_resolver' + - '@cleverage_process.registry.process_configuration' + - '@cleverage_process.context.contextual_option_resolver' - '@event_dispatcher' - process_bundle.context.contextual_option_resolver: + cleverage_process.context.contextual_option_resolver: class: CleverAge\ProcessBundle\Context\ContextualOptionResolver public: false diff --git a/config/services/registry.yaml b/config/services/registry.yaml index 852631f4..48d5e469 100644 --- a/config/services/registry.yaml +++ b/config/services/registry.yaml @@ -1,11 +1,11 @@ services: - process_bundle.registry.process_configuration: + cleverage_process.registry.process_configuration: class: CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry public: false arguments: - ~ - ~ - process_bundle.registry.transformer: + cleverage_process.registry.transformer: class: CleverAge\ProcessBundle\Registry\TransformerRegistry public: false diff --git a/config/services/task.yaml b/config/services/task.yaml index 7c9ba30b..9fb96b4e 100644 --- a/config/services/task.yaml +++ b/config/services/task.yaml @@ -1,9 +1,9 @@ services: _defaults: bind: - $processManager: '@process_bundle.manager.process' - $processRegistry: '@process_bundle.registry.process_configuration' - $transformerRegistry: '@process_bundle.registry.transformer' + $processManager: '@cleverage_process.manager.process' + $processRegistry: '@cleverage_process.registry.process_configuration' + $transformerRegistry: '@cleverage_process.registry.transformer' CleverAge\ProcessBundle\Task\: resource: '../../src/Task/*' diff --git a/config/services/transformer.yaml b/config/services/transformer.yaml index cd5cfeab..6d2c40ee 100644 --- a/config/services/transformer.yaml +++ b/config/services/transformer.yaml @@ -2,7 +2,7 @@ services: _defaults: bind: $language: '@cleverage_process.expression_language' - $transformerRegistry: '@process_bundle.registry.transformer' + $transformerRegistry: '@cleverage_process.registry.transformer' CleverAge\ProcessBundle\Transformer\: resource: '../../src/Transformer/*' diff --git a/src/DependencyInjection/CleverAgeProcessExtension.php b/src/DependencyInjection/CleverAgeProcessExtension.php index ceaf264c..0dc1c6b8 100644 --- a/src/DependencyInjection/CleverAgeProcessExtension.php +++ b/src/DependencyInjection/CleverAgeProcessExtension.php @@ -13,7 +13,6 @@ namespace CleverAge\ProcessBundle\DependencyInjection; -use CleverAge\ProcessBundle\Registry\ProcessConfigurationRegistry; use CleverAge\ProcessBundle\Transformer\GenericTransformer; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -37,7 +36,7 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $processConfigurationRegistry = $container->getDefinition('process_bundle.registry.process_configuration'); + $processConfigurationRegistry = $container->getDefinition('cleverage_process.registry.process_configuration'); $processConfigurationRegistry->replaceArgument(0, $config['configurations']); $processConfigurationRegistry->replaceArgument(1, $config['default_error_strategy']); From 0b40728cbf09f4ce9aed02f3e3bc29b6726ad8e4 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 22 Oct 2024 17:42:02 +0200 Subject: [PATCH 24/41] #146 eav-process-bundle, enqueue-process-bundle, cache-process-bundle and process-soap-bundle were deprecated / archived. --- CHANGELOG.md | 3 ++- composer.json | 4 ---- docs/04-advanced_workflow.md | 1 - docs/index.md | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cb5d64..6dc29371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ Services must be prefixed with the bundle alias instead of using fully qualified * [#141](https://github.com/cleverage/process-bundle/issues/141) `league/flysystem-bundle` is not required anymore * [#130](https://github.com/cleverage/process-bundle/issues/130) EventDispatcherInterface service declaration breaks dependency injection * [#147](https://github.com/cleverage/process-bundle/issues/147) Add missing dependencies on `symfony/dotenv` and `symfony/runtime` -* [#147](https://github.com/cleverage/process-bundle/issues/147) Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` +* [#147](https://github.com/cleverage/process-bundle/issues/147) Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` +* [#146](https://github.com/cleverage/process-bundle/issues/146) eav-process-bundle, enqueue-process-bundle, cache-process-bundle and process-soap-bundle were deprecated / archived. ### Fixes diff --git a/composer.json b/composer.json index a7db03cb..bd93b8b0 100644 --- a/composer.json +++ b/composer.json @@ -83,13 +83,9 @@ }, "suggest": { "cleverage/doctrine-process-bundle": "Dedicated bundle for Doctrine dependencies for the process bundle", - "cleverage/eav-process-bundle": "Dedicated bundle for EAV dependencies for the process bundle", "cleverage/soap-process-bundle": "Dedicated bundle for Soap dependencies for the process bundle", - "cleverage/process-soap-bundle": "Another dedicated bundle for Soap dependencies for the process bundle", "cleverage/rest-process-bundle": "Dedicated bundle for Rest dependencies for the process bundle", - "cleverage/enqueue-process-bundle": "Manage asynchronous events within the process bundle", "cleverage/flysystem-process-bundle": "Dedicated bundle for Flysystem dependencies for the process bundle", - "cleverage/cache-process-bundle": "Dedicated bundle for cache handling for the process bundle", "cleverage/processuibundle": "A simple UX for cleverage/processbundle using EasyAdmin\n\n" }, "config": { diff --git a/docs/04-advanced_workflow.md b/docs/04-advanced_workflow.md index bef6e3f1..f31ce2a3 100644 --- a/docs/04-advanced_workflow.md +++ b/docs/04-advanced_workflow.md @@ -25,5 +25,4 @@ You can also use [EventDispatcherTask](reference/tasks/event_dispatcher_task.md) _TODO_ * ProcessLauncherTask -* EnqueueBundle * pthread diff --git a/docs/index.md b/docs/index.md index 7e268214..1f21aa64 100644 --- a/docs/index.md +++ b/docs/index.md @@ -129,12 +129,8 @@ - [XpathEvaluatorTransformer](reference/transformers/xpath_evaluator.md) - Other bridges - [Doctrine](https://github.com/cleverage/doctrine-process-bundle) - - [Eav](https://github.com/cleverage/eav-process-bundle) - [Soap](https://github.com/cleverage/soap-process-bundle) - - [Another Soap](https://github.com/cleverage/process-soap-bundle) - [Rest](https://github.com/cleverage/rest-process-bundle) - - [Enqueue](https://github.com/cleverage/enqueue-process-bundle) - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) - - [Cache](https://github.com/cleverage/cache-process-bundle) - [Generic transformers definition](reference/03-generic_transformers_definition.md) - [UI](https://github.com/cleverage/processuibundle) From 249b716fea710748c8cec14cff4bf7b50b069778 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 23 Oct 2024 10:25:03 +0200 Subject: [PATCH 25/41] Fix CONTRIBUTING test rule --- CONTRIBUTING.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6e9caaa..d5f790d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,12 +40,6 @@ make quality make tests ``` -which will execute all tests inside the docker. - -```bash -make test TEST="Tests/Util/FilenameUtilsTest.php" -``` - ## Deprecations notices When a feature should be deprecated, or when you have a breaking change for a future version, please : From 8961591f508d38013f58e59788fd34828b76273c Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 23 Oct 2024 11:15:51 +0200 Subject: [PATCH 26/41] Add missing project name on docker compose.yaml --- .docker/compose.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.docker/compose.yaml b/.docker/compose.yaml index 9c311377..bc72ae34 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -2,6 +2,8 @@ x-build-args: &build-args UID: "${UID:-1000}" GID: "${GID:-1000}" +name: cleverage-process-bundle + services: php: build: From daba33997008e0944d1ddf8f8dbbebb35bf6978a Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Wed, 23 Oct 2024 12:19:53 +0200 Subject: [PATCH 27/41] Minor fix on CHANGELOG --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc29371..8c1ac079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,8 @@ v4.0 Services must be prefixed with the bundle alias instead of using fully qualified class names => `cleverage_process` ### Changes -* [#139](https://github.com/cleverage/process-bundle/issues/139Update) Makefile & .docker for local standalone usage -* [#139](https://github.com/cleverage/process-bundle/issues/139Update) Update rector, phpstan & php-cs-fixer configurations & apply it +* [#139](https://github.com/cleverage/process-bundle/issues/139) Update Makefile & .docker for local standalone usage +* [#139](https://github.com/cleverage/process-bundle/issues/139) Update rector, phpstan & php-cs-fixer configurations & apply it * [#141](https://github.com/cleverage/process-bundle/issues/141) `league/flysystem-bundle` is not required anymore * [#130](https://github.com/cleverage/process-bundle/issues/130) EventDispatcherInterface service declaration breaks dependency injection * [#147](https://github.com/cleverage/process-bundle/issues/147) Add missing dependencies on `symfony/dotenv` and `symfony/runtime` From d14e426fbc173f080e7c2b011d309a2e87d3e272 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 24 Oct 2024 16:05:57 +0200 Subject: [PATCH 28/41] Update doc due to new ui repository --- README.md | 2 +- docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d9ec2b9b..c31dc621 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Demo project can be found on [there](https://github.com/cleverage/process-bundle ## Documentation For usage documentation, see: -[docs/index.md](doc/index.md) +[docs/index.md](docs/index.md) ## Support & Contribution diff --git a/docs/index.md b/docs/index.md index 1f21aa64..10946b54 100644 --- a/docs/index.md +++ b/docs/index.md @@ -133,4 +133,4 @@ - [Rest](https://github.com/cleverage/rest-process-bundle) - [Flysystem](https://github.com/cleverage/flysystem-process-bundle) - [Generic transformers definition](reference/03-generic_transformers_definition.md) -- [UI](https://github.com/cleverage/processuibundle) +- [UI](https://github.com/cleverage/ui-process-bundle) From d3fbee1d9f35a55f77d847024852c2a05095ee33 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 29 Oct 2024 10:37:36 +0100 Subject: [PATCH 29/41] #147 composer require symfony/monolog-bridge:"^6.4|^7.1" --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index bd93b8b0..d91bd22f 100644 --- a/composer.json +++ b/composer.json @@ -61,6 +61,7 @@ "symfony/event-dispatcher-contracts": "^3", "symfony/expression-language": "^6.4|^7.1", "symfony/framework-bundle": "^6.4|^7.1", + "symfony/monolog-bridge": "^6.4|^7.1", "symfony/monolog-bundle": "~3.3", "symfony/options-resolver": "^6.4|^7.1", "symfony/process": "^6.4|^7.1", From c0a352c8472f422d90c312f944eb57a0841d7036 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Tue, 29 Oct 2024 17:00:44 +0100 Subject: [PATCH 30/41] #139 Apply <10.0 restriction on phpunit/phpunit since configuration file is not compatible with 10.0+ --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d91bd22f..769eeb2c 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ "phpstan/extension-installer": "*", "phpstan/phpstan": "*", "phpstan/phpstan-symfony": "*", - "phpunit/phpunit": "*", + "phpunit/phpunit": "<10.0", "rector/rector": "*", "roave/security-advisories": "dev-latest", "symfony/test-pack": "^1.1" From 3901525ac111f668ab524ce6754891a013f85686 Mon Sep 17 00:00:00 2001 From: Xavier Marchegay Date: Tue, 5 Nov 2024 14:40:09 +0100 Subject: [PATCH 31/41] #141 Add a default value to the node "default_error_strategy" --- src/DependencyInjection/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index fee9cb58..a3f80a5a 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -40,7 +40,7 @@ public function getConfigTreeBuilder(): TreeBuilder // Default error strategy $definition->enumNode('default_error_strategy') ->values([TaskConfiguration::STRATEGY_SKIP, TaskConfiguration::STRATEGY_STOP]) - ->isRequired(); + ->defaultValue(TaskConfiguration::STRATEGY_STOP); $this->appendRootProcessConfigDefinition($definition); $this->appendRootTransformersConfigDefinition($definition); From 7c2329e5a9454d1f34c71c89261c2c47fd346d44 Mon Sep 17 00:00:00 2001 From: Xavier Marchegay Date: Tue, 5 Nov 2024 15:05:38 +0100 Subject: [PATCH 32/41] #150 Remove CleverAge\ProcessBundle\Task\Debug\MemInfoDumpTask --- CHANGELOG.md | 1 + docs/index.md | 1 - src/Task/Debug/MemInfoDumpTask.php | 48 ------------------------------ 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 src/Task/Debug/MemInfoDumpTask.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c1ac079..32664c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ v4.0 * [#147](https://github.com/cleverage/process-bundle/issues/147) Replace `Symfony\Component\Form\Exception\InvalidConfigurationException` by `Symfony\Component\Config\Definition\Exception\InvalidConfigurationException` * [#148](https://github.com/cleverage/process-bundle/issues/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](https://github.com/cleverage/process-bundle/issues/150) The class `\CleverAge\ProcessBundle\Task\Debug\MemInfoDumpTask` has been deleted without suggested replacement ### Changes * [#139](https://github.com/cleverage/process-bundle/issues/139) Update Makefile & .docker for local standalone usage diff --git a/docs/index.md b/docs/index.md index 10946b54..26b471b4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,7 +28,6 @@ - [DummyTask](reference/tasks/dummy_task.md) - [ErrorForwarderTask] - [EventDispatcherTask](reference/tasks/event_dispatcher_task.md) - - [MemInfoDumpTask] - [StopwatchTask] - Data manipulation and transformations - [DenormalizerTask](reference/tasks/denormalizer_task.md) diff --git a/src/Task/Debug/MemInfoDumpTask.php b/src/Task/Debug/MemInfoDumpTask.php deleted file mode 100644 index 23d4c251..00000000 --- a/src/Task/Debug/MemInfoDumpTask.php +++ /dev/null @@ -1,48 +0,0 @@ -getOption($state, 'file_path'), 'w'); - meminfo_dump($handler); - fclose($handler); - } else { - $this->logger->critical('meminfo PHP extension is not loaded'); - } - } - - protected function configureOptions(OptionsResolver $resolver): void - { - $resolver->setRequired(['file_path']); - $resolver->setAllowedTypes('file_path', ['string']); - } -} From f2586cb35ddfb41265f069a0b9193373bfb81ebb Mon Sep 17 00:00:00 2001 From: Xavier Marchegay Date: Tue, 5 Nov 2024 15:35:08 +0100 Subject: [PATCH 33/41] #145 Add documentation/examples for Basic and debug tasks --- CHANGELOG.md | 1 + docs/index.md | 6 +- docs/reference/tasks/_template.md | 5 +- .../tasks/constant_iterable_output_task.md | 25 ++++++++- docs/reference/tasks/constant_output_task.md | 32 ++++++----- docs/reference/tasks/counter_task.md | 56 +++++++++++++++++++ docs/reference/tasks/debug_task.md | 17 +++++- docs/reference/tasks/die_task.md | 9 ++- docs/reference/tasks/dummy_task.md | 31 ++++++++++ docs/reference/tasks/error_forwarder_task.md | 42 ++++++++++++++ docs/reference/tasks/event_dispatcher_task.md | 24 ++++++-- docs/reference/tasks/stopwatch_task.md | 26 +++++++++ src/Task/Debug/DebugTask.php | 2 - src/Task/Debug/DieTask.php | 4 -- src/Task/Debug/StopwatchTask.php | 2 +- 15 files changed, 245 insertions(+), 37 deletions(-) create mode 100644 docs/reference/tasks/counter_task.md create mode 100644 docs/reference/tasks/error_forwarder_task.md create mode 100644 docs/reference/tasks/stopwatch_task.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 32664c97..ea673379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Services must be prefixed with the bundle alias instead of using fully qualified * [#147](https://github.com/cleverage/process-bundle/issues/147) Add missing dependencies on `symfony/dotenv` and `symfony/runtime` * [#147](https://github.com/cleverage/process-bundle/issues/147) Remove dependencies on `symfony/form`, `symfony/messenger` & `symfony/scheduler` * [#146](https://github.com/cleverage/process-bundle/issues/146) eav-process-bundle, enqueue-process-bundle, cache-process-bundle and process-soap-bundle were deprecated / archived. +* [#141](https://github.com/cleverage/process-bundle/issues/141) Add a default value to the node "default_error_strategy" ### Fixes diff --git a/docs/index.md b/docs/index.md index 26b471b4..76de1a95 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,13 +22,13 @@ - Basic and debug - [ConstantOutputTask](reference/tasks/constant_output_task.md) - [ConstantIterableOutputTask](reference/tasks/constant_iterable_output_task.md) - - [CounterTask] + - [CounterTask](reference/tasks/counter_task.md) - [DebugTask](reference/tasks/debug_task.md) - [DieTask](reference/tasks/die_task.md) - [DummyTask](reference/tasks/dummy_task.md) - - [ErrorForwarderTask] + - [ErrorForwarderTask](reference/tasks/error_forwarder_task.md) - [EventDispatcherTask](reference/tasks/event_dispatcher_task.md) - - [StopwatchTask] + - [StopwatchTask](reference/tasks/stopwatch_task.md) - Data manipulation and transformations - [DenormalizerTask](reference/tasks/denormalizer_task.md) - [NormalizerTask](reference/tasks/normalizer_task.md) diff --git a/docs/reference/tasks/_template.md b/docs/reference/tasks/_template.md index ed1d4a57..842c5f37 100644 --- a/docs/reference/tasks/_template.md +++ b/docs/reference/tasks/_template.md @@ -20,9 +20,8 @@ _Description of possible types_ Options ------- - -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | +| Code | Type | Required | Default | Description | +|--------|--------|--------------------|--------------------------------|---------------| | `code` | `type` | **X** _or nothing_ | `default value` _if available_ | _description_ | Examples diff --git a/docs/reference/tasks/constant_iterable_output_task.md b/docs/reference/tasks/constant_iterable_output_task.md index b5cbb2b1..ba3f6410 100644 --- a/docs/reference/tasks/constant_iterable_output_task.md +++ b/docs/reference/tasks/constant_iterable_output_task.md @@ -21,7 +21,26 @@ Possible outputs Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `output` | `array` | **X** | | Array of values to iterate onto | +| Code | Type | Required | Default | Description | +|----------|---------|:--------:|---------|---------------------------------| +| `output` | `array` | **X** | | Array of values to iterate onto | +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.constant_iterable_output_example: + tasks: + constant_iterable_output_example: + service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 + outputs: [debug] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/constant_output_task.md b/docs/reference/tasks/constant_output_task.md index 3fbff205..03fd41c3 100644 --- a/docs/reference/tasks/constant_output_task.md +++ b/docs/reference/tasks/constant_output_task.md @@ -21,24 +21,26 @@ Possible outputs Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `output` | `any` | **X** | | Value to output | +| Code | Type | Required | Default | Description | +|----------|-------|:---------|---------|-----------------| +| `output` | `any` | **X** | | Value to output | Example ------- ```yaml clever_age_process: - configurations: - project_prefix.process_name: - tasks: - constant_output_example: - service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' - options: - output: - id: 123 - firstname: Test1 - lastname: Test2 - outputs: [XXXX] -``` + configurations: + project_prefix.constant_output_example: + tasks: + constant_output_example: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 + outputs: [debug] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/counter_task.md b/docs/reference/tasks/counter_task.md new file mode 100644 index 00000000..997c8af7 --- /dev/null +++ b/docs/reference/tasks/counter_task.md @@ -0,0 +1,56 @@ +CounterTask +================== + +Count the number of times the task is processed and continue every N iteration (skip the rest of the time) + +Flush at the end with the actual count. + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Task\CounterTask` + +Accepted inputs +--------------- + +`any` + +Possible outputs +---------------- + +`int`: outputs the number of times the counter is called + +Options +------- + +| Code | Type | Required | Default | Description | +|---------------|-------|----------|----------|---------------------------------------------------| +| `flush_every` | `int` | **X** | | The period at which the task will produce outputs | + +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.counter_example: + tasks: + counter_example: + service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' + options: + output: + test1: test1 + test2: test2 + test3: test3 + test4: test4 + test5: test5 + test6: test6 + outputs: [counter] + counter: + service: '@CleverAge\ProcessBundle\Task\CounterTask' + options: + flush_every: 2 + outputs: [ debug ] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/debug_task.md b/docs/reference/tasks/debug_task.md index 1a98b263..5a654089 100644 --- a/docs/reference/tasks/debug_task.md +++ b/docs/reference/tasks/debug_task.md @@ -23,4 +23,19 @@ Possible outputs Example ---------------- -https://github.com/cleverage/process-bundle-ui-demo/blob/main/config/packages/process/demo.debug.yaml \ No newline at end of file +```yaml +clever_age_process: + configurations: + project_prefix.debug_example: + tasks: + debug_example: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 + outputs: [debug] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/die_task.md b/docs/reference/tasks/die_task.md index cdde437e..24008f4d 100644 --- a/docs/reference/tasks/die_task.md +++ b/docs/reference/tasks/die_task.md @@ -22,4 +22,11 @@ None Example ---------------- -https://github.com/cleverage/process-bundle-ui-demo/blob/main/config/packages/process/demo.die.yaml \ No newline at end of file +```yaml +clever_age_process: + configurations: + project_prefix.die_example: + tasks: + die_example: + service: '@CleverAge\ProcessBundle\Task\Debug\DieTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/dummy_task.md b/docs/reference/tasks/dummy_task.md index fe8a5321..87fda52e 100644 --- a/docs/reference/tasks/dummy_task.md +++ b/docs/reference/tasks/dummy_task.md @@ -17,3 +17,34 @@ Possible outputs ---------------- `any`: re-output given input + +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.dummy_example: + tasks: + dummy_example: + service: '@CleverAge\ProcessBundle\Task\DummyTask' + outputs: [output1, output2] + output1: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 + outputs: [debug] + output2: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 456 + firstname: Test3 + lastname: Test4 + outputs: [ debug ] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/error_forwarder_task.md b/docs/reference/tasks/error_forwarder_task.md new file mode 100644 index 00000000..df129aa3 --- /dev/null +++ b/docs/reference/tasks/error_forwarder_task.md @@ -0,0 +1,42 @@ +CounterTask +================== + +This is a dummy task mostly intended for testing purpose. + +Forward any input to the error output. + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Task\Debug\ErrorForwarderTask` + +Accepted inputs +--------------- + +`any` + +Possible outputs +---------------- + +`any`: directly error_output given `output` option + +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.error_forwarder_example: + tasks: + error_forwarder_example: + service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' + options: + output: + error1: Error 1 + error2: Error 2 + error3: Error 3 + outputs: [error_forwarder] + error_forwarder: + service: '@CleverAge\ProcessBundle\Task\Debug\ErrorForwarderTask' + +``` \ No newline at end of file diff --git a/docs/reference/tasks/event_dispatcher_task.md b/docs/reference/tasks/event_dispatcher_task.md index 9b6862e2..1a2d17b7 100644 --- a/docs/reference/tasks/event_dispatcher_task.md +++ b/docs/reference/tasks/event_dispatcher_task.md @@ -22,8 +22,24 @@ Possible outputs Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `event_name` | `string` | **X** | | Format for normalization ("json", "xml", ... an empty string should also work) | -| `passive` | `bool` | | `true` | Pass input to output | +| Code | Type | Required | Default | Description | +|--------------|----------|:---------:|----------|----------------------| +| `event_name` | `string` | **X** | | | +| `passive` | `bool` | | `true` | Pass input to output | +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.event_dispatcher_example: + tasks: + event_dispatcher_example: + service: '@CleverAge\ProcessBundle\Task\Event\EventDispatcherTask' + options: + event_name: 'myapp.myevent' + outputs: [debug] + debug: + service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' +``` \ No newline at end of file diff --git a/docs/reference/tasks/stopwatch_task.md b/docs/reference/tasks/stopwatch_task.md new file mode 100644 index 00000000..f7ee724f --- /dev/null +++ b/docs/reference/tasks/stopwatch_task.md @@ -0,0 +1,26 @@ +StopwatchTask +============= + +Log all the __root__ events of the Stopwatch component. + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Task\Debug\StopwatchTask` + +Accepted inputs +--------------- + +`any` + +Example +------- + +```yaml +clever_age_process: + configurations: + project_prefix.stopwatch_example: + tasks: + stopwatch_example: + service: '@CleverAge\ProcessBundle\Task\Debug\StopwatchTask' +``` \ No newline at end of file diff --git a/src/Task/Debug/DebugTask.php b/src/Task/Debug/DebugTask.php index dfe1d284..9020262d 100644 --- a/src/Task/Debug/DebugTask.php +++ b/src/Task/Debug/DebugTask.php @@ -19,8 +19,6 @@ /** * Dump the content of the input. - * - * @example https://github.com/cleverage/process-bundle-ui-demo/blob/main/config/packages/process/demo.debug.yaml */ class DebugTask implements TaskInterface { diff --git a/src/Task/Debug/DieTask.php b/src/Task/Debug/DieTask.php index cc307cd5..b8625914 100644 --- a/src/Task/Debug/DieTask.php +++ b/src/Task/Debug/DieTask.php @@ -15,20 +15,16 @@ use CleverAge\ProcessBundle\Model\ProcessState; use CleverAge\ProcessBundle\Model\TaskInterface; -use Symfony\Component\Console\Helper\Helper; /** * Class DieTask. * * Stops the process brutally - * - * @example https://github.com/cleverage/process-bundle-ui-demo/blob/main/config/packages/process/demo.die.yaml */ class DieTask implements TaskInterface { public function execute(ProcessState $state): never { - var_dump(Helper::formatMemory(memory_get_peak_usage(true))); exit; } } diff --git a/src/Task/Debug/StopwatchTask.php b/src/Task/Debug/StopwatchTask.php index ecf39e46..160db265 100644 --- a/src/Task/Debug/StopwatchTask.php +++ b/src/Task/Debug/StopwatchTask.php @@ -19,7 +19,7 @@ use Symfony\Component\Stopwatch\Stopwatch; /** - * Ouputs the stopwatch the content of the input. + * Log all the __root__ events of the Stopwatch component. */ class StopwatchTask implements TaskInterface { From 0f8042d634805a83b330ce4b488dad7a8f31ed81 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 21 Nov 2024 16:07:39 +0100 Subject: [PATCH 34/41] Fix Transformer configuration & add missing aliases on monolog handlers --- src/CleverAgeProcessBundle.php | 3 +-- src/DependencyInjection/CleverAgeProcessExtension.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CleverAgeProcessBundle.php b/src/CleverAgeProcessBundle.php index 300158b5..7e94bede 100644 --- a/src/CleverAgeProcessBundle.php +++ b/src/CleverAgeProcessBundle.php @@ -15,7 +15,6 @@ use CleverAge\ProcessBundle\DependencyInjection\Compiler\CheckSerializerCompilerPass; use CleverAge\ProcessBundle\DependencyInjection\Compiler\RegistryCompilerPass; -use CleverAge\ProcessBundle\Registry\TransformerRegistry; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -29,7 +28,7 @@ public function build(ContainerBuilder $container): void parent::build($container); $container->addCompilerPass( - new RegistryCompilerPass(TransformerRegistry::class, 'cleverage.transformer', 'addTransformer') + new RegistryCompilerPass('cleverage_process.registry.transformer', 'cleverage.transformer', 'addTransformer') ); $container->addCompilerPass(new CheckSerializerCompilerPass()); diff --git a/src/DependencyInjection/CleverAgeProcessExtension.php b/src/DependencyInjection/CleverAgeProcessExtension.php index 0dc1c6b8..cf7830bf 100644 --- a/src/DependencyInjection/CleverAgeProcessExtension.php +++ b/src/DependencyInjection/CleverAgeProcessExtension.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Finder\Finder; /** @@ -45,6 +46,10 @@ public function load(array $configs, ContainerBuilder $container): void $transformerDefinition = new Definition(GenericTransformer::class); $transformerDefinition->setAutowired(true); $transformerDefinition->setPublic(false); + $transformerDefinition->setArguments([ + new Reference('cleverage_process.context.contextual_option_resolver'), + new Reference('cleverage_process.registry.transformer'), + ]); $transformerDefinition->addMethodCall('initialize', [$transformerCode, $transformerConfig]); $transformerDefinition->addTag('cleverage.transformer'); From eec6b0fdd00e5d41b6b288f7a2e4a4f1fe3e0668 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 22 Nov 2024 10:38:04 +0100 Subject: [PATCH 35/41] cleverage/process-bundle-demo#3 Rename process-bundle-ui-demo to process-bundle-demo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c31dc621..8c2b601b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Basically, it will greatly ease the configuration of import and exports but can Compatible with [Symfony stable version and latest Long-Term Support (LTS) release](https://symfony.com/releases). -Demo project can be found on [there](https://github.com/cleverage/process-bundle-ui-demo). +Demo project can be found on [there](https://github.com/cleverage/process-bundle-demo). ## Documentation From c2b07789f15b29c21cb43a2bfca9e56fa149dcac Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 22 Nov 2024 10:43:18 +0100 Subject: [PATCH 36/41] Update composer suggest to cleverage/ui-process-bundle --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 769eeb2c..5286b57a 100644 --- a/composer.json +++ b/composer.json @@ -87,7 +87,7 @@ "cleverage/soap-process-bundle": "Dedicated bundle for Soap dependencies for the process bundle", "cleverage/rest-process-bundle": "Dedicated bundle for Rest dependencies for the process bundle", "cleverage/flysystem-process-bundle": "Dedicated bundle for Flysystem dependencies for the process bundle", - "cleverage/processuibundle": "A simple UX for cleverage/processbundle using EasyAdmin\n\n" + "cleverage/ui-process-bundle": "UI for the process bundle" }, "config": { "allow-plugins": { From 653a5752fd2cd854fcc167857ed931e8464f3d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tonon=20Gr=C3=A9gory?= Date: Tue, 3 Dec 2024 14:02:20 +0100 Subject: [PATCH 37/41] [#151] Replace monolog.logger by logger on CleverAge\ProcessBundle\Logger\ProcessLogger && CleverAge\ProcessBundle\Logger\TaskLogger to use cleverage_process && cleverage_process_task channel instead of app channel. --- config/services/logger.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/services/logger.yaml b/config/services/logger.yaml index 6925dd67..96401ec9 100644 --- a/config/services/logger.yaml +++ b/config/services/logger.yaml @@ -29,7 +29,7 @@ services: tags: - { name: monolog.logger, channel: cleverage_process } arguments: - - '@monolog.logger' + - '@logger' cleverage_process.logger.task_logger: class: CleverAge\ProcessBundle\Logger\TaskLogger @@ -37,4 +37,4 @@ services: tags: - { name: monolog.logger, channel: cleverage_process_task } arguments: - - '@monolog.logger' + - '@logger' From dafe5b3cee3d06d3d5a15897ecb257a2659ffbfb Mon Sep 17 00:00:00 2001 From: xmarchegay Date: Tue, 3 Dec 2024 20:47:22 +0100 Subject: [PATCH 38/41] #145 add TrimTransformer documentation --- docs/index.md | 2 +- .../transformers/trim_transformer.md | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 docs/reference/transformers/trim_transformer.md diff --git a/docs/index.md b/docs/index.md index 76de1a95..6e1a4a42 100644 --- a/docs/index.md +++ b/docs/index.md @@ -123,7 +123,7 @@ - [ImplodeTransformer] - [SlugifyTransformer] - [SprintfTransformer] - - [TrimTransformer] + - [TrimTransformer](reference/transformers/trim_transformer.md) - XML - [XpathEvaluatorTransformer](reference/transformers/xpath_evaluator.md) - Other bridges diff --git a/docs/reference/transformers/trim_transformer.md b/docs/reference/transformers/trim_transformer.md new file mode 100644 index 00000000..85a09053 --- /dev/null +++ b/docs/reference/transformers/trim_transformer.md @@ -0,0 +1,32 @@ +TrimTransformer +========================= + +Strip whitespace (or other characters) from the beginning and end of a string + +This transformer uses the php internal function: https://www.php.net/manual/en/function.trim.php + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Transformer\String\TrimTransformer` +* **Transformer code**: `trim` + +Accepted inputs +--------------- + +Any value that can be cast to string and null. + +Possible outputs +---------------- + +Depending on the input : +- `null` if the input is null +- `string` if the input is not null + +Options +------- + +| Code | Type | Required | Default | Description | +| ---- | ---- | :------: |-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `charlist` | `string` | | ***" \t\n\r\0\x0B"*** | List of characters to trim | + From debeec069013a8ea873f1178b6cf013cf2372caf Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 12 Dec 2024 09:43:44 +0100 Subject: [PATCH 39/41] #145 Add/Update docs --- docs/index.md | 8 +- .../tasks/constant_iterable_output_task.md | 24 +-- docs/reference/tasks/constant_output_task.md | 24 +-- docs/reference/tasks/counter_task.md | 31 +--- docs/reference/tasks/csv_reader_task.md | 32 +++- docs/reference/tasks/debug_task.md | 29 ++-- docs/reference/tasks/die_task.md | 16 +- docs/reference/tasks/dummy_task.md | 50 +++--- docs/reference/tasks/error_forwarder_task.md | 25 +-- docs/reference/tasks/event_dispatcher_task.md | 18 +- docs/reference/tasks/input_csv_reader_task.md | 46 +++++ docs/reference/tasks/logger_task.md | 41 +++++ docs/reference/tasks/stopwatch_task.md | 21 ++- docs/reference/tasks/transformer_task.md | 17 +- .../transformers/implode_transformer.md | 38 +++++ .../transformers/mapping_transformer.md | 157 ++++++++---------- .../transformers/rules_transformer.md | 64 +++---- .../transformers/slugify_transformer.md | 39 +++++ 18 files changed, 410 insertions(+), 270 deletions(-) create mode 100644 docs/reference/tasks/input_csv_reader_task.md create mode 100644 docs/reference/tasks/logger_task.md create mode 100644 docs/reference/transformers/implode_transformer.md create mode 100644 docs/reference/transformers/slugify_transformer.md diff --git a/docs/index.md b/docs/index.md index 6e1a4a42..96f54c07 100644 --- a/docs/index.md +++ b/docs/index.md @@ -44,7 +44,7 @@ - [CsvReaderTask](reference/tasks/csv_reader_task.md) - [CsvWriterTask](reference/tasks/csv_writer_task.md) - [CSVSplitterTask] - - [InputCsvReaderTask] + - [InputCsvReaderTask](reference/tasks/input_csv_reader_task.md) - File/JsonStream - [JsonStreamReaderTask] - File/XML @@ -79,7 +79,7 @@ - [ProcessLauncherTask] - Reporting - [AdvancedStatCounterTask] - - [LoggerTask] + - [LoggerTask](reference/tasks/logger_task.md) - [StatCounterTask] - Transformers - Basic and debug @@ -120,8 +120,8 @@ - String - [ExplodeTransformer] - [HashTransformer] - - [ImplodeTransformer] - - [SlugifyTransformer] + - [ImplodeTransformer](reference/transformers/implode_transformer.md) + - [SlugifyTransformer](reference/transformers/slugify_transformer.md) - [SprintfTransformer] - [TrimTransformer](reference/transformers/trim_transformer.md) - XML diff --git a/docs/reference/tasks/constant_iterable_output_task.md b/docs/reference/tasks/constant_iterable_output_task.md index ba3f6410..30b04829 100644 --- a/docs/reference/tasks/constant_iterable_output_task.md +++ b/docs/reference/tasks/constant_iterable_output_task.md @@ -29,18 +29,12 @@ Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.constant_iterable_output_example: - tasks: - constant_iterable_output_example: - service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' - options: - output: - id: 123 - firstname: Test1 - lastname: Test2 - outputs: [debug] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 +``` diff --git a/docs/reference/tasks/constant_output_task.md b/docs/reference/tasks/constant_output_task.md index 03fd41c3..ed2f042f 100644 --- a/docs/reference/tasks/constant_output_task.md +++ b/docs/reference/tasks/constant_output_task.md @@ -29,18 +29,12 @@ Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.constant_output_example: - tasks: - constant_output_example: - service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' - options: - output: - id: 123 - firstname: Test1 - lastname: Test2 - outputs: [debug] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 +``` diff --git a/docs/reference/tasks/counter_task.md b/docs/reference/tasks/counter_task.md index 997c8af7..455539e4 100644 --- a/docs/reference/tasks/counter_task.md +++ b/docs/reference/tasks/counter_task.md @@ -13,7 +13,7 @@ Task reference Accepted inputs --------------- -`any` +`any`, must implement IterableTaskInterface Possible outputs ---------------- @@ -31,26 +31,9 @@ Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.counter_example: - tasks: - counter_example: - service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' - options: - output: - test1: test1 - test2: test2 - test3: test3 - test4: test4 - test5: test5 - test6: test6 - outputs: [counter] - counter: - service: '@CleverAge\ProcessBundle\Task\CounterTask' - options: - flush_every: 2 - outputs: [ debug ] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\CounterTask' + options: + flush_every: 2 +``` diff --git a/docs/reference/tasks/csv_reader_task.md b/docs/reference/tasks/csv_reader_task.md index b5df5a40..0e7b4c3a 100644 --- a/docs/reference/tasks/csv_reader_task.md +++ b/docs/reference/tasks/csv_reader_task.md @@ -23,12 +23,26 @@ Underlying method is [fgetcsv](https://secure.php.net/manual/en/function.fgetcsv Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `file_path` | `string` | **X** | | Path of the file to read from (relative to symfony root or absolute) | -| `delimiter` | `string` | | `;` | CSV delimiter | -| `enclosure` | `string` | | `"` | CSV enclosure character | -| `escape` | `string` | | `\\` | CSV escape character | -| `headers` | `array` or `null` | | `null` | Static list of CSV headers, without the option, it will be dynamically read from first input | -| `mode` | `string` | | `rb` | File open mode (see [fopen mode parameter](https://secure.php.net/manual/en/function.fopen.php)) | -| `log_empty_lines` | `bool` | | `false` | Log when the output is empty | +| Code | Type | Required | Default | Description | +|-------------------|-------------------|:---------:|----------|--------------------------------------------------------------------------------------------------| +| `file_path` | `string` | **X** | | Path of the file to read from (relative to symfony root or absolute) | +| `delimiter` | `string` | | `;` | CSV delimiter | +| `enclosure` | `string` | | `"` | CSV enclosure character | +| `escape` | `string` | | `\\` | CSV escape character | +| `headers` | `array` or `null` | | `null` | Static list of CSV headers, without the option, it will be dynamically read from first input | +| `mode` | `string` | | `rb` | File open mode (see [fopen mode parameter](https://secure.php.net/manual/en/function.fopen.php)) | +| `log_empty_lines` | `bool` | | `false` | Log when the output is empty | + +Example +------- + +```yaml +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\File\Csv\CsvReaderTask' + options: + file_path: 'path/to/file.csv' + delimiter: '{{ delimiter }}' ## delimiter is contextualized you must add -c delimiter:";" on console execute +``` + + diff --git a/docs/reference/tasks/debug_task.md b/docs/reference/tasks/debug_task.md index 5a654089..cfaf44d7 100644 --- a/docs/reference/tasks/debug_task.md +++ b/docs/reference/tasks/debug_task.md @@ -20,22 +20,21 @@ Possible outputs `any`: re-output given input +Options +------- + +None + Example ---------------- ```yaml -clever_age_process: - configurations: - project_prefix.debug_example: - tasks: - debug_example: - service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' - options: - output: - id: 123 - firstname: Test1 - lastname: Test2 - outputs: [debug] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 +``` diff --git a/docs/reference/tasks/die_task.md b/docs/reference/tasks/die_task.md index 24008f4d..741fdeed 100644 --- a/docs/reference/tasks/die_task.md +++ b/docs/reference/tasks/die_task.md @@ -19,14 +19,16 @@ Possible outputs None +Options +------- + +None + Example ---------------- ```yaml -clever_age_process: - configurations: - project_prefix.die_example: - tasks: - die_example: - service: '@CleverAge\ProcessBundle\Task\Debug\DieTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\Debug\DieTask' +``` diff --git a/docs/reference/tasks/dummy_task.md b/docs/reference/tasks/dummy_task.md index 87fda52e..323cafc5 100644 --- a/docs/reference/tasks/dummy_task.md +++ b/docs/reference/tasks/dummy_task.md @@ -18,33 +18,31 @@ Possible outputs `any`: re-output given input +Options +------- + +None + Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.dummy_example: - tasks: - dummy_example: - service: '@CleverAge\ProcessBundle\Task\DummyTask' - outputs: [output1, output2] - output1: - service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' - options: - output: - id: 123 - firstname: Test1 - lastname: Test2 - outputs: [debug] - output2: - service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' - options: - output: - id: 456 - firstname: Test3 - lastname: Test4 - outputs: [ debug ] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +dummy: + service: '@CleverAge\ProcessBundle\Task\DummyTask' + outputs: [output1, output2] +output1: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 123 + firstname: Test1 + lastname: Test2 +output2: + service: '@CleverAge\ProcessBundle\Task\ConstantOutputTask' + options: + output: + id: 456 + firstname: Test3 + lastname: Test4 +``` diff --git a/docs/reference/tasks/error_forwarder_task.md b/docs/reference/tasks/error_forwarder_task.md index df129aa3..592c9cb2 100644 --- a/docs/reference/tasks/error_forwarder_task.md +++ b/docs/reference/tasks/error_forwarder_task.md @@ -20,23 +20,16 @@ Possible outputs `any`: directly error_output given `output` option +Options +------- + +None + Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.error_forwarder_example: - tasks: - error_forwarder_example: - service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask' - options: - output: - error1: Error 1 - error2: Error 2 - error3: Error 3 - outputs: [error_forwarder] - error_forwarder: - service: '@CleverAge\ProcessBundle\Task\Debug\ErrorForwarderTask' - -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\Debug\ErrorForwarderTask' +``` diff --git a/docs/reference/tasks/event_dispatcher_task.md b/docs/reference/tasks/event_dispatcher_task.md index 1a2d17b7..88c87e98 100644 --- a/docs/reference/tasks/event_dispatcher_task.md +++ b/docs/reference/tasks/event_dispatcher_task.md @@ -31,15 +31,9 @@ Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.event_dispatcher_example: - tasks: - event_dispatcher_example: - service: '@CleverAge\ProcessBundle\Task\Event\EventDispatcherTask' - options: - event_name: 'myapp.myevent' - outputs: [debug] - debug: - service: '@CleverAge\ProcessBundle\Task\Debug\DebugTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\Event\EventDispatcherTask' + options: + event_name: 'myapp.myevent' +``` diff --git a/docs/reference/tasks/input_csv_reader_task.md b/docs/reference/tasks/input_csv_reader_task.md new file mode 100644 index 00000000..59e67d2a --- /dev/null +++ b/docs/reference/tasks/input_csv_reader_task.md @@ -0,0 +1,46 @@ +InputCsvReaderTask +============= + +Reads a CSV file and iterate on each line, returning an array of key -> values. Skips empty lines. + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Task\File\Csv\InputCsvReaderTask` +* **Iterable task** + +Accepted inputs +--------------- + +`string`: file path + +Possible outputs +---------------- + +`array`: foreach line, it will return a php array where key comes from headers and values are strings. +Underlying method is [fgetcsv](https://secure.php.net/manual/en/function.fgetcsv.php). + +Options +------- + +Same as [CsvReaderTask](reference/tasks/csv_reader_task.md) except following : + +| Code | Type | Required | Default | Description | +|-------------|----------|:--------:|---------|----------------------------| +| `file_path` | | | | Removed, use input instead | +| `base_path` | `string` | | `` | | + +Example +------- + +```yaml +clever_age_process: + configurations: + process.name: + entry_point: entrypoint # for upload_and_run process entry_point is required + tasks: + entrypoint: + service: '@CleverAge\ProcessBundle\Task\File\Csv\InputCsvReaderTask' + options: + delimiter: '{{ delimiter }}' ## delimiter is contextualized you must add -c delimiter:";" on console execute +``` diff --git a/docs/reference/tasks/logger_task.md b/docs/reference/tasks/logger_task.md new file mode 100644 index 00000000..ffcc51ac --- /dev/null +++ b/docs/reference/tasks/logger_task.md @@ -0,0 +1,41 @@ +LoggerTask +============= + +Log a specific message with context. + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Task\Reporting\LoggerTask` + +Accepted inputs +--------------- + +`any` + +Possible outputs +---------------- + +`any` : forwarded input + +Options +------- + +| Code | Type | Required | Default | Description | +|-------------|--------------------|:---------:|-------------------|---------------------------------| +| `level` | `string` | **X** | `debug` | Use `Psr\Log\LogLevel` values | +| `message` | `string` | | `Log state input` | | +| `context` | `array` | | `['input']` | | +| `reference` | `string` or `null` | | `null` | Override `context['reference']` | + +Example +------- + +```yaml +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\Reporting\LoggerTask' + options: + level: warning + message: DEMO LOGGER +``` diff --git a/docs/reference/tasks/stopwatch_task.md b/docs/reference/tasks/stopwatch_task.md index f7ee724f..4953239b 100644 --- a/docs/reference/tasks/stopwatch_task.md +++ b/docs/reference/tasks/stopwatch_task.md @@ -13,14 +13,21 @@ Accepted inputs `any` +Possible outputs +---------------- + +None + +Options +------- + +None + Example ------- ```yaml -clever_age_process: - configurations: - project_prefix.stopwatch_example: - tasks: - stopwatch_example: - service: '@CleverAge\ProcessBundle\Task\Debug\StopwatchTask' -``` \ No newline at end of file +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\Debug\StopwatchTask' +``` diff --git a/docs/reference/tasks/transformer_task.md b/docs/reference/tasks/transformer_task.md index 4a8b5b21..efc98bcd 100644 --- a/docs/reference/tasks/transformer_task.md +++ b/docs/reference/tasks/transformer_task.md @@ -23,7 +23,18 @@ Possible outputs Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `transformers` | `array` | **X** | | List of transformers, see [TransformerTrait](../traits/transformer_trait.md) | +| Code | Type | Required | Default | Description | +|----------------|---------|:---------:|----------|------------------------------------------------------------------------------| +| `transformers` | `array` | **X** | | List of transformers, see [TransformerTrait](../traits/transformer_trait.md) | +Example +------- + +```yaml +# Task configuration level +code: + service: '@CleverAge\ProcessBundle\Task\TransformerTask' + options: + transformers: + slugify: ~ +``` diff --git a/docs/reference/transformers/implode_transformer.md b/docs/reference/transformers/implode_transformer.md new file mode 100644 index 00000000..dad93ac2 --- /dev/null +++ b/docs/reference/transformers/implode_transformer.md @@ -0,0 +1,38 @@ +ImplodeTransformer +========================= + +Join array elements with a string + +This transformer uses the php internal function: https://www.php.net/manual/en/function.implode.php + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Transformer\String\ImplodeTransformer` +* **Transformer code**: `implode` + +Accepted inputs +--------------- + +`array` + +Possible outputs +---------------- + +`string` + +Options +------- + +| Code | Type | Required | Default | Description | +|-------------|----------|:--------:|---------|-------------| +| `separator` | `string` | **X** | `|` | | + +Examples +-------- + +```yaml +# Transformer options level +implode: + separator: '-' +``` diff --git a/docs/reference/transformers/mapping_transformer.md b/docs/reference/transformers/mapping_transformer.md index 9830542d..4971f66b 100644 --- a/docs/reference/transformers/mapping_transformer.md +++ b/docs/reference/transformers/mapping_transformer.md @@ -29,23 +29,23 @@ Possible outputs Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `mapping` | `array` | **X** | | List of property => sub-mapping options. The property code can be a single string to be used as an array index, or a writable property path | -| `ignore_missing` | `bool` | | `false` | Ignore property accessor errors for the whole mapping | -| `keep_input` | `bool` | | `false` | Use input as the mapping destination (takes precedence on `initial_value`). Keep in mind that due to PHP behavior, arrays are cloned while objects are passed by reference | -| `initial_value` | `any` | | `[]` | Set the mapping destination | -| `merge_callback` | `callable` or `null` | | `null` | Allow to change how a property can be set in the destination | +| Code | Type | Required | Default | Description | +|------------------|----------------------|:---------:|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `mapping` | `array` | **X** | | List of property => sub-mapping options. The property code can be a single string to be used as an array index, or a writable property path | +| `ignore_missing` | `bool` | | `false` | Ignore property accessor errors for the whole mapping | +| `keep_input` | `bool` | | `false` | Use input as the mapping destination (takes precedence on `initial_value`). Keep in mind that due to PHP behavior, arrays are cloned while objects are passed by reference | +| `initial_value` | `any` | | `[]` | Set the mapping destination | +| `merge_callback` | `callable` or `null` | | `null` | Allow to change how a property can be set in the destination | Foreach property there is the following options. -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `code` | `string` or `array` or `null` | | `null` | A property path, or a list of property path. By default it would be the same as the destination property. Will be used as a source. The special value '.' access the whole object. | -| `constant` | `any` | | `null` | If not `null`, will be directly used as a source (takes precedence on `code`) | -| `set_null` | `bool` | | `false` | If `true`, `null` will be directly used as a source (takes precedence on `code`) | -| `ignore_missing` | `bool` | | `false` | Ignore property accessor errors for this source | -| `transformers` | `array` | | `[]` | List of sub-transformers, see [TransformerTrait](../traits/transformer_trait.md) | +| Code | Type | Required | Default | Description | +|------------------|-------------------------------|:---------:|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `code` | `string` or `array` or `null` | | `null` | A property path, or a list of property path. By default it would be the same as the destination property. Will be used as a source. The special value '.' access the whole object. | +| `constant` | `any` | | `null` | If not `null`, will be directly used as a source (takes precedence on `code`) | +| `set_null` | `bool` | | `false` | If `true`, `null` will be directly used as a source (takes precedence on `code`) | +| `ignore_missing` | `bool` | | `false` | Ignore property accessor errors for this source | +| `transformers` | `array` | | `[]` | List of sub-transformers, see [TransformerTrait](../traits/transformer_trait.md) | Examples -------- @@ -55,43 +55,39 @@ Examples - output: an array with keys "code", "label", "type", "reference", "required" and "slug" ```yaml -transform_data: # Task level - service: '@CleverAge\ProcessBundle\Task\TransformerTask' - options: - transformers: - mapping: - mapping: - code: # Simple mapping from "Code" to "code" - code: '[Code]' - "[label]": ~ # Value from "label" will be kept with the same name - type: # Get value from "type" and map values (with a default) - code: '[Type]' - transformers: - convert_value: - ignore_missing: true - map: - TEXTE: text - NUMERIQUE: number - LISTE_DEROULANTE: simpleselect - CHOIX_MULTIPLES: multiselect - DATE: date - default: - value: unknown - reference: # "null" column - set_null: true - required: # "true" column - constant: true - slug: # Get multiple sources, slugify them, and merge them - code: - name: '[Name]' - id: '[ID]' - transformers: - array_map: - transformers: - slugify: ~ - implode: - separator: '_' - outputs: [next_task] +# Transformer options level +mapping: + mapping: + code: # Simple mapping from "Code" to "code" + code: '[Code]' + "[label]": ~ # Value from "label" will be kept with the same name + type: # Get value from "type" and map values (with a default) + code: '[Type]' + transformers: + convert_value: + ignore_missing: true + map: + TEXTE: text + NUMERIQUE: number + LISTE_DEROULANTE: simpleselect + CHOIX_MULTIPLES: multiselect + DATE: date + default: + value: unknown + reference: # "null" column + set_null: true + required: # "true" column + constant: true + slug: # Get multiple sources, slugify them, and merge them + code: + name: '[Name]' + id: '[ID]' + transformers: + array_map: + transformers: + slugify: ~ + implode: + separator: '_' ``` * Mapping in depth, using objects @@ -99,23 +95,18 @@ transform_data: # T - output: an array with key "items", containing a list of array with key "name" ```yaml -transform_data: # Task level - service: '@CleverAge\ProcessBundle\Task\TransformerTask' - options: - transformers: # TransformerTask options - mapping: # Transformer code - mapping: # MappingTransformer options - items: # property code - code: 'productItems' # property options - transformers: # property options - array_map: # Transformer code - transformers: # ArrayMapTransformer options - mapping: # Transformer code - mapping: # MappingTransformer options - name: # property code - code: 'longName' # property options - - outputs: [next_task] +# Transformer options level +mapping: # Transformer code + mapping: # MappingTransformer options + items: # property code + code: 'productItems' # property options + transformers: + array_map: # Transformer code + transformers: # ArrayMapTransformer options + mapping: # Transformer code + mapping: # MappingTransformer options + name: # property code + code: 'longName' # property options ``` * Advanced property setter @@ -123,21 +114,17 @@ transform_data: # Ta - output: same object, with a modified "address.customer.hasFlag" ```yaml -transform_data: # Task level - service: '@CleverAge\ProcessBundle\Task\TransformerTask' - options: - transformers: - mapping: - keep_input: true - mapping: - address.customer.hasFlag: - code: address.postCode - transformers: - convert_value: - ignore_missing: true - map: - 69005: true - default: - value: false - outputs: [next_task] +# Transformer options level +mapping: + keep_input: true + mapping: + address.customer.hasFlag: + code: address.postCode + transformers: + convert_value: + ignore_missing: true + map: + 69005: true + default: + value: false ``` diff --git a/docs/reference/transformers/rules_transformer.md b/docs/reference/transformers/rules_transformer.md index fd65827a..71ecc40d 100644 --- a/docs/reference/transformers/rules_transformer.md +++ b/docs/reference/transformers/rules_transformer.md @@ -34,21 +34,21 @@ Without any matching rules, the value itself is returned. Options ------- -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `rules_set` | `array` | **X** | | Ordered list of rules, see bellow for details | -| `use_value_as_variables` | `bool` | | `false` | Use given value as an array of variable to inject in expression | -| `expression_variables` | `array` or `null` | | `[value]` | Name of variables injected in the expression at initialization time | +| Code | Type | Required | Default | Description | +|--------------------------|-------------------|:--------:|-----------|---------------------------------------------------------------------| +| `rules_set` | `array` | **X** | | Ordered list of rules, see bellow for details | +| `use_value_as_variables` | `bool` | | `false` | Use given value as an array of variable to inject in expression | +| `expression_variables` | `array` or `null` | | `[value]` | Name of variables injected in the expression at initialization time | Foreach rule there is the following options. -| Code | Type | Required | Default | Description | -| ---- | ---- | :------: | ------- | ----------- | -| `condition` | `string` or `null` | | `null` | An expression used to match a value | -| `default` | `bool` | | `false` | Mark this rule as a default rule. The given rule must be the last, cannot have a condition, and there cannot have 2 default in the same time | -| `transformers` | `array` | | `[]` | List of sub-transformers, see [TransformerTrait](../traits/transformer_trait.md) | -| `constant` | `any` | | `null` | If not `null`, given value will be directly output (takes precedence on `transformers`) | -| `set_null` | `bool` | | `false` | If `true`, `null` will be directly output (takes precedence on `constant`) | +| Code | Type | Required | Default | Description | +|----------------|--------------------|:---------:|---------|----------------------------------------------------------------------------------------------------------------------------------------------| +| `condition` | `string` or `null` | | `null` | An expression used to match a value | +| `default` | `bool` | | `false` | Mark this rule as a default rule. The given rule must be the last, cannot have a condition, and there cannot have 2 default in the same time | +| `transformers` | `array` | | `[]` | List of sub-transformers, see [TransformerTrait](../traits/transformer_trait.md) | +| `constant` | `any` | | `null` | If not `null`, given value will be directly output (takes precedence on `transformers`) | +| `set_null` | `bool` | | `false` | If `true`, `null` will be directly output (takes precedence on `constant`) | Examples -------- @@ -60,15 +60,15 @@ Examples ```yaml # Transformer options level rules: - rules_set: - - condition: 'value["order"].origin === "marketplace"' - transformers: - property_accessor: - property_path: '[customer].id' - - condition: 'value["order"].origin === "e-commerce"' - constant: 1234 - - default: true - set_null: true + rules_set: + - condition: 'value["order"].origin === "marketplace"' + transformers: + property_accessor: + property_path: '[customer].id' + - condition: 'value["order"].origin === "e-commerce"' + constant: 1234 + - default: true + set_null: true ``` * Use value as variables @@ -79,15 +79,15 @@ rules: ```yaml # Transformer options level rules: - use_value_as_variables: true - expression_variables: [order, customer] - rules_set: - - condition: 'order.origin === "marketplace"' - transformers: - property_accessor: - property_path: '[customer].id' - - condition: 'order.origin === "e-commerce"' - constant: 1234 - - default: true - set_null: true + use_value_as_variables: true + expression_variables: [order, customer] + rules_set: + - condition: 'order.origin === "marketplace"' + transformers: + property_accessor: + property_path: '[customer].id' + - condition: 'order.origin === "e-commerce"' + constant: 1234 + - default: true + set_null: true ``` diff --git a/docs/reference/transformers/slugify_transformer.md b/docs/reference/transformers/slugify_transformer.md new file mode 100644 index 00000000..cadab337 --- /dev/null +++ b/docs/reference/transformers/slugify_transformer.md @@ -0,0 +1,39 @@ +SlugifyTransformer +========================= + +Strip whitespace (or other characters) from the beginning and end of a string + +This transformer uses the php internal function: https://www.php.net/manual/en/class.transliterator.php + +Task reference +-------------- + +* **Service**: `CleverAge\ProcessBundle\Transformer\String\SlugifyTransformer` +* **Transformer code**: `slugify` + +Accepted inputs +--------------- + +Any value that can be cast to string. + +Possible outputs +---------------- + +`string` + +Options +------- + +| Code | Type | Required | Default | Description | +|------------------|----------|:---------:|----------------------------------------|--------------------------------| +| `transliterator` | `string` | | `NFD; [:Nonspacing Mark:] Remove; NFC` | Used to create \Transliterator | +| `replace` | `string` | | `/[^a-z0-9]+/` | Used on preg_replace | +| `separator` | `string` | | `_` | Used on preg_replace | + +Examples +-------- + +```yaml +# Transformer options level +slugify: ~ +``` From c8ceda66c0a30d736ea95485f345a2a0b78a8455 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 13 Dec 2024 11:24:41 +0100 Subject: [PATCH 40/41] Replace deprecated phpstan option checkGenericClassInNonGenericObjectType by identifier: missingType.generics. Fix code. --- phpstan.neon | 2 +- src/Filesystem/CsvResource.php | 6 ------ src/Transformer/CachedTransformer.php | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index e374f1ba..f0560a73 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,7 +14,7 @@ parameters: - '#process\(\) has no return type specified#' - '#should return Iterator but returns Traversable#' - '#Negated boolean expression is always false#' - checkGenericClassInNonGenericObjectType: false + - identifier: missingType.generics reportUnmatchedIgnoredErrors: false inferPrivatePropertyTypeFromConstructor: true treatPhpDocTypesAsCertain: false diff --git a/src/Filesystem/CsvResource.php b/src/Filesystem/CsvResource.php index 97dc8b83..3c536dca 100644 --- a/src/Filesystem/CsvResource.php +++ b/src/Filesystem/CsvResource.php @@ -13,8 +13,6 @@ namespace CleverAge\ProcessBundle\Filesystem; -use function count; - /** * Read and write CSV resources through a simple API. */ @@ -303,10 +301,6 @@ protected function parseHeaders(?array $headers = null): array $this->manualHeaders = true; - if (!\is_array($headers)) { - throw new \UnexpectedValueException("Invalid headers for {$this->getResourceName()}, you need to pass the headers manually"); - } - if ([] === $headers) { throw new \UnexpectedValueException("Empty headers for {$this->getResourceName()}, you need to pass the headers manually"); } diff --git a/src/Transformer/CachedTransformer.php b/src/Transformer/CachedTransformer.php index 53439e21..5fff4923 100644 --- a/src/Transformer/CachedTransformer.php +++ b/src/Transformer/CachedTransformer.php @@ -65,7 +65,7 @@ function (Options $options, $value) { public function transform(mixed $value, array $options = []): mixed { $cacheKey = $this->generateCacheKey($options['cache_key'], $value, $options); - if ($cacheKey && $this->cache instanceof CacheItemPoolInterface) { + if ($cacheKey) { try { $cacheItem = $this->cache->getItem($cacheKey); if ($cacheItem->isHit()) { From 0d2cc03be09915023ad5ee44375f2bfccd4bf254 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Mon, 16 Dec 2024 14:37:13 +0100 Subject: [PATCH 41/41] #115 Add BC break for new mandatory configuration `default_error_strategy` on `clever_age_process` level --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea673379..7ae40b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ v4.0 * [#148](https://github.com/cleverage/process-bundle/issues/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](https://github.com/cleverage/process-bundle/issues/150) The class `\CleverAge\ProcessBundle\Task\Debug\MemInfoDumpTask` has been deleted without suggested replacement +* [#115](https://github.com/cleverage/process-bundle/issues/115) New mandatory configuration `default_error_strategy` on `clever_age_process` level. See [Quick Start/Global configuration](docs/01-quick_start.md#global-configuration) ### Changes * [#139](https://github.com/cleverage/process-bundle/issues/139) Update Makefile & .docker for local standalone usage