From cd525e0f35ca50489da271c84cf20630677d6a6b Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Mon, 13 Jan 2025 10:48:11 +0100 Subject: [PATCH] adjust license (#505) --- .github/workflows/codeception.yml | 10 +- .github/workflows/ecs-fix.yml | 44 +++ .github/workflows/ecs.yml | 117 ------- .github/workflows/php-stan.yml | 10 +- .gitignore | 5 +- ISSUE_TEMPLATE.md | 14 +- LICENSE.md | 20 +- README.md | 9 +- UPGRADE.md | 1 + composer.json | 19 +- ecs.php | 285 ++++++++---------- phpstan.neon | 5 +- src/Builder/FrontendFormBuilder.php | 4 +- .../Admin/OutputWorkflowController.php | 2 +- src/Doctrine/Type/FormBuilderFieldsType.php | 2 +- src/Event/FormAssembleEvent.php | 2 +- .../SignalStorage/FormDataSignalStorage.php | 8 - src/Migrations/Version20230830183642.php | 2 +- src/Model/FormDefinition.php | 2 +- .../Channel/Object/AbstractObjectResolver.php | 18 +- src/OutputWorkflow/FunnelWorker.php | 8 - .../Processor/ConditionalLogicProcessor.php | 4 - 22 files changed, 235 insertions(+), 356 deletions(-) create mode 100644 .github/workflows/ecs-fix.yml delete mode 100644 .github/workflows/ecs.yml diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index 233e0780..bec2e868 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -38,12 +38,12 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: matrix: - php: [ 8.2 ] - symfony: [ ^6.2 ] - pimcore: [ ~11.2.0 ] + php: [ 8.3 ] + symfony: [ ^6.4 ] + pimcore: [ ~11.4.0 ] include: - - pimcore: ~11.2.0 - template_tag: v11.0.0 + - pimcore: ~11.4.0 + template_tag: 2024.3 steps: - uses: nanasess/setup-chromedriver@v2 - uses: actions/checkout@v4 diff --git a/.github/workflows/ecs-fix.yml b/.github/workflows/ecs-fix.yml new file mode 100644 index 00000000..feb83833 --- /dev/null +++ b/.github/workflows/ecs-fix.yml @@ -0,0 +1,44 @@ +name: Coding standard refactor +on: + schedule: + - cron: '0 0 * * SUN' + workflow_dispatch: ~ + +jobs: + ecs-fix: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + fail-fast: false + matrix: + branch: [ 'master' ] + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + + - name: Composer install + run: composer install --no-interaction --no-scripts + + - name: Run ECS + run: | + vendor/bin/ecs check src --fix --config ecs.php + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: '[CS] Refactor' + author: DACHCOM Bot + title: '[CS] Refactor' + body: | + This PR has been generated automatically to fix code-styles + labels: | + Enhancement + branch: coding-standard/refactor-${{ matrix.branch }} + delete-branch: true + base: ${{ matrix.branch }} \ No newline at end of file diff --git a/.github/workflows/ecs.yml b/.github/workflows/ecs.yml deleted file mode 100644 index 05f47f2c..00000000 --- a/.github/workflows/ecs.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Easy Coding Standards -on: - push: - branches: [ 'master' ] - pull_request: - branches: [ 'master' ] - -jobs: - ecs: - runs-on: ubuntu-latest - env: - TEST_BUNDLE_NAME: "FormBuilderBundle" - TEST_BUNDLE_INSTALLER_CLASS: "FormBuilderBundle\\Tool\\Install" - TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests" - TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}" - - PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework" - PIMCORE_CODECEPTION_VERSION: "3.0" - - APP_ENV: test - PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test" - PIMCORE_TEST_URL: "http://localhost" - - SYMFONY_DEPRECATIONS_HELPER: "weak" - PIMCORE_PHP_ERROR_REPORTING: 32767 - - WEBDRIVER_HOST: localhost - WEBDRIVER_URL: "http://localhost:8080/" - - services: - mysql: - image: mysql:8.0 - env: - MYSQL_ROOT_PASSWORD: root - ports: - - 3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - strategy: - matrix: - php: [ 8.2 ] - symfony: [ ^6.2 ] - pimcore: [ ~11.2.0 ] - include: - - pimcore: ~11.2.0 - template_tag: v11.0.0 - steps: - - uses: actions/checkout@v4 - with: - path: lib/test-bundle - - - name: Generate Application Structure - run: | - git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git - mv skeleton/composer.json . - mv skeleton/bin . - mv skeleton/config . - mv skeleton/public . - mv skeleton/src . - mv skeleton/templates . - mv skeleton/var . - rm -r skeleton - - - name: Setup Pimcore Codeception Framework - env: - MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }} - MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }} - run: | - git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git - ls -al pimcore-codeception-framework - chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh - ./pimcore-codeception-framework/src/_etc/scripts/setup.sh - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: intl - coverage: none - - - name: Check PHP Version - run: php -v - - - name: Setup MySql - run: | - sudo systemctl start mysql - mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;" - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer Downloads - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Composer install - env: - TEST_PIMCORE_VERSION: ${{ matrix.pimcore }} - TEST_SYMFONY_VERSION: ${{ matrix.symfony }} - run: | - chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh - ./pimcore-codeception-framework/src/_etc/scripts/composer.sh - - - name: Assets Install - run: | - bin/console assets:install public --relative --symlink - - - name: Easy Coding Standard Check - continue-on-error: true - run: | - bin/console cache:warmup --env=test - vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src --config ${{ github.workspace }}/lib/test-bundle/ecs.php diff --git a/.github/workflows/php-stan.yml b/.github/workflows/php-stan.yml index a5a7feef..eecf43db 100644 --- a/.github/workflows/php-stan.yml +++ b/.github/workflows/php-stan.yml @@ -37,12 +37,12 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: matrix: - php: [ 8.2 ] - symfony: [ ^6.2 ] - pimcore: [ ~11.2.0 ] + php: [ 8.3 ] + symfony: [ ^6.4 ] + pimcore: [ ~11.4.0 ] include: - - pimcore: ~11.2.0 - template_tag: v11.0.0 + - pimcore: ~11.4.0 + template_tag: 2024.3 steps: - uses: actions/checkout@v4 with: diff --git a/.gitignore b/.gitignore index c63d3704..c0725f07 100644 --- a/.gitignore +++ b/.gitignore @@ -40,10 +40,9 @@ atlassian-ide-plugin.xml .project ehthumbs.db Thumbs.db -Vagrantfile -.vagrant php-cgi.core -.sass-cache +/vendor/ +/composer.lock # codeception (only stage *.dist.yml config files) /codeception.yml diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 3f51a10a..b42afe3e 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,12 +1,12 @@ -| Q | A | -|------------------|--------| -| Bug report? | yes/no | -| Feature request? | yes/no | -| BC Break report? | yes/no | -| RFC? | yes/no | +| Q | A +| ---------------- | ----- +| Bug report? | yes/no +| Feature request? | yes/no +| BC Break report? | yes/no +| RFC? | yes/no \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 2e13f556..fb30a261 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,10 +1,14 @@ # License -Copyright (C) 2023 DACHCOM.DIGITAL +Copyright (C) DACHCOM.DIGITAL -This software is available under the GNU General Public License version 3 (GPLv3). +This software is available under two different licenses: +* GNU General Public License version 3 (GPLv3) as Pimcore Community Edition +* DACHCOM Commercial License (DCL) -### GNU General Public License version 3 (GPLv3) -If you decide to choose the GPLv3 license, you must comply with the following terms: +The default FormBuilder Bundle license, without a valid DACHCOM Commercial License agreement, is the Open-Source GPLv3 license. + +## GNU General Public License version 3 (GPLv3) +If you decide to choose the GPLv3 license, you must comply with the following terms: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,10 +17,14 @@ the Free Software Foundation, either version 3 of the License, or This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -[GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.en.html) +## DACHCOM Commercial License (DCL) +Alternatively, commercial and supported versions of the program - also known as +Commercial Distributions - must be used in accordance with the terms and conditions +contained in a separate written agreement between you and DACHCOM.DIGITAL AG. +For more information about the FormBuilder Bundle Commercial License (DCL) please contact dcdi@dachcom.ch. \ No newline at end of file diff --git a/README.md b/README.md index ada55b7e..09759771 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Pimcore FormBuilder -[![Join the chat at https://gitter.im/pimcore/pimcore](https://img.shields.io/gitter/room/pimcore/pimcore.svg?style=flat-square)](https://gitter.im/pimcore/pimcore) [![Software License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg?style=flat-square)](LICENSE.md) +[![Software License](https://img.shields.io/badge/license-DCL-white.svg?style=flat-square&color=%23ff5c5c)](LICENSE.md) [![Latest Release](https://img.shields.io/packagist/v/dachcom-digital/formbuilder.svg?style=flat-square)](https://packagist.org/packages/dachcom-digital/formbuilder) [![Tests](https://img.shields.io/github/actions/workflow/status/dachcom-digital/pimcore-formbuilder/.github/workflows/codeception.yml?branch=master&style=flat-square&logo=github&label=codeception)](https://github.com/dachcom-digital/pimcore-formbuilder/actions?query=workflow%3ACodeception+branch%3Amaster) [![PhpStan](https://img.shields.io/github/actions/workflow/status/dachcom-digital/pimcore-formbuilder/.github/workflows/php-stan.yml?branch=master&style=flat-square&logo=github&label=phpstan%20level%204)](https://github.com/dachcom-digital/pimcore-formbuilder/actions?query=workflow%3A"PHP+Stan"+branch%3Amaster) @@ -12,7 +12,7 @@ | Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch | |---------|-----------------------------------|----------------------------|--------------|----------------|----------------------------------------------------------------------------------| -| **5.x** | `11.0` | `^6.2` | 18.10.2023 | Feature Branch | master | +| **5.x** | `11.0` | `^6.4` | 18.10.2023 | Feature Branch | master | | **4.x** | `10.5`, `10.6` | `^5.4` | 13.10.2021 | Unsupported | [4.x](https://github.com/dachcom-digital/pimcore-formbuilder/tree/4.x) | | **3.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 17.07.2019 | Unsupported | [3.x](https://github.com/dachcom-digital/pimcore-formbuilder/tree/3.x) | | **2.7** | `5.4`, `5.5`, `5.6`, `5.7`, `5.8` | `3.4` | 27.06.2019 | Unsupported | [2.7](https://github.com/dachcom-digital/pimcore-formbuilder/tree/2.7) | @@ -21,7 +21,7 @@ ## Installation ```bash -composer require "dachcom-digital/formbuilder":"~5.1.4" +composer require "dachcom-digital/formbuilder":"~5.2.0" ``` Add Bundle to `bundles.php`: @@ -93,12 +93,13 @@ Nothing to tell here, it's just [Symfony](https://symfony.com/doc/current/templa - [FormBuilder Javascript Plugins](docs/91_Javascript.md) - [Configuration Flags](docs/100_ConfigurationFlags.md) - [Custom form templates](docs/110_CustomTemplates.md) + ## Upgrade Info Before updating, please [check our upgrade notes!](UPGRADE.md) ## License **DACHCOM.DIGITAL AG**, Löwenhofstrasse 15, 9424 Rheineck, Schweiz [dachcom.com](https://www.dachcom.com), dcdi@dachcom.ch -Copyright © 2024 DACHCOM.DIGITAL. All rights reserved. +Copyright © 2025 DACHCOM.DIGITAL. All rights reserved. For licensing details please visit [LICENSE.md](LICENSE.md) diff --git a/UPGRADE.md b/UPGRADE.md index fe47b0ea..24939688 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,6 +1,7 @@ # Upgrade Notes ## 5.2.0 +- **[LICENSE]** Dual-License with GPL and Dachcom Commercial License (DCL) added - **[NEW FEATURE]** Bootstrap 5 Layout Support [@mackrais](https://github.com/dachcom-digital/pimcore-formbuilder/pull/500) - **[NEW FEATURE]** Introduce Channel Context [#486](https://github.com/dachcom-digital/pimcore-formbuilder/issues/486) - **[IMPROVEMENT]** Doctrine ORM 3.0 Support [#503](https://github.com/dachcom-digital/pimcore-formbuilder/pull/503) diff --git a/composer.json b/composer.json index f62aecd4..9acb6b76 100755 --- a/composer.json +++ b/composer.json @@ -1,7 +1,10 @@ { "name": "dachcom-digital/formbuilder", "type": "pimcore-bundle", - "license": "GPL-3.0-or-later", + "license": [ + "GPL-3.0-or-later", + "proprietary" + ], "description": "Pimcore FormBuilder - create forms easily!", "keywords": ["pimcore", "formbuilder"], "homepage": "https://github.com/dachcom-digital/pimcore-formbuilder", @@ -9,7 +12,7 @@ { "name": "DACHCOM.DIGITAL Stefan Hagspiel", "email": "shagspiel@dachcom.ch", - "homepage": "http://www.dachcom.com/", + "homepage": "https://www.dachcom.com", "role": "Developer" } ], @@ -33,16 +36,16 @@ "require": { "php": "^8.2", "pimcore/pimcore": "^11.0", - "symfony/form": "^6.2", - "symfony/intl": "^6.2", - "doctrine/orm": "^2.7" + "symfony/form": "^6.4", + "symfony/intl": "^6.4", + "doctrine/orm": "^2.7 || ^3.0" }, "require-dev": { "codeception/codeception": "^5.0", "codeception/module-symfony": "^3.1", "codeception/module-webdriver": "^4.0", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-symfony": "^1.0", - "symplify/easy-coding-standard": "^9.0" + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-symfony": "^2.0", + "symplify/easy-coding-standard": "~12.2.0" } } diff --git a/ecs.php b/ecs.php index b5e05a8e..169156ba 100644 --- a/ecs.php +++ b/ecs.php @@ -1,162 +1,133 @@ parameters(); - $parameters->set(Option::SETS, [SetList::CLEAN_CODE, SetList::PSR_12]); - - $services = $containerConfigurator->services(); - - $services->set(Fixer\Basic\BracesFixer::class) - ->call('configure', [ - [ - 'allow_single_line_closure' => true, - ] - ]); - - $services->set(Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); - - $services->set(Fixer\Operator\ConcatSpaceFixer::class) - ->call('configure', [ - [ - 'spacing' => 'one', - ] - ]); - - $services->set(Fixer\Operator\NewWithBracesFixer::class); - - $services->set(Fixer\Phpdoc\PhpdocAlignFixer::class) - ->call('configure', [ - [ - 'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], - ] - ]); - - $services->set(Fixer\Operator\BinaryOperatorSpacesFixer::class) - ->call('configure', [ - [ - 'operators' => [ - '=' => 'single_space', - '=>' => 'align', - ] - ] - ]); - $services->set(Fixer\Operator\IncrementStyleFixer::class) - ->call('configure', [ - [ - 'style' => 'post', - ] - ]); - - $services->set(Fixer\Operator\UnaryOperatorSpacesFixer::class); - $services->set(Fixer\Whitespace\BlankLineBeforeStatementFixer::class); - $services->set(Fixer\CastNotation\CastSpacesFixer::class); - $services->set(Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); - $services->set(Fixer\FunctionNotation\FunctionTypehintSpaceFixer::class); - $services->set(Fixer\Comment\SingleLineCommentStyleFixer::class) - ->call('configure', [ - [ - 'comment_types' => ['hash'], - ] - ]); - - $services->set(Fixer\ControlStructure\IncludeFixer::class); - $services->set(Fixer\CastNotation\LowercaseCastFixer::class); - $services->set(Fixer\ClassNotation\ClassAttributesSeparationFixer::class) - ->call('configure', [ - [ - 'elements' => [ - 'const' => 'none', - 'method' => 'one', - 'property' => 'none', - 'trait_import' => 'none' - ], - ] - ]); - - $services->set(Fixer\Casing\NativeFunctionCasingFixer::class); - $services->set(Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); - $services->set(Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer::class); - $services->set(Fixer\Comment\NoEmptyCommentFixer::class); - $services->set(Fixer\Phpdoc\NoEmptyPhpdocFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSeparationFixer::class); - $services->set(Fixer\Semicolon\NoEmptyStatementFixer::class); - $services->set(Fixer\Whitespace\ArrayIndentationFixer::class); - $services->set(Fixer\Whitespace\NoExtraBlankLinesFixer::class) - ->call('configure', [ - [ - 'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'], - ] - ]); - - $services->set(Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); - $services->set(Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer::class); - $services->set(Fixer\CastNotation\NoShortBoolCastFixer::class); - $services->set(Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer::class); - $services->set(Fixer\Whitespace\NoSpacesAroundOffsetFixer::class); - $services->set(Fixer\ControlStructure\NoTrailingCommaInListCallFixer::class); - $services->set(Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class); - $services->set(Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class); - $services->set(Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); - $services->set(Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); - $services->set(Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer::class); - $services->set(Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer::class); - $services->set(Fixer\Phpdoc\PhpdocIndentFixer::class); - $services->set(Fixer\Phpdoc\PhpdocInlineTagFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoAccessFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoPackageFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class); - $services->set(Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer::class); - $services->set(Fixer\Phpdoc\PhpdocScalarFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer::class); - $services->set(Fixer\Phpdoc\PhpdocSummaryFixer::class); - $services->set(Fixer\Phpdoc\PhpdocToCommentFixer::class); - $services->set(Fixer\Phpdoc\PhpdocTrimFixer::class); - $services->set(Fixer\Phpdoc\PhpdocTypesFixer::class); - $services->set(Fixer\Phpdoc\PhpdocVarWithoutNameFixer::class); - $services->set(Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $services->set(Fixer\ClassNotation\SelfAccessorFixer::class); - $services->set(Fixer\CastNotation\ShortScalarCastFixer::class); - $services->set(Fixer\StringNotation\SingleQuoteFixer::class); - $services->set(Fixer\Semicolon\SpaceAfterSemicolonFixer::class); - $services->set(Fixer\Operator\StandardizeNotEqualsFixer::class); - $services->set(Fixer\Operator\TernaryOperatorSpacesFixer::class); - $services->set(Fixer\ArrayNotation\TrimArraySpacesFixer::class); - $services->set(Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class); - - $services->set(Fixer\ClassNotation\ClassDefinitionFixer::class) - ->call('configure', [ - [ - 'single_line' => true, - ] - ]); - - $services->set(Fixer\Casing\MagicConstantCasingFixer::class); - $services->set(Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); - $services->set(Fixer\Alias\NoMixedEchoPrintFixer::class) - ->call('configure', [ - [ - 'use' => 'echo', - ] - ]); - - $services->set(Fixer\Import\NoLeadingImportSlashFixer::class); - $services->set(Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class); - $services->set(Fixer\Phpdoc\PhpdocNoAliasTagFixer::class); - $services->set(Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer::class); - $services->set(Fixer\ClassNotation\SingleClassElementPerStatementFixer::class); - - # new since PHP-CS-Fixer 2.6 - $services->set(Fixer\ClassNotation\NoUnneededFinalMethodFixer::class); - $services->set(Fixer\Semicolon\SemicolonAfterInstructionFixer::class); - - # new since 2.11 - $services->set(Fixer\Operator\StandardizeIncrementFixer::class); -}; \ No newline at end of file +$header = <<
withSets([SetList::CLEAN_CODE, SetList::PSR_12]) + ->withConfiguredRule(Fixer\Comment\HeaderCommentFixer::class, [ + 'header' => $header, + 'comment_type' => 'comment' + ]) + ->withConfiguredRule(Fixer\Basic\BracesFixer::class, [ + 'allow_single_line_closure' => true, + ]) + ->withConfiguredRule(Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ]) + ->withConfiguredRule(Fixer\Phpdoc\PhpdocAlignFixer::class, [ + 'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], + ]) + ->withConfiguredRule(Fixer\Operator\BinaryOperatorSpacesFixer::class, [ + 'operators' => [ + '=' => 'single_space', + '=>' => 'align', + ] + ]) + ->withConfiguredRule(Fixer\Operator\IncrementStyleFixer::class, [ + 'style' => 'post', + ]) + ->withConfiguredRule(Fixer\ClassNotation\ClassAttributesSeparationFixer::class, [ + 'elements' => [ + 'const' => 'none', + 'method' => 'one', + 'property' => 'none', + 'trait_import' => 'none' + ], + ]) + ->withConfiguredRule(Fixer\ClassNotation\ClassDefinitionFixer::class, [ + 'single_line' => true, + ]) + ->withConfiguredRule(Fixer\Comment\SingleLineCommentStyleFixer::class, [ + 'comment_types' => ['hash'], + ]) + ->withConfiguredRule(Fixer\Alias\NoMixedEchoPrintFixer::class, [ + 'use' => 'echo', + ]) + ->withConfiguredRule(Fixer\Basic\NoTrailingCommaInSinglelineFixer::class, [ + 'elements' => ['array_destructuring'] + ]) + ->withConfiguredRule(Fixer\NamespaceNotation\BlankLinesBeforeNamespaceFixer::class, [ + 'min_line_breaks' => 2, + 'max_line_breaks' => 2 + ]) + ->withConfiguredRule(Fixer\Whitespace\TypeDeclarationSpacesFixer::class, [ + 'elements' => ['function'] + ]) + ->withConfiguredRule(Fixer\Whitespace\NoExtraBlankLinesFixer::class, [ + 'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'], + ]) + ->withRules([ + Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class, + Fixer\Operator\NewWithParenthesesFixer::class, + Fixer\Operator\UnaryOperatorSpacesFixer::class, + Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer::class, + Fixer\Operator\StandardizeNotEqualsFixer::class, + Fixer\Operator\TernaryOperatorSpacesFixer::class, + Fixer\Operator\StandardizeIncrementFixer::class, + Fixer\Whitespace\BlankLineBeforeStatementFixer::class, + Fixer\Whitespace\ArrayIndentationFixer::class, + Fixer\Whitespace\NoSpacesAroundOffsetFixer::class, + Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class, + Fixer\CastNotation\CastSpacesFixer::class, + Fixer\CastNotation\LowercaseCastFixer::class, + Fixer\CastNotation\NoShortBoolCastFixer::class, + Fixer\CastNotation\ShortScalarCastFixer::class, + Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class, + Fixer\ControlStructure\IncludeFixer::class, + Fixer\ControlStructure\NoUnneededControlParenthesesFixer::class, + Fixer\Casing\NativeFunctionCasingFixer::class, + Fixer\Casing\MagicConstantCasingFixer::class, + Fixer\Comment\NoEmptyCommentFixer::class, + Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class, + Fixer\Semicolon\NoEmptyStatementFixer::class, + Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer::class, + Fixer\Semicolon\SpaceAfterSemicolonFixer::class, + Fixer\Semicolon\SemicolonAfterInstructionFixer::class, + Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class, + Fixer\ArrayNotation\NormalizeIndexBraceFixer::class, + Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer::class, + Fixer\ArrayNotation\TrimArraySpacesFixer::class, + Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class, + Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer::class, + Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer::class, + Fixer\Phpdoc\PhpdocIndentFixer::class, + Fixer\Phpdoc\PhpdocInlineTagNormalizerFixer::class, + Fixer\Phpdoc\PhpdocNoAccessFixer::class, + Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class, + Fixer\Phpdoc\PhpdocNoPackageFixer::class, + Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class, + Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer::class, + Fixer\Phpdoc\PhpdocScalarFixer::class, + Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer::class, + Fixer\Phpdoc\PhpdocSummaryFixer::class, + Fixer\Phpdoc\PhpdocToCommentFixer::class, + Fixer\Phpdoc\PhpdocTrimFixer::class, + Fixer\Phpdoc\PhpdocTypesFixer::class, + Fixer\Phpdoc\NoEmptyPhpdocFixer::class, + Fixer\Phpdoc\PhpdocSeparationFixer::class, + Fixer\Phpdoc\PhpdocVarWithoutNameFixer::class, + Fixer\Phpdoc\PhpdocNoAliasTagFixer::class, + Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class, + Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, + Fixer\StringNotation\SingleQuoteFixer::class, + Fixer\Import\NoUnusedImportsFixer::class, + Fixer\Import\NoLeadingImportSlashFixer::class, + Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class, + Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class, + Fixer\ClassNotation\SelfAccessorFixer::class, + Fixer\ClassNotation\SingleClassElementPerStatementFixer::class, + Fixer\ClassNotation\NoUnneededFinalMethodFixer::class + ]); \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon index da39d731..7519df8e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,6 +5,5 @@ parameters: - %currentWorkingDirectory%/vendor/pimcore/pimcore/stubs/dynamic-constants.php reportUnmatchedIgnoredErrors: false symfony: - container_xml_path: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml - constant_hassers: false - ignoreErrors: \ No newline at end of file + containerXmlPath: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml + constantHassers: false \ No newline at end of file diff --git a/src/Builder/FrontendFormBuilder.php b/src/Builder/FrontendFormBuilder.php index 9a4e648f..33fd58f0 100644 --- a/src/Builder/FrontendFormBuilder.php +++ b/src/Builder/FrontendFormBuilder.php @@ -95,9 +95,7 @@ public function buildForm( 'form_template' => null ]; - if (is_array($formRuntimeData)) { - $formRuntimeData = array_merge($defaults, $formRuntimeData); - } + $formRuntimeData = array_merge($defaults, $formRuntimeData); /** @var Request $request */ $request = $this->requestStack->getCurrentRequest(); diff --git a/src/Controller/Admin/OutputWorkflowController.php b/src/Controller/Admin/OutputWorkflowController.php index ff83d2b5..82bd6d0d 100644 --- a/src/Controller/Admin/OutputWorkflowController.php +++ b/src/Controller/Admin/OutputWorkflowController.php @@ -200,7 +200,7 @@ public function saveOutputWorkflowAction(Request $request, int $outputWorkflowId if ($form->isValid()) { $this->outputWorkflowManager->saveRawEntity($outputWorkflow); } else { - /** @var FormError $e */ + foreach ($form->getErrors(true, true) as $e) { $errorMessageTemplate = $e->getMessageTemplate(); foreach ($e->getMessageParameters() as $key => $value) { diff --git a/src/Doctrine/Type/FormBuilderFieldsType.php b/src/Doctrine/Type/FormBuilderFieldsType.php index 03b46127..8a9c3eac 100644 --- a/src/Doctrine/Type/FormBuilderFieldsType.php +++ b/src/Doctrine/Type/FormBuilderFieldsType.php @@ -70,7 +70,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): array if ($field['type'] === 'container') { $formField = $this->formDefinitionFactory->createFormFieldContainerDefinition(); $this->populateFormField($formField, $field); - if ($formField instanceof SubFieldsAwareInterface && isset($field['fields']) && is_array($field['fields'])) { + if (isset($field['fields']) && is_array($field['fields'])) { $subFields = []; foreach ($field['fields'] as $subField) { $subFormField = $this->formDefinitionFactory->createFormFieldDefinition(); diff --git a/src/Event/FormAssembleEvent.php b/src/Event/FormAssembleEvent.php index 3ca724cd..c870b963 100644 --- a/src/Event/FormAssembleEvent.php +++ b/src/Event/FormAssembleEvent.php @@ -24,7 +24,7 @@ public function getFormOptionsResolver(): FormOptionsResolver return $this->formOptionsResolver; } - public function getForm(): FormInterface + public function getForm(): ?FormInterface { return $this->form; } diff --git a/src/EventSubscriber/SignalStorage/FormDataSignalStorage.php b/src/EventSubscriber/SignalStorage/FormDataSignalStorage.php index 12d05451..76cd9865 100644 --- a/src/EventSubscriber/SignalStorage/FormDataSignalStorage.php +++ b/src/EventSubscriber/SignalStorage/FormDataSignalStorage.php @@ -41,10 +41,6 @@ public function storeSignal(OutputWorkflowSignalEvent $signal): void $storageToken = $this->funnelData->getStorageToken(); $formStorageData = $this->funnelData->getFormStorageData(); - if (!$formStorageData instanceof FormStorageData) { - throw new \Exception('Cannot store signal without valid FormStorageData'); - } - if ($signal->getName() !== AttachmentStream::SIGNAL_CLEAN_UP) { throw new \Exception(sprintf('FormDataSignalStorage only supports signal events of type "%s"', AttachmentStream::SIGNAL_CLEAN_UP)); } @@ -62,10 +58,6 @@ public function getSignals(): array { $formStorageData = $this->funnelData->getFormStorageData(); - if (!$formStorageData instanceof FormStorageData) { - return []; - } - $restoredAttachmentSignalEvents = []; /** @var FileStack $fileStack */ foreach ($formStorageData->getAttachmentSignals() as $fileStack) { diff --git a/src/Migrations/Version20230830183642.php b/src/Migrations/Version20230830183642.php index 0684600a..54c2acd1 100644 --- a/src/Migrations/Version20230830183642.php +++ b/src/Migrations/Version20230830183642.php @@ -98,7 +98,7 @@ private function migrateMailLayout(array $configuration): ?array return $configuration; } - protected function parseSquareBracketsTag(array $tag): ?string + protected function parseSquareBracketsTag(array $tag): string { $type = $tag[1]; $config = $this->parseSquareBracketsAttributes($tag[2]); diff --git a/src/Model/FormDefinition.php b/src/Model/FormDefinition.php index e900b231..d1de4ad4 100644 --- a/src/Model/FormDefinition.php +++ b/src/Model/FormDefinition.php @@ -47,7 +47,7 @@ public function getName(): string public function setGroup(?string $groupName = null): void { - $this->group = !empty($groupName) && is_string($groupName) ? $groupName : null; + $this->group = !empty($groupName) ? $groupName : null; } public function getGroup(): ?string diff --git a/src/OutputWorkflow/Channel/Object/AbstractObjectResolver.php b/src/OutputWorkflow/Channel/Object/AbstractObjectResolver.php index 5a7e3dad..8b16038e 100644 --- a/src/OutputWorkflow/Channel/Object/AbstractObjectResolver.php +++ b/src/OutputWorkflow/Channel/Object/AbstractObjectResolver.php @@ -152,10 +152,6 @@ protected function processObject(DataObject\Concrete $object): void $formData = $this->formValuesOutputApplier->applyForChannel($this->getForm(), [], 'object', $this->getLocale()); - if (!is_array($formData)) { - return; - } - $this->processObjectData($object, $formData); } @@ -447,15 +443,11 @@ protected function dispatchGuardEvent(mixed $subject): DataObject\Fieldcollectio protected function getObjectFieldDefinition(mixed $object, string $fieldName): ?DataObject\ClassDefinition\Data { if ($object instanceof DataObject\Concrete) { - $classDefinition = $object->getClass(); - if ($classDefinition instanceof DataObject\ClassDefinition) { - return $classDefinition->getFieldDefinition($fieldName); - } - } elseif ($object instanceof DataObject\Fieldcollection\Data\AbstractData) { - $classDefinition = $object->getDefinition(); - if ($classDefinition instanceof DataObject\Fieldcollection\Definition) { - return $classDefinition->getFieldDefinition($fieldName); - } + return $object->getClass()->getFieldDefinition($fieldName); + } + + if ($object instanceof DataObject\Fieldcollection\Data\AbstractData) { + return $object->getDefinition()->getFieldDefinition($fieldName); } return null; diff --git a/src/OutputWorkflow/FunnelWorker.php b/src/OutputWorkflow/FunnelWorker.php index a109f4ba..446b19b1 100644 --- a/src/OutputWorkflow/FunnelWorker.php +++ b/src/OutputWorkflow/FunnelWorker.php @@ -103,10 +103,6 @@ public function processFunnel(OutputWorkflowInterface $outputWorkflow, Request $ { $funnelData = $this->funnelDataResolver->getFunnelData($request); - if (!$funnelData instanceof FunnelData) { - throw new \Exception($request, 'Invalid Funnel Data'); - } - if (!$outputWorkflow->isFunnelWorkflow()) { throw new \Exception(sprintf('Funnel with id %d is not a valid funnel', $outputWorkflow->getId())); } @@ -121,10 +117,6 @@ public function processFunnel(OutputWorkflowInterface $outputWorkflow, Request $ $formStorageData = $funnelData->getFormStorageData(); - if (!$formStorageData instanceof FormStorageData) { - throw new \Exception(sprintf('No storage data for token "%s" found', $storageToken)); - } - // restore submission event to allow seamless output workflow channel processing $submissionEvent = $this->buildSubmissionEvent($request, $outputWorkflow, $formStorageData); diff --git a/src/Validation/ConditionalLogic/Processor/ConditionalLogicProcessor.php b/src/Validation/ConditionalLogic/Processor/ConditionalLogicProcessor.php index d4fbab8a..02ffd48a 100644 --- a/src/Validation/ConditionalLogic/Processor/ConditionalLogicProcessor.php +++ b/src/Validation/ConditionalLogic/Processor/ConditionalLogicProcessor.php @@ -85,10 +85,6 @@ protected function applyActions(bool $validationState, array $actions, array $fo $appliedData = $this->conditionalLogicRegistry->getAction($action['type'])->setValues($action)->apply($validationState, $formData, $ruleId); - if (!$appliedData instanceof ReturnStackInterface) { - continue; - } - //If field is available: only add affected field data to return container! if (!$field instanceof FieldDefinitionInterface) { $returnContainer[] = $appliedData;