From 72f46ee7905ad06a3f3b604a893109632bb0265a Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 09:23:08 +0100 Subject: [PATCH 01/45] [TASK] Drop scheduled ci tasks --- .github/workflows/continuous-integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ceee68cb..8062537a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -7,8 +7,6 @@ on: - production - stage pull_request: - schedule: - - cron: '33 3 * * *' env: COMPOSER_FLAGS: --ansi --no-interaction --no-progress From 17ee9d17c3222dfd2e16af221d9cf4d9e9b2c523 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 09:25:49 +0100 Subject: [PATCH 02/45] [TASK] Add mbstring as dependency --- composer.json | 1 + composer.lock | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ab9cb8ea..ebc13ff4 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "ext-ctype": "*", "ext-iconv": "*", "ext-json": "*", + "ext-mbstring": "*", "ext-sqlite3": "*", "ext-zip": "*", "ext-zlib": "*", diff --git a/composer.lock b/composer.lock index c3a2cae8..22c4e009 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "146b36bf6e37944816c34f6b39329dd7", + "content-hash": "6fcfb20305afa175c6da292c9d01e195", "packages": [ { "name": "composer/ca-bundle", @@ -10756,6 +10756,7 @@ "ext-ctype": "*", "ext-iconv": "*", "ext-json": "*", + "ext-mbstring": "*", "ext-sqlite3": "*", "ext-zip": "*", "ext-zlib": "*" From ed815ab3f084c331a26923d47ab76a866ec69772 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 09:30:27 +0100 Subject: [PATCH 03/45] [TASK] Update actions --- .github/workflows/continuous-integration.yml | 38 ++++++++++---------- .github/workflows/deployment.yml | 4 +-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8062537a..2c2cf4d3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -36,7 +36,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -62,7 +62,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -78,7 +78,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -98,7 +98,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -114,7 +114,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -148,7 +148,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -164,7 +164,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} @@ -194,7 +194,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -210,7 +210,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -232,7 +232,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -248,7 +248,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -270,7 +270,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -286,7 +286,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} @@ -327,7 +327,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -343,7 +343,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} @@ -405,7 +405,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -421,7 +421,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} @@ -474,7 +474,7 @@ jobs: composer global exec php-coveralls -- --coverage_clover=var/log/coverage/clover.xml -vvv --json_path=var/log/coverage/coveralls-upload.json - name: Upload Logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: logs-${{ matrix.php-version }}-${{ matrix.dependencies }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index e60ce5a2..ac4f5ae4 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -48,7 +48,7 @@ jobs: ssh-agent -a $SSH_AUTH_SOCK > /dev/null ssh-add ~/.ssh/deploy_key - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Checkout - name: Set up PHP Version @@ -69,7 +69,7 @@ jobs: composer global exec mage deploy ${{ steps.environment.outputs.target }} - name: Upload Logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: deployment From 5322a3a325eea3886acaa5a41f2f460c99bcac27 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 09:32:57 +0100 Subject: [PATCH 04/45] [BUGFIX] Correct CGL --- src/Service/SitepackageGenerator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Service/SitepackageGenerator.php b/src/Service/SitepackageGenerator.php index 2ab6f84b..7d61a605 100644 --- a/src/Service/SitepackageGenerator.php +++ b/src/Service/SitepackageGenerator.php @@ -29,6 +29,7 @@ use Twig\Environment; use Twig\Loader\ArrayLoader; use ZipArchive; +use RuntimeException; class SitepackageGenerator { @@ -48,7 +49,7 @@ public function create(Sitepackage $package): void $sourceDir = $this->kernel->getProjectDir() . '/resources/packages/' . $package->getBasePackage() . '/' . (string)$package->getTypo3Version() . '/src/'; $tempFileName = tempnam(sys_get_temp_dir(), $this->filename); if ($tempFileName === false) { - throw new \RuntimeException(sprintf('Cannot create temporary name for %s/%s' . sys_get_temp_dir(), $this->filename), 1732123721); + throw new RuntimeException(sprintf('Cannot create temporary name for %s/%s' . sys_get_temp_dir(), $this->filename), 1732123721); } $this->zipPath = $tempFileName; $fileList = FileUtility::listDirectory($sourceDir); From cc9d1b9e30b697a6cf77eafd604fcb7962671303 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 10:23:34 +0100 Subject: [PATCH 05/45] [TASK] Slim down CI --- .github/workflows/continuous-integration.yml | 230 ++++--------------- 1 file changed, 46 insertions(+), 184 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2c2cf4d3..f63397e8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -8,26 +8,18 @@ on: - stage pull_request: -env: - COMPOSER_FLAGS: --ansi --no-interaction --no-progress - COMPOSER_INSTALL_FLAGS: --prefer-dist - COMPOSER_UPDATE_FLAGS: '' - jobs: validation: name: Composer validation runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -48,7 +40,7 @@ jobs: run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Validate composer.json run: composer ci:composer:validate @@ -59,17 +51,14 @@ jobs: json_lint: name: JSON Lint runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -86,8 +75,11 @@ jobs: ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Lint YAML files run: composer ci:json:lint @@ -95,17 +87,14 @@ jobs: yaml_lint: name: YAML Lint runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -122,8 +111,11 @@ jobs: ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Lint YAML files run: composer ci:yaml:lint @@ -131,32 +123,15 @@ jobs: php_lint: name: PHP Lint runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} - - strategy: - fail-fast: false - matrix: - php-version: - - '8.2' - experimental: [false] -# @todo disabled experimental versions -# include: -# - php-version: 'latest' -# experimental: true -# - php-version: 'nightly' -# experimental: true - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On - php-version: ${{ matrix.php-version }} + php-version: '8.2' tools: composer:2 - name: Get Composer Cache Directory @@ -167,21 +142,16 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-composer-${{ matrix.php-version }}- + ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- - - name: Set platform.php for nightly - if: ${{ matrix.php-version == 'nightly' }} - run: | - composer install --no-scripts --ignore-platform-reqs ${{ env.COMPOSER_FLAGS }} - composer config platform.php 8.2.99 - composer bin phpunit config platform.php 8.2.99 - composer update --lock + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Lint PHP files run: composer ci:php:lint @@ -191,17 +161,14 @@ jobs: needs: - php_lint runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -218,8 +185,11 @@ jobs: ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Validation of Rector rules for PHP files run: composer ci:php:rector @@ -229,17 +199,14 @@ jobs: needs: - php_lint runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -256,8 +223,11 @@ jobs: ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Validation of coding standards for PHP files run: composer ci:php:cs @@ -267,17 +237,14 @@ jobs: needs: - php_lint runs-on: ubuntu-latest - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On php-version: '8.2' tools: composer:2 @@ -294,8 +261,11 @@ jobs: ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- + - name: Setup authentication for Composer + run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Validation of coding standards run: composer ci:php:sniff @@ -304,38 +274,16 @@ jobs: name: PHP Stan needs: - php_lint - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} - - strategy: - fail-fast: false - matrix: - php-version: ['8.2'] - dependencies: ['lock'] - experimental: [false] - include: - - php-version: '8.2' - dependencies: 'highest' - experimental: true -# @todo disabled experimental versions -# - php-version: 'latest' -# dependencies: 'highest' -# experimental: true -# - php-version: 'nightly' -# dependencies: 'highest' -# experimental: true - + runs-on: ubuntu-latestcoverage steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: none - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1 - php-version: ${{ matrix.php-version }} + php-version: '8.2' tools: composer:2 - name: Get Composer Cache Directory @@ -346,34 +294,16 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}- - ${{ runner.os }}-composer-${{ matrix.php-version }}- + ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- - name: Setup authentication for Composer run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - name: Allow alpha releases for latest-deps builds to catch problems earlier - if: ${{ matrix.dependencies == 'highest' }} - run: composer config minimum-stability alpha - - - name: Set platform.php for nightly - if: ${{ matrix.php-version == 'nightly' }} - run: | - composer install --no-scripts --ignore-platform-reqs ${{ env.COMPOSER_FLAGS }} - composer config platform.php 8.2.99 - composer bin phpunit config platform.php 8.2.99 - composer update --lock - - name: Install dependencies - if: ${{ matrix.dependencies == 'lock' }} - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} - - - name: Update dependencies - if: ${{ matrix.dependencies != 'lock' }} - run: composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Run PHPStan run: composer ci:php:stan @@ -383,37 +313,15 @@ jobs: needs: - php_lint runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} - - strategy: - fail-fast: false - matrix: - php-version: ['8.2'] - dependencies: ['lock'] - experimental: [false] - include: - - php-version: '8.2' - dependencies: 'highest' - experimental: false -# @todo disabled experimental versions -# - php-version: 'latest' -# dependencies: 'highest' -# experimental: true -# - php-version: 'nightly' -# dependencies: 'highest' -# experimental: true - steps: + - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - coverage: xdebug - extensions: ctype, iconv, json, sqlite3, tokenizer, zip, zlib - ini-values: memory_limit=-1, error_reporting=E_ALL, display_errors=On - php-version: ${{ matrix.php-version }} + php-version: '8.2' tools: composer:2 - name: Get Composer Cache Directory @@ -424,76 +332,31 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}- - ${{ runner.os }}-composer-${{ matrix.php-version }}- + ${{ runner.os }}-composer-latest- ${{ runner.os }}-composer- - name: Setup authentication for Composer run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - name: Allow alpha releases for latest-deps builds to catch problems earlier - if: ${{ matrix.dependencies == 'highest' }} - run: composer config minimum-stability alpha - - - name: Set platform.php for nightly - if: ${{ matrix.php-version == 'nightly' }} - run: | - composer install --no-scripts --ignore-platform-reqs ${{ env.COMPOSER_FLAGS }} - composer config platform.php 8.2.99 - composer bin phpunit config platform.php 8.2.99 - composer update --lock - - name: Install dependencies - if: ${{ matrix.dependencies == 'lock' }} - run: composer install ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} - - - name: Update dependencies - if: ${{ matrix.dependencies != 'lock' }} - run: composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} + run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Unit Tests - continue-on-error: ${{ matrix.experimental }} - if: always() run: composer ci:tests:php:unit - name: Functional Tests - continue-on-error: ${{ matrix.experimental }} - if: always() run: composer ci:tests:php:functional - - name: Upload coverage results to Coveralls - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_PARALLEL: true - COVERALLS_FLAG_NAME: php-${{ matrix.php-version }}-${{ matrix.dependencies }} - run: | - composer exec phpcov -- merge --clover var/log/coverage/clover.xml var/log/coverage - composer global require ${{ env.COMPOSER_INSTALL_FLAGS }} ${{ env.COMPOSER_FLAGS }} php-coveralls/php-coveralls - composer global exec php-coveralls -- --coverage_clover=var/log/coverage/clover.xml -vvv --json_path=var/log/coverage/coveralls-upload.json - - name: Upload Logs uses: actions/upload-artifact@v4 if: always() with: - name: logs-${{ matrix.php-version }}-${{ matrix.dependencies }} + name: logs path: var/log retention-days: 7 - coveralls-finish: - name: Finish Coveralls - needs: - - tests - runs-on: ubuntu-latest - - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true - deployment: name: Deployment needs: @@ -504,7 +367,6 @@ jobs: - php_sniff - php_stan - php_rector - - coveralls-finish if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/deployment.yml secrets: From 436e09628c2624d755dd7da34784cd55a4c4f95a Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 10:35:27 +0100 Subject: [PATCH 06/45] [BUGFIX] Correct runner name --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f63397e8..489218bd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -274,7 +274,7 @@ jobs: name: PHP Stan needs: - php_lint - runs-on: ubuntu-latestcoverage + runs-on: ubuntu-latest steps: - name: Checkout From 86544c65ba4de5098fce7e5456c2d58cc27e80c5 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 10:38:34 +0100 Subject: [PATCH 07/45] [TASK] Drop require checker --- .github/workflows/continuous-integration.yml | 3 --- composer.json | 12 +----------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 489218bd..c2d48c10 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -45,9 +45,6 @@ jobs: - name: Validate composer.json run: composer ci:composer:validate - - name: Check dependencies - run: composer ci:composer:require-checker - json_lint: name: JSON Lint runs-on: ubuntu-latest diff --git a/composer.json b/composer.json index ebc13ff4..d8f275ce 100644 --- a/composer.json +++ b/composer.json @@ -192,19 +192,9 @@ ], "ci:composer": [ "@ci:composer:validate", - "@ci:composer:normalize", - "@ci:composer:require-checker" + "@ci:composer:normalize" ], "ci:composer:normalize": "@composer normalize --dry-run", - "ci:composer:require-checker": [ - "@composer require doctrine/data-fixtures:* doctrine/doctrine-fixtures-bundle:* fakerphp/faker:* --ansi --no-interaction --no-progress", - "@php composer-require-checker --ignore-parse-errors", - "@ci:composer:require-checker:reset" - ], - "ci:composer:require-checker:reset": [ - "@composer remove doctrine/data-fixtures --ansi --no-interaction --no-progress --no-update", - "@composer require doctrine/doctrine-fixtures-bundle:^3.4 fakerphp/faker:^1.20 --dev --ansi --no-interaction --no-progress" - ], "ci:composer:validate": "@composer validate --strict", "ci:dynamic": [ "@ci:tests" From eff9204f134855a1f57e0e1761621ed64efa5011 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 10:49:31 +0100 Subject: [PATCH 08/45] [TASK] Remove rector --- .github/workflows/continuous-integration.yml | 39 ------- .mage.yml | 1 - composer.json | 5 - rector.php | 108 ------------------- src/Entity/Release.php | 3 - src/Entity/Requirement.php | 2 - src/Service/CacheWarmupService.php | 3 - tests/Functional/DatabasePrimer.php | 1 - tools/rector/composer.json | 5 - 9 files changed, 167 deletions(-) delete mode 100644 rector.php delete mode 100644 tools/rector/composer.json diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c2d48c10..7f7303d9 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -153,44 +153,6 @@ jobs: - name: Lint PHP files run: composer ci:php:lint - php_rector: - name: PHP Rector - needs: - - php_lint - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - tools: composer:2 - - - name: Get Composer Cache Directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer-latest- - ${{ runner.os }}-composer- - - - name: Setup authentication for Composer - run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - - name: Install dependencies - run: composer install --prefer-dist --ansi --no-interaction --no-progress - - - name: Validation of Rector rules for PHP files - run: composer ci:php:rector - php_coding_standards: name: PHP Coding Standards needs: @@ -363,7 +325,6 @@ jobs: - php_coding_standards - php_sniff - php_stan - - php_rector if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/deployment.yml secrets: diff --git a/.mage.yml b/.mage.yml index e2d1f4fc..8c7ce9a3 100644 --- a/.mage.yml +++ b/.mage.yml @@ -17,7 +17,6 @@ magephp: - ./phpstan.neon - ./phpunit.xml.dist - ./README.md - - ./rector.php environments: develop: user: get-stage diff --git a/composer.json b/composer.json index d8f275ce..e363f439 100644 --- a/composer.json +++ b/composer.json @@ -202,14 +202,12 @@ "ci:json:lint": "@php jsonlint -q composer.json", "ci:php": [ "@ci:php:lint", - "@ci:php:rector", "@ci:php:cs-fixer", "@ci:php:sniff", "@ci:php:stan" ], "ci:php:cs-fixer": "@php php-cs-fixer fix -v --dry-run --diff", "ci:php:lint": "@php phplint --no-progress", - "ci:php:rector": "@php rector process --dry-run --no-progress-bar || true", "ci:php:sniff": "@php phpcs --standard=PSR12 src tests || true", "ci:php:stan": "@php phpstan analyse --no-progress", "ci:static": [ @@ -232,11 +230,9 @@ "@fix:php" ], "fix:php": [ - "@fix:php:rector", "@fix:php:cs-fixer" ], "fix:php:cs-fixer": "@php php-cs-fixer fix", - "fix:php:rector": "@php rector process --no-diffs", "fix:php:sniff": "phpcbf src", "satis:install": [ "rm -fr satis", @@ -245,7 +241,6 @@ "satis:update": [ "@satis:install" ], - "tools:php:rector": "@php rector process --dry-run", "tools:setup:clean": "rm -r tools/**/composer.lock tools/**/vendor", "tools:setup:install": "@composer bin all install --ansi", "tools:setup:update": "@composer bin all update --ansi" diff --git a/rector.php b/rector.php deleted file mode 100644 index b9e01ff7..00000000 --- a/rector.php +++ /dev/null @@ -1,108 +0,0 @@ -paths([ - __DIR__ . '/migrations', - __DIR__ . '/src', - __DIR__ . '/tests', - __DIR__ . '/.php-cs-fixer.dist.php', - __FILE__, - ]); - - $rectorConfig->bootstrapFiles([ - __DIR__ . '/vendor/autoload.php', - __DIR__ . '/tools/phpunit/vendor/autoload.php', - ]); - - $rectorConfig->sets([ - //LevelSetList::UP_TO_PHP_82, - LevelSetList::UP_TO_PHP_81, - SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION, - SetList::CODE_QUALITY, - SetList::CODING_STYLE, - SetList::DEAD_CODE, - SetList::MONOLOG_20, - //SetList::NAMING, - //SetList::PRIVATIZATION, - SetList::PSR_4, - SetList::TYPE_DECLARATION, - SetList::TYPE_DECLARATION_STRICT, - SetList::EARLY_RETURN, - SetList::RECTOR_CONFIG, - - // Symfony specific rule sets - SymfonyLevelSetList::UP_TO_SYMFONY_54, - SymfonySetList::SYMFONY_STRICT, - SymfonySetList::SYMFONY_CODE_QUALITY, - SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, - - SensiolabsSetList::FRAMEWORK_EXTRA_50, - - // Twig specific rule sets - TwigSetList::TWIG_UNDERSCORE_TO_NAMESPACE, - - // JMS specific rule sets - JMSSetList::REMOVE_JMS_INJECT, - JMSSetList::ANNOTATIONS_TO_ATTRIBUTES, - - // Doctrine specific rule sets - DoctrineSetList::DOCTRINE_25, - DoctrineSetList::DOCTRINE_BEHAVIORS_20, - DoctrineSetList::DOCTRINE_CODE_QUALITY, - DoctrineSetList::DOCTRINE_COMMON_20, - //DoctrineSetList::DOCTRINE_DBAL_211, - DoctrineSetList::DOCTRINE_DBAL_30, - //DoctrineSetList::DOCTRINE_GEDMO_TO_KNPLABS, - //DoctrineSetList::DOCTRINE_REPOSITORY_AS_SERVICE, - DoctrineSetList::DOCTRINE_ORM_29, - DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, - - // PHPUnit specific rule sets - PHPUnitLevelSetList::UP_TO_PHPUNIT_90, - PHPUnitSetList::PHPUNIT_CODE_QUALITY, - PHPUnitSetList::PHPUNIT_EXCEPTION, - PHPUnitSetList::REMOVE_MOCKS, - PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, - PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER, - ]); - - $rectorConfig->skip([ - AddArrayDefaultToArrayPropertyRector::class => [__DIR__ . '/src/Model/SatisJson.php'], - ]); - - $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); -}; diff --git a/src/Entity/Release.php b/src/Entity/Release.php index 831ff302..d8245732 100644 --- a/src/Entity/Release.php +++ b/src/Entity/Release.php @@ -72,9 +72,6 @@ class Release implements JsonSerializable, Stringable #[Serializer\Type("DateTime<'Y-m-d\\TH:i:sP'>")] private DateTimeInterface $date; - /** - * @noRector - */ #[Assert\Choice(callback: [ReleaseTypeEnum::class, 'getAvailableOptions'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] #[Serializer\Groups(['data'])] diff --git a/src/Entity/Requirement.php b/src/Entity/Requirement.php index 54d214be..47cd16b3 100644 --- a/src/Entity/Requirement.php +++ b/src/Entity/Requirement.php @@ -66,8 +66,6 @@ public function __construct( #[ORM\JoinColumn(name: 'version', referencedColumnName: 'version')] private ?MajorVersion $version, /** - * @noRector - * * @OA\Property(example="database") */ #[Assert\Choice(callback: [RequirementCategoryEnum::class, 'getAvailableOptions'])] diff --git a/src/Service/CacheWarmupService.php b/src/Service/CacheWarmupService.php index e3de9e94..1aa0e004 100644 --- a/src/Service/CacheWarmupService.php +++ b/src/Service/CacheWarmupService.php @@ -85,7 +85,6 @@ public function warmUp(string $cacheDir): array $this->warmUpMajorVersions(); - /** @noRector */ $versions = $this->releases->findAll(); $routes = [ 'release_show', @@ -115,7 +114,6 @@ function ($response) use ($url): void { private function warmUpActiveMajorVersions(): void { - /** @noRector */ $versions = $this->majorVersions->findAllActive(); $routes = [ 'majorVersion_show', @@ -125,7 +123,6 @@ private function warmUpActiveMajorVersions(): void private function warmUpMajorVersions(): void { - /** @noRector */ $versions = $this->majorVersions->findAll(); $routes = [ 'app_api_majorversion_releases_getreleasesbymajorversion', diff --git a/tests/Functional/DatabasePrimer.php b/tests/Functional/DatabasePrimer.php index 5c96200c..05ada4a2 100644 --- a/tests/Functional/DatabasePrimer.php +++ b/tests/Functional/DatabasePrimer.php @@ -43,7 +43,6 @@ public static function prime(KernelInterface $kernel): void } // Get the entity manager from the service container - /** @noRector */ $entityManager = $kernel->getContainer()->get('doctrine.orm.entity_manager'); if (!$entityManager instanceof EntityManagerInterface) { throw new LogicException('EntityManager could not be retrieved'); diff --git a/tools/rector/composer.json b/tools/rector/composer.json deleted file mode 100644 index 55d4aed9..00000000 --- a/tools/rector/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "rector/rector": "^0.13.10" - } -} From 1d808d425bea5ed37529ec76e52314c6774d5257 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:21:33 +0100 Subject: [PATCH 09/45] [TASK] Remove normalize, cleanup validate --- .github/workflows/continuous-integration.yml | 2 +- composer.json | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7f7303d9..7733603c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -43,7 +43,7 @@ jobs: run: composer install --prefer-dist --ansi --no-interaction --no-progress - name: Validate composer.json - run: composer ci:composer:validate + run: composer validate --strict json_lint: name: JSON Lint diff --git a/composer.json b/composer.json index e363f439..4eec4c8d 100644 --- a/composer.json +++ b/composer.json @@ -190,12 +190,6 @@ "@ci:static", "@ci:dynamic" ], - "ci:composer": [ - "@ci:composer:validate", - "@ci:composer:normalize" - ], - "ci:composer:normalize": "@composer normalize --dry-run", - "ci:composer:validate": "@composer validate --strict", "ci:dynamic": [ "@ci:tests" ], @@ -211,7 +205,6 @@ "ci:php:sniff": "@php phpcs --standard=PSR12 src tests || true", "ci:php:stan": "@php phpstan analyse --no-progress", "ci:static": [ - "@ci:composer", "@ci:json:lint", "@ci:yaml:lint", "@ci:php" From 87a6b9022aa6b9fb0d8a7a0a3b012eb07c58f34f Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:32:13 +0100 Subject: [PATCH 10/45] [TASK] Use php-cs-fixer config from typo3/typo3 --- .php-cs-fixer.dist.php | 97 ++++++++++++------- .../ExtensionsTerJsonCreateCommand.php | 46 ++++----- src/Command/ListMissingDownloadsCommand.php | 7 +- src/Command/SatisBuildCommand.php | 6 +- src/Command/SatisJsonCreateCommand.php | 5 +- src/Controller/Admin/DashboardController.php | 3 +- .../Admin/MajorVersionCrudController.php | 6 +- .../Admin/ReleaseCrudController.php | 9 +- .../Admin/RequirementCrudController.php | 4 +- src/Controller/Api/AbstractController.php | 16 +-- src/Controller/Api/SitepackageController.php | 6 +- src/Controller/DefaultController.php | 4 +- src/Controller/DownloadController.php | 18 ++-- src/Controller/LoginController.php | 3 +- src/DataFixtures/MajorVersionFixtures.php | 6 +- src/DataFixtures/ReleaseFixtures.php | 11 +-- src/DataFixtures/RequirementFixtures.php | 3 +- src/Entity/Embeddables/Package.php | 3 +- src/Entity/MajorVersion.php | 39 ++++---- src/Entity/Release.php | 20 ++-- src/Entity/Requirement.php | 15 +-- src/Entity/Sitepackage.php | 3 +- src/Entity/Sitepackage/Author.php | 3 +- src/Model/SatisJson.php | 11 +-- src/Repository/MajorVersionRepository.php | 52 +++++----- src/Service/CacheWarmupService.php | 3 +- src/Service/ComposerPackagesService.php | 34 +++---- src/Service/SitepackageGenerator.php | 8 +- src/Twig/Extension/ReleaseNotesExtension.php | 2 +- src/Twig/Extension/RequirementExtension.php | 31 +++--- src/Twig/Filter/ChangeHighlighter.php | 2 +- src/Twig/Filter/CommitLinker.php | 4 +- src/Twig/Filter/Parsedown.php | 2 +- src/Twig/Filter/SortByVersion.php | 4 +- tests/Functional/AbstractCase.php | 7 +- tests/Functional/Controller/Api/ApiCase.php | 3 +- .../Controller/Web/DownloadControllerTest.php | 6 +- .../Controller/Web/JsonControllerTest.php | 9 +- tests/Functional/DatabasePrimer.php | 5 +- .../Fixtures/MajorVersionFixtures.php | 6 +- tests/Functional/Fixtures/ReleaseFixtures.php | 11 +-- tests/Unit/Entity/MajorVersionExpected.php | 10 +- tests/Unit/Entity/MajorVersionTest.php | 11 +-- tests/Unit/Utility/VersionUtilityTest.php | 9 +- tests/bootstrap.php | 11 +-- 45 files changed, 248 insertions(+), 326 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b89bae1f..9e877561 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -49,44 +49,69 @@ true ) ->addRules([ - '@PHP81Migration' => true, - '@PSR12' => true, - 'declare_strict_types' => true, - //'fully_qualified_strict_types' => true, // conflicts currently with Rector - 'global_namespace_import' => [ - 'import_classes' => true, - 'import_constants' => true, - 'import_functions' => true, + '@DoctrineAnnotation' => true, + // @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247 + '@PER-CS1.0' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'cast_spaces' => ['space' => 'none'], + // @todo: Can be dropped once we enable @PER-CS2.0 + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'dir_constant' => true, + // @todo: Can be dropped once we enable @PER-CS2.0 + 'function_declaration' => [ + 'closure_fn_spacing' => 'none', ], - 'no_unneeded_import_alias' => true, - 'phpdoc_align' => true, - 'phpdoc_annotation_without_dot' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag_normalizer' => true, - 'phpdoc_line_span' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_order_by_value' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => true, - 'phpdoc_tag_casing' => true, - 'phpdoc_tag_type' => true, - 'phpdoc_to_comment' => [ - 'ignored_tags' => [ - 'phpstan-ignore-line', - 'phpstan-ignore-next-line', - 'todo', - ], + 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], + 'type_declaration_spaces' => true, + 'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], + 'list_syntax' => ['syntax' => 'short'], + // @todo: Can be dropped once we enable @PER-CS2.0 + 'method_argument_space' => true, + 'modernize_strpos' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_superfluous_elseif' => true, + 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_nullsafe_operator' => true, + 'nullable_type_declaration' => [ + 'syntax' => 'question_mark', ], - 'phpdoc_trim_consecutive_blank_line_separation' => true, - 'phpdoc_types_order' => [ - 'null_adjustment' => 'always_last', - 'sort_algorithm' => 'alpha', - ], - 'phpdoc_var_annotation_correct_order' => true, - 'phpdoc_var_without_name' => true, - 'self_accessor' => true, + 'nullable_type_declaration_for_default_null_value' => true, + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], + 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], + 'php_unit_mock_short_will_return' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_scalar' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'return_type_declaration' => ['space_before' => 'none'], + 'single_quote' => true, + 'single_space_around_construct' => true, + 'single_line_comment_style' => ['comment_types' => ['hash']], + // @todo: Can be dropped once we enable @PER-CS2.0 + 'single_line_empty_body' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], ]) ; $config->getFinder() diff --git a/src/Command/ExtensionsTerJsonCreateCommand.php b/src/Command/ExtensionsTerJsonCreateCommand.php index 64dc8dcc..6d76bd48 100644 --- a/src/Command/ExtensionsTerJsonCreateCommand.php +++ b/src/Command/ExtensionsTerJsonCreateCommand.php @@ -25,18 +25,12 @@ use Composer\Semver\Semver; use Composer\Semver\VersionParser; -use DateTimeImmutable; use GuzzleHttp\Client; -use RuntimeException; -use SimpleXMLElement; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use function is_array; -use function is_string; - /** * @codeCoverageIgnore */ @@ -83,12 +77,12 @@ class ExtensionsTerJsonCreateCommand extends Command private const ALIASES_FILE = 'aliases.json'; /** - * @var array + * @var array */ protected array $extensions = []; /** - * @var array + * @var array */ protected array $extensionKeys = []; @@ -199,7 +193,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var string $outputDir */ $outputDir = $input->getArgument('output-dir'); if (($outputPath = realpath($outputDir)) === false) { - throw new RuntimeException(\sprintf('Path "%s" not found.', $outputDir), 1_660_250_640); + throw new \RuntimeException(\sprintf('Path "%s" not found.', $outputDir), 1_660_250_640); } $this->outputDir = $outputPath; @@ -241,27 +235,27 @@ protected function fetchComposerNames(): void ); $responseBody = $response->getBody()->getContents(); - if (!is_array($json = \json_decode($responseBody, true, 512, JSON_THROW_ON_ERROR))) { - throw new RuntimeException('Invalid response.', 1_660_251_247); + if (!\is_array($json = \json_decode($responseBody, true, 512, JSON_THROW_ON_ERROR))) { + throw new \RuntimeException('Invalid response.', 1_660_251_247); } if ($json['meta'] !== null) { - throw new RuntimeException($json['meta']['error']); + throw new \RuntimeException($json['meta']['error']); } - if (is_array($json['data'])) { + if (\is_array($json['data'])) { // Assign core extensions foreach (self::$coreExtensions as $extKey => $composerName) { $json['data'][$extKey]['composer_name'] = $composerName; } foreach ($json['data'] as $extKey => $settings) { - if (!is_string($extKey)) { - throw new RuntimeException('Invalid extension key.', 1_660_251_470); + if (!\is_string($extKey)) { + throw new \RuntimeException('Invalid extension key.', 1_660_251_470); } - if (!is_string($settings['composer_name'])) { - throw new RuntimeException('Invalid package name.', 1_660_251_471); + if (!\is_string($settings['composer_name'])) { + throw new \RuntimeException('Invalid package name.', 1_660_251_471); } self::$abandonedExtensionKeys[$extKey] = $settings['composer_name']; @@ -287,7 +281,7 @@ protected function saveAliases(): string } /** - * @return SimpleXMLElement[] + * @return \SimpleXMLElement[] */ protected function getExtensions(): array { @@ -302,10 +296,10 @@ protected function getExtensions(): array ] ); if (($extensionsXml = gzdecode($response->getBody()->getContents())) === false) { - throw new RuntimeException('Invalid response.', 1_660_251_597); + throw new \RuntimeException('Invalid response.', 1_660_251_597); } - $extensionsObject = new SimpleXMLElement($extensionsXml); + $extensionsObject = new \SimpleXMLElement($extensionsXml); $this->extensions = $extensionsObject->xpath('/extensions/extension'); $this->initExtensionKeys($this->extensions); } @@ -314,7 +308,7 @@ protected function getExtensions(): array } /** - * @param SimpleXMLElement[] $extensions + * @param \SimpleXMLElement[] $extensions */ protected function initExtensionKeys(array $extensions): void { @@ -328,7 +322,7 @@ protected function initExtensionKeys(array $extensions): void } /** - * @param SimpleXMLElement[] $extensions + * @param \SimpleXMLElement[] $extensions * * @return array&mixed[]>&mixed[]> */ @@ -336,7 +330,7 @@ protected function getPackages(array $extensions): array { $packages = []; //$quarter = mktime(0, 0, 0, floor((date('m') - 1) / 3) * 3 + 1, 1, date('Y')); - $dateTimeToday = new DateTimeImmutable(); + $dateTimeToday = new \DateTimeImmutable(); $new = $dateTimeToday->modify('yesterday')->getTimestamp(); foreach ($extensions as $extension) { @@ -410,7 +404,7 @@ protected function getPackages(array $extensions): array * dist: array * }|array{} */ - protected function getPackageArray(SimpleXMLElement $extension, SimpleXMLElement $version): array + protected function getPackageArray(\SimpleXMLElement $extension, \SimpleXMLElement $version): array { $extKey = (string)$extension['extensionkey']; $autoload = [ @@ -424,7 +418,7 @@ protected function getPackageArray(SimpleXMLElement $extension, SimpleXMLElement ]; if ($version->composerinfo !== null) { $composerInfo = json_decode((string)$version->composerinfo, true, 512); - if (is_array($composerInfo) && is_array($composerInfo['autoload'] ?? null)) { + if (\is_array($composerInfo) && \is_array($composerInfo['autoload'] ?? null)) { $autoload = $composerInfo['autoload']; } } @@ -463,7 +457,7 @@ protected function getPackageArray(SimpleXMLElement $extension, SimpleXMLElement $dependencies = unserialize((string)$version->dependencies); - if (!is_array($dependencies)) { + if (!\is_array($dependencies)) { // Ignore extensions with invalid dependencies return []; } diff --git a/src/Command/ListMissingDownloadsCommand.php b/src/Command/ListMissingDownloadsCommand.php index 011dd70f..4760e284 100644 --- a/src/Command/ListMissingDownloadsCommand.php +++ b/src/Command/ListMissingDownloadsCommand.php @@ -30,7 +30,6 @@ use Symfony\Component\HttpClient\Exception\RedirectionException; use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\Yaml\Yaml; -use Exception; /** * @codeCoverageIgnore @@ -115,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $yaml = Yaml::dump($result, 4); file_put_contents('missing-downloads.yaml', $yaml); } else { - throw new Exception( + throw new \Exception( 'Invalid response with status code ' . $statusCode . ' and content type ' . $contentType ); } @@ -146,7 +145,7 @@ private function getFixedUrl(string $url, string $release, int $format): string } return 'redirect failed for ' . $url; - } catch (Exception $exception) { + } catch (\Exception $exception) { return $exception->getMessage(); } } @@ -158,7 +157,7 @@ private function checkRedirect(string $url): bool try { $client->request('GET', $url, ['max_redirects' => 0]); - throw new Exception('something went wrong while calling ' . $url); + throw new \Exception('something went wrong while calling ' . $url); } catch (RedirectionException) { return true; } catch (ClientException) { diff --git a/src/Command/SatisBuildCommand.php b/src/Command/SatisBuildCommand.php index 0a82d97b..41b236b7 100644 --- a/src/Command/SatisBuildCommand.php +++ b/src/Command/SatisBuildCommand.php @@ -23,7 +23,6 @@ namespace App\Command; -use DateTimeImmutable; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; @@ -32,7 +31,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\Process; -use RuntimeException; /** * @codeCoverageIgnore @@ -99,12 +97,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var bool $autoBuildAll */ $autoBuildAll = $input->getOption('auto'); - if ($autoBuildAll && (new DateTimeImmutable())->format('G') === '3') { + if ($autoBuildAll && (new \DateTimeImmutable())->format('G') === '3') { $buildAll = \true; } if (!($application = $this->getApplication()) instanceof Application) { - throw new RuntimeException('Application is not initialized.', 1_660_125_012); + throw new \RuntimeException('Application is not initialized.', 1_660_125_012); } // Run extensions:ter:json:create diff --git a/src/Command/SatisJsonCreateCommand.php b/src/Command/SatisJsonCreateCommand.php index b949fb2e..5a9d45e6 100644 --- a/src/Command/SatisJsonCreateCommand.php +++ b/src/Command/SatisJsonCreateCommand.php @@ -28,7 +28,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use RuntimeException; /** * @codeCoverageIgnore @@ -75,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (!is_writable($configFile)) { - throw new RuntimeException(sprintf('File "%s" is not writable', $configFile), 1_438_441_994); + throw new \RuntimeException(sprintf('File "%s" is not writable', $configFile), 1_438_441_994); } $repositories = [ @@ -96,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $satis->useProviders(); if (file_put_contents($configFile, (string)$satis) === false) { - throw new RuntimeException(sprintf('File "%s" could not be written, reason unknown', $configFile), 1_438_442_238); + throw new \RuntimeException(sprintf('File "%s" could not be written, reason unknown', $configFile), 1_438_442_238); } $output->writeln(sprintf('Successfully created "%s" with repository dir "%s"', $configFile, $repositoryDir)); diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index 96d0b9de..a40ed37a 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -32,7 +32,6 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; -use Iterator; #[IsGranted('ROLE_ADMIN')] class DashboardController extends AbstractDashboardController @@ -50,7 +49,7 @@ public function configureDashboard(): Dashboard } /** - * @return Iterator<\EasyCorp\Bundle\EasyAdminBundle\Config\Menu\CrudMenuItem|\EasyCorp\Bundle\EasyAdminBundle\Config\Menu\DashboardMenuItem> + * @return \Iterator<\EasyCorp\Bundle\EasyAdminBundle\Config\Menu\CrudMenuItem|\EasyCorp\Bundle\EasyAdminBundle\Config\Menu\DashboardMenuItem> */ public function configureMenuItems(): iterable { diff --git a/src/Controller/Admin/MajorVersionCrudController.php b/src/Controller/Admin/MajorVersionCrudController.php index ae55fc0a..28152ee2 100644 --- a/src/Controller/Admin/MajorVersionCrudController.php +++ b/src/Controller/Admin/MajorVersionCrudController.php @@ -32,10 +32,8 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; -use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; - -use function in_array; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class MajorVersionCrudController extends AbstractCrudController { @@ -64,7 +62,7 @@ public function configureFields(string $pageName): iterable yield TextField::new('title', 'Title'); yield TextField::new('subtitle', 'Subtitle'); - if (in_array($pageName, [Crud::PAGE_DETAIL, Crud::PAGE_EDIT, Crud::PAGE_NEW], true)) { + if (\in_array($pageName, [Crud::PAGE_DETAIL, Crud::PAGE_EDIT, Crud::PAGE_NEW], true)) { yield TextareaField::new('description', 'Description'); } diff --git a/src/Controller/Admin/ReleaseCrudController.php b/src/Controller/Admin/ReleaseCrudController.php index 9d059514..dce6d2be 100644 --- a/src/Controller/Admin/ReleaseCrudController.php +++ b/src/Controller/Admin/ReleaseCrudController.php @@ -35,13 +35,10 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; -use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField; -use function array_flip; -use function in_array; - class ReleaseCrudController extends AbstractCrudController { public static function getEntityFqcn(): string @@ -72,11 +69,11 @@ public function configureFields(string $pageName): iterable yield IdField::new('version', 'Release Version'); yield DateTimeField::new('date', 'Release Date'); yield ChoiceField::new('type', 'Release Type')->setChoices( - static fn () => array_flip(ReleaseTypeEnum::getAvailableOptions(true)) + static fn() => \array_flip(ReleaseTypeEnum::getAvailableOptions(true)) ); yield BooleanField::new('elts', 'ELTS Release'); - if (in_array($pageName, [Crud::PAGE_DETAIL, Crud::PAGE_EDIT, Crud::PAGE_NEW], true)) { + if (\in_array($pageName, [Crud::PAGE_DETAIL, Crud::PAGE_EDIT, Crud::PAGE_NEW], true)) { yield TextField::new('tarPackage.md5sum', 'Tar Package MD5 Checksum'); yield TextField::new('tarPackage.sha1sum', 'Tar Package SHA1 Checksum'); yield TextField::new('tarPackage.sha256sum', 'Tar Package SHA256 Checksum'); diff --git a/src/Controller/Admin/RequirementCrudController.php b/src/Controller/Admin/RequirementCrudController.php index c0372e64..246539bc 100644 --- a/src/Controller/Admin/RequirementCrudController.php +++ b/src/Controller/Admin/RequirementCrudController.php @@ -34,8 +34,6 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; -use function array_flip; - class RequirementCrudController extends AbstractCrudController { public static function getEntityFqcn(): string @@ -70,7 +68,7 @@ public function configureFields(string $pageName): iterable { yield AssociationField::new('version', 'Major Version'); yield ChoiceField::new('category', 'Category')->setChoices( - static fn () => array_flip(RequirementCategoryEnum::getAvailableOptions(true)) + static fn() => \array_flip(RequirementCategoryEnum::getAvailableOptions(true)) ); yield TextField::new('name', 'Name'); yield TextField::new('min', 'Lower Bound'); diff --git a/src/Controller/Api/AbstractController.php b/src/Controller/Api/AbstractController.php index 9dd785c7..e361458c 100644 --- a/src/Controller/Api/AbstractController.php +++ b/src/Controller/Api/AbstractController.php @@ -38,12 +38,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Contracts\Cache\TagAwareCacheInterface; -use DateTime; -use DateTimeImmutable; - -use function iterator_apply; -use function iterator_to_array; -use function is_string; abstract class AbstractController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { @@ -112,13 +106,13 @@ protected function validateObject(object $object): void if ($violations->count() > 0) { $messages = ''; - iterator_apply( + \iterator_apply( $violations, static function (ConstraintViolationInterface $violation) use (&$messages): bool { $messages .= \sprintf("%s: %s\n", $violation->getPropertyPath(), $violation->getMessage()); return true; }, - iterator_to_array($violations) + \iterator_to_array($violations) ); throw new BadRequestHttpException(trim($messages)); @@ -137,12 +131,12 @@ protected function mapObjects(object $baseObject, array $data): void foreach ($metadata->getFieldNames() as $field) { $fieldName = $inflector->tableize($field); - if (array_key_exists($fieldName, $data) && is_string($data[$fieldName])) { + if (array_key_exists($fieldName, $data) && \is_string($data[$fieldName])) { if (isset($metadata->fieldMappings[$field]['type'])) { if ($metadata->fieldMappings[$field]['type'] == 'datetime') { - $data[$fieldName] = new DateTime($data[$fieldName]); + $data[$fieldName] = new \DateTime($data[$fieldName]); } elseif ($metadata->fieldMappings[$field]['type'] == 'datetime_immutable') { - $data[$fieldName] = new DateTimeImmutable($data[$fieldName]); + $data[$fieldName] = new \DateTimeImmutable($data[$fieldName]); } } diff --git a/src/Controller/Api/SitepackageController.php b/src/Controller/Api/SitepackageController.php index cfe39df9..c90d04d2 100644 --- a/src/Controller/Api/SitepackageController.php +++ b/src/Controller/Api/SitepackageController.php @@ -38,8 +38,6 @@ use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\Validation; -use function count; - #[Route(path: '/api/v1/sitepackage', defaults: ['_format' => 'json'])] class SitepackageController extends AbstractController { @@ -81,8 +79,8 @@ protected function validateObject(mixed $object): void ->enableAttributeMapping() ->getValidator(); $errors = $validator->validate($object); - if (count($errors) > 0) { - $errorsString = implode("\n", array_map(static fn (ConstraintViolationInterface $x) => $x->getMessage(), (array)$errors)); + if (\count($errors) > 0) { + $errorsString = implode("\n", array_map(static fn(ConstraintViolationInterface $x) => $x->getMessage(), (array)$errors)); throw new BadRequestHttpException($errorsString); } } diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 5ad5ec09..2c8689b5 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -35,8 +35,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; -use function array_keys; - /** * Regular content and download pages. */ @@ -176,7 +174,7 @@ public function composerHelperAjax(Request $request): JsonResponse throw new BadRequestHttpException('Missing or invalid request body.'); } - $keys = preg_replace('#^(typo3)-#', '$1/', array_keys($formData)); + $keys = preg_replace('#^(typo3)-#', '$1/', \array_keys($formData)); if (!is_array($keys)) { throw new BadRequestHttpException('Missing or invalid request body.'); } diff --git a/src/Controller/DownloadController.php b/src/Controller/DownloadController.php index 571e42d7..17accd31 100644 --- a/src/Controller/DownloadController.php +++ b/src/Controller/DownloadController.php @@ -25,14 +25,10 @@ use App\Entity\Release; use App\Utility\VersionUtility; -use InvalidArgumentException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Throwable; - -use function sprintf; final class DownloadController extends AbstractController { @@ -67,7 +63,7 @@ public function download( // Get information about version to download try { $redirectData = $this->getDownloadRedirect($requestedVersion, $requestedFormat); - } catch (Throwable) { + } catch (\Throwable) { throw $this->createNotFoundException(); } @@ -106,7 +102,7 @@ private function createEltsVersionResponse(Request $request, Release $release): } /** - * @throws InvalidArgumentException + * @throws \InvalidArgumentException * * @return array{ * url: string, @@ -131,7 +127,7 @@ private function getDownloadRedirect(string $versionName, string $format): array $content = $this->legacyDataService->getReleaseJson(); $releases = json_decode($content, true, 512, JSON_THROW_ON_ERROR); if (!is_array($releases)) { - throw new InvalidArgumentException('Error while decoding the release json.', 1_638_038_670); + throw new \InvalidArgumentException('Error while decoding the release json.', 1_638_038_670); } // defaults @@ -168,7 +164,7 @@ private function getDownloadRedirect(string $versionName, string $format): array // named version detection if ($versionName === 'stable') { if (!isset($releases['latest_stable'])) { - throw new InvalidArgumentException('Invalid release json.', 1_638_038_671); + throw new \InvalidArgumentException('Invalid release json.', 1_638_038_671); } $versionName = $releases['latest_stable']; @@ -184,7 +180,7 @@ private function getDownloadRedirect(string $versionName, string $format): array if ($isValidVersion && in_array($format, ['tar.gz', 'zip', 'tar.gz.sig', 'zip.sig'], true)) { $branchName = (int)$versionParts[0] >= 7 ? $versionParts[0] : $versionParts[0] . '.' . $versionParts[1]; if (!isset($releases[$branchName])) { - throw new InvalidArgumentException('Invalid release json.', 1_638_038_672); + throw new \InvalidArgumentException('Invalid release json.', 1_638_038_672); } $branch = $releases[$branchName]; @@ -220,8 +216,8 @@ private function getDownloadRedirect(string $versionName, string $format): array } } - throw new InvalidArgumentException( - sprintf('No download found for version %s with format %s.', $versionName, $format), + throw new \InvalidArgumentException( + \sprintf('No download found for version %s with format %s.', $versionName, $format), 1_660_745_735 ); } diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index 1e743ebb..d11b5e1e 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -26,7 +26,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Exception; class LoginController extends AbstractController { @@ -51,6 +50,6 @@ public function index(): Response public function logout(): void { // controller can be blank: it will never be called! - throw new Exception("Don't forget to activate logout in security.yaml"); + throw new \Exception("Don't forget to activate logout in security.yaml"); } } diff --git a/src/DataFixtures/MajorVersionFixtures.php b/src/DataFixtures/MajorVersionFixtures.php index a9fa71d7..3baf4073 100644 --- a/src/DataFixtures/MajorVersionFixtures.php +++ b/src/DataFixtures/MajorVersionFixtures.php @@ -28,8 +28,6 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Persistence\ObjectManager; use Faker\Factory as FakerFactory; -use DateTimeImmutable; -use Iterator; final class MajorVersionFixtures extends Fixture { @@ -90,12 +88,12 @@ public static function getVersions(): array } /** - * @return Iterator + * @return \Iterator */ protected function getData(): iterable { $faker = FakerFactory::create(); - $today = new DateTimeImmutable(); + $today = new \DateTimeImmutable(); yield new MajorVersionFixturesData( self::MAJOR_VERSION_SPRINT, diff --git a/src/DataFixtures/ReleaseFixtures.php b/src/DataFixtures/ReleaseFixtures.php index 130babb4..20182337 100644 --- a/src/DataFixtures/ReleaseFixtures.php +++ b/src/DataFixtures/ReleaseFixtures.php @@ -31,9 +31,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; -use DateTime; -use DateTimeInterface; -use RuntimeException; final class ReleaseFixtures extends Fixture implements DependentFixtureInterface { @@ -86,13 +83,13 @@ protected function generateReleasesForMajorVersion( $fakeVersion[1] = $faker->numberBetween($versionData[1], $ltsVersionData[1]); $fakeVersion[2] = $i; $version = implode('.', $fakeVersion); - $date = DateTime::createFromFormat( - DateTimeInterface::ATOM, - $majorVersion->getReleaseDate()->modify('+' . ($i * 3) . ' months')->format(DateTimeInterface::ATOM) + $date = \DateTime::createFromFormat( + \DateTimeInterface::ATOM, + $majorVersion->getReleaseDate()->modify('+' . ($i * 3) . ' months')->format(\DateTimeInterface::ATOM) ); if ($date === false) { - throw new RuntimeException('Can not calculate date.', 1_624_354_915); + throw new \RuntimeException('Can not calculate date.', 1_624_354_915); } $release = new Release(); diff --git a/src/DataFixtures/RequirementFixtures.php b/src/DataFixtures/RequirementFixtures.php index 47a6cc01..882e225a 100644 --- a/src/DataFixtures/RequirementFixtures.php +++ b/src/DataFixtures/RequirementFixtures.php @@ -29,7 +29,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; -use Iterator; final class RequirementFixtures extends Fixture implements DependentFixtureInterface { @@ -68,7 +67,7 @@ public function getDependencies(): array } /** - * @return Iterator + * @return \Iterator */ protected function getData(): iterable { diff --git a/src/Entity/Embeddables/Package.php b/src/Entity/Embeddables/Package.php index f964fbc5..9db4755c 100644 --- a/src/Entity/Embeddables/Package.php +++ b/src/Entity/Embeddables/Package.php @@ -27,10 +27,9 @@ use JMS\Serializer\Annotation as Serializer; use OpenApi\Annotations as OA; use Symfony\Component\Validator\Constraints as Assert; -use JsonSerializable; #[ORM\Embeddable] -class Package implements JsonSerializable +class Package implements \JsonSerializable { public function __construct( /** diff --git a/src/Entity/MajorVersion.php b/src/Entity/MajorVersion.php index ba8b7443..ec9d0094 100644 --- a/src/Entity/MajorVersion.php +++ b/src/Entity/MajorVersion.php @@ -31,9 +31,6 @@ use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use OpenApi\Annotations as OA; -use JsonSerializable; -use DateTimeImmutable; -use Stringable; /** * @OA\Schema( @@ -43,7 +40,7 @@ */ #[ORM\Entity(repositoryClass: MajorVersionRepository::class)] #[ORM\EntityListeners([MajorVersionListener::class])] -class MajorVersion implements JsonSerializable, Stringable +class MajorVersion implements \JsonSerializable, \Stringable { /** * For example 7 or 8 or 4.3. @@ -57,7 +54,7 @@ class MajorVersion implements JsonSerializable, Stringable public static function create(float $version = 0.0): self { - $now = (new DateTimeImmutable())->setTime(0, 0, 0); + $now = (new \DateTimeImmutable())->setTime(0, 0, 0); $emptyCollection = new ArrayCollection(); return new self( $version, @@ -106,7 +103,7 @@ public function __construct( #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] #[Serializer\Groups(['data', 'content', 'patch'])] #[Serializer\Type("DateTimeImmutable<'Y-m-d\\TH:i:sP'>")] - private DateTimeImmutable $releaseDate, + private \DateTimeImmutable $releaseDate, /** * @OA\Property(example="2017-12-12T16:48:22+00:00") * @@ -115,21 +112,21 @@ public function __construct( #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] #[Serializer\Groups(['data', 'content', 'patch'])] #[Serializer\Type("DateTimeImmutable<'Y-m-d\\TH:i:sP'>")] - private ?DateTimeImmutable $regularMaintenanceUntil, + private ?\DateTimeImmutable $regularMaintenanceUntil, /** * @OA\Property(example="2017-12-12T16:48:22+00:00") */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] #[Serializer\Groups(['data', 'content', 'patch'])] #[Serializer\Type("DateTimeImmutable<'Y-m-d\\TH:i:sP'>")] - private ?DateTimeImmutable $maintainedUntil, + private ?\DateTimeImmutable $maintainedUntil, /** * @OA\Property(example="2017-12-12T16:48:22+00:00") */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] #[Serializer\Groups(['data', 'content', 'patch'])] #[Serializer\Type("DateTimeImmutable<'Y-m-d\\TH:i:sP'>")] - private ?DateTimeImmutable $eltsUntil, + private ?\DateTimeImmutable $eltsUntil, /** * @var Collection */ @@ -220,44 +217,44 @@ public function getDescription(): string return $this->description; } - public function setRegularMaintenanceUntil(?DateTimeImmutable $regularMaintenanceUntil): void + public function setRegularMaintenanceUntil(?\DateTimeImmutable $regularMaintenanceUntil): void { $this->regularMaintenanceUntil = $regularMaintenanceUntil; } - public function getRegularMaintenanceUntil(): ?DateTimeImmutable + public function getRegularMaintenanceUntil(): ?\DateTimeImmutable { return $this->regularMaintenanceUntil; } - public function setMaintainedUntil(?DateTimeImmutable $maintainedUntil): void + public function setMaintainedUntil(?\DateTimeImmutable $maintainedUntil): void { $this->maintainedUntil = $maintainedUntil; } - public function getMaintainedUntil(): ?DateTimeImmutable + public function getMaintainedUntil(): ?\DateTimeImmutable { return $this->maintainedUntil; } - public function setEltsUntil(?DateTimeImmutable $eltsUntil): void + public function setEltsUntil(?\DateTimeImmutable $eltsUntil): void { $this->eltsUntil = $eltsUntil; } - public function getEltsUntil(): ?DateTimeImmutable + public function getEltsUntil(): ?\DateTimeImmutable { return $this->eltsUntil ?? ( $this->getMaintainedUntil() !== null ? $this->getMaintainedUntil()->modify('+3 years') : null ); } - public function setReleaseDate(DateTimeImmutable $releaseDate): void + public function setReleaseDate(\DateTimeImmutable $releaseDate): void { $this->releaseDate = $releaseDate; } - public function getReleaseDate(): DateTimeImmutable + public function getReleaseDate(): \DateTimeImmutable { return $this->releaseDate; } @@ -267,7 +264,7 @@ public function getLatestRelease(): ?Release $array = $this->releases->toArray(); usort( $array, - static fn ($a, $b): int => version_compare($b->getVersion(), $a->getVersion()) + static fn($a, $b): int => version_compare($b->getVersion(), $a->getVersion()) ); return $array !== [] ? reset($array) : null; } @@ -305,7 +302,7 @@ public function getLts(): ?float public function isActive(): bool { - $dateTime = new DateTimeImmutable(); + $dateTime = new \DateTimeImmutable(); if ($this->getMaintainedUntil() === null) { return true; } @@ -315,7 +312,7 @@ public function isActive(): bool public function isElts(): bool { - $dateTime = new DateTimeImmutable(); + $dateTime = new \DateTimeImmutable(); if ($this->getMaintainedUntil() == null) { return false; } @@ -381,7 +378,7 @@ public function jsonSerialize(): array uksort( $releaseData, - static fn (string $a, string $b): int => version_compare($a, $b) + static fn(string $a, string $b): int => version_compare($a, $b) ); $desc = array_reverse($releaseData); $latest = $this->getLatestRelease(); diff --git a/src/Entity/Release.php b/src/Entity/Release.php index d8245732..71334cb6 100644 --- a/src/Entity/Release.php +++ b/src/Entity/Release.php @@ -32,12 +32,6 @@ use JMS\Serializer\Annotation as Serializer; use OpenApi\Annotations as OA; use Symfony\Component\Validator\Constraints as Assert; -use JsonSerializable; -use DateTimeInterface; -use InvalidArgumentException; -use DateTimeImmutable; -use DateTime; -use Stringable; /** * @OA\Schema( @@ -47,7 +41,7 @@ */ #[ORM\Entity(repositoryClass: ReleaseRepository::class)] #[ORM\EntityListeners([ReleaseListener::class])] -class Release implements JsonSerializable, Stringable +class Release implements \JsonSerializable, \Stringable { /** * Version in a semver/version_compare compatible format. @@ -65,12 +59,12 @@ class Release implements JsonSerializable, Stringable /** * @OA\Property(example="2017-12-12T16:48:22+00:00") * - * @var DateTime|DateTimeImmutable + * @var \DateTime|\DateTimeImmutable */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] #[Serializer\Groups(['data', 'content'])] #[Serializer\Type("DateTime<'Y-m-d\\TH:i:sP'>")] - private DateTimeInterface $date; + private \DateTimeInterface $date; #[Assert\Choice(callback: [ReleaseTypeEnum::class, 'getAvailableOptions'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] @@ -129,15 +123,15 @@ public function getReleaseNotes(): ReleaseNotes return $this->releaseNotes; } - public function setDate(DateTime|DateTimeImmutable $date): void + public function setDate(\DateTime|\DateTimeImmutable $date): void { $this->date = $date; } /** - * @return DateTime|DateTimeImmutable + * @return \DateTime|\DateTimeImmutable */ - public function getDate(): DateTimeInterface + public function getDate(): \DateTimeInterface { return $this->date; } @@ -175,7 +169,7 @@ public function setMajorVersion(MajorVersion $majorVersion): void public function setType(string $type): void { if (!in_array($type, ReleaseTypeEnum::getAvailableOptions(), true)) { - throw new InvalidArgumentException('Invalid type'); + throw new \InvalidArgumentException('Invalid type'); } $this->type = $type; diff --git a/src/Entity/Requirement.php b/src/Entity/Requirement.php index 47cd16b3..70c8e83f 100644 --- a/src/Entity/Requirement.php +++ b/src/Entity/Requirement.php @@ -30,11 +30,6 @@ use JMS\Serializer\Annotation as Serializer; use OpenApi\Annotations as OA; use Symfony\Component\Validator\Constraints as Assert; -use JsonSerializable; -use InvalidArgumentException; -use Stringable; - -use function ucfirst; /** * @OA\Schema( @@ -45,9 +40,9 @@ #[ORM\Entity(repositoryClass: RequirementRepository::class)] #[ORM\EntityListeners([RequirementListener::class])] #[ORM\UniqueConstraint(columns: ['version', 'category', 'name'])] -class Requirement implements JsonSerializable, Stringable +class Requirement implements \JsonSerializable, \Stringable { - public static function create(MajorVersion $version = null): self + public static function create(?MajorVersion $version = null): self { return new self( null, @@ -110,7 +105,7 @@ public function getVersion(): ?MajorVersion public function setCategory(string $category): void { if (!in_array($category, RequirementCategoryEnum::getAvailableOptions(), true)) { - throw new InvalidArgumentException('Invalid category'); + throw new \InvalidArgumentException('Invalid category'); } $this->category = $category; @@ -142,7 +137,7 @@ public function getTitle(): string 'mariadb' => 'MariaDB', 'sqlite' => 'SQLite', 'ram' => 'RAM', - default => ucfirst($this->getName()), + default => \ucfirst($this->getName()), }; } @@ -176,7 +171,7 @@ public function jsonSerialize(): array public function __toString(): string { - $result = ucfirst($this->getCategory()) . ' / ' . $this->getTitle(); + $result = \ucfirst($this->getCategory()) . ' / ' . $this->getTitle(); if (($min = $this->getMin()) !== \null) { $result .= ': ' . $min; diff --git a/src/Entity/Sitepackage.php b/src/Entity/Sitepackage.php index e25b1a60..e3b06272 100644 --- a/src/Entity/Sitepackage.php +++ b/src/Entity/Sitepackage.php @@ -27,12 +27,11 @@ use JMS\Serializer\Annotation as Serializer; use OpenApi\Attributes as OA; use Symfony\Component\Validator\Constraints as Assert; -use JsonSerializable; /** * Sitepackage. */ -class Sitepackage implements JsonSerializable +class Sitepackage implements \JsonSerializable { #[Assert\NotBlank] #[Assert\Choice(['bootstrap_package', 'fluid_styled_content'])] diff --git a/src/Entity/Sitepackage/Author.php b/src/Entity/Sitepackage/Author.php index 8282cb48..bb59ff33 100644 --- a/src/Entity/Sitepackage/Author.php +++ b/src/Entity/Sitepackage/Author.php @@ -26,12 +26,11 @@ use JMS\Serializer\Annotation as Serializer; use OpenApi\Attributes as OA; use Symfony\Component\Validator\Constraints as Assert; -use JsonSerializable; /** * Author. */ -class Author implements JsonSerializable +class Author implements \JsonSerializable { #[Assert\NotBlank(message: "Please enter the authors' name.")] #[Assert\Length(min: 3)] diff --git a/src/Model/SatisJson.php b/src/Model/SatisJson.php index b11b4b9f..89ab4915 100644 --- a/src/Model/SatisJson.php +++ b/src/Model/SatisJson.php @@ -23,15 +23,10 @@ namespace App\Model; -use Stringable; -use InvalidArgumentException; - -use function json_encode; - /** * @codeCoverageIgnore */ -class SatisJson implements Stringable +class SatisJson implements \Stringable { /** * @var array{ @@ -52,7 +47,7 @@ class SatisJson implements Stringable public function __construct($name) { if (!is_string($name)) { - throw new InvalidArgumentException(sprintf( + throw new \InvalidArgumentException(sprintf( 'Argument "$name" must be of type "string", "%s" given', gettype($name) )); @@ -121,6 +116,6 @@ public function __toString(): string unset($this->data['require']); } - return (string)json_encode($this->data, JSON_PRETTY_PRINT); + return (string)\json_encode($this->data, JSON_PRETTY_PRINT); } } diff --git a/src/Repository/MajorVersionRepository.php b/src/Repository/MajorVersionRepository.php index 24efffd0..e333ff46 100644 --- a/src/Repository/MajorVersionRepository.php +++ b/src/Repository/MajorVersionRepository.php @@ -28,10 +28,6 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Common\Collections\Criteria; use Doctrine\Persistence\ManagerRegistry; -use RuntimeException; -use DateTimeImmutable; - -use function in_array; /** * @extends ServiceEntityRepository @@ -70,13 +66,13 @@ public function findVersion(string $version): ?MajorVersion } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array */ public function findAllActive(): array { - $date = (new DateTimeImmutable())->format('Y-m-d'); + $date = (new \DateTimeImmutable())->format('Y-m-d'); $qb = $this->createQueryBuilder('m'); $qb->where( $qb->expr()->orX( @@ -92,20 +88,20 @@ public function findAllActive(): array $qb->addOrderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_065); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_065); } return $this->removeVersionsWithoutReleases($result); } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array */ public function findAllActiveCommunity(): array { - $date = (new DateTimeImmutable())->format('Y-m-d'); + $date = (new \DateTimeImmutable())->format('Y-m-d'); $qb = $this->createQueryBuilder('m'); $qb->where( $qb->expr()->orX( @@ -117,20 +113,20 @@ public function findAllActiveCommunity(): array $qb->addOrderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_066); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_066); } return $this->removeVersionsWithoutReleases($result); } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array */ public function findAllActiveElts(): array { - $date = (new DateTimeImmutable())->format('Y-m-d'); + $date = (new \DateTimeImmutable())->format('Y-m-d'); $qb = $this->createQueryBuilder('m'); $qb->where( $qb->expr()->andX( @@ -142,7 +138,7 @@ public function findAllActiveElts(): array $qb->addOrderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_067); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_067); } return $result; @@ -172,7 +168,7 @@ public function findAllGroupedByMajor(): array uksort( $data, - static fn (string $a, string $b): int => version_compare($a, $b) + static fn(string $a, string $b): int => version_compare($a, $b) ); return array_reverse($data); } @@ -190,13 +186,13 @@ public function findCommunityVersionsGroupedByMajor(): array uksort( $data, - static fn (string $a, string $b): int => version_compare($a, $b) + static fn(string $a, string $b): int => version_compare($a, $b) ); return array_reverse($data); } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array */ @@ -210,14 +206,14 @@ public function findAllComposerSupported(): array $qb->addOrderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_068); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_068); } return $result; } /** - * @throws RuntimeException + * @throws \RuntimeException */ public function findLatestLtsComposerSupported(): ?MajorVersion { @@ -232,14 +228,14 @@ public function findLatestLtsComposerSupported(): ?MajorVersion $qb->setMaxResults(1)->orderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_069); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_069); } return array_pop($result); } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array{latest_stable: string, latest_old_stable: string|null} */ @@ -249,13 +245,13 @@ private function findStableReleases(): array $qb->setMaxResults(2)->orderBy('m.version', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_070); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_070); } $result = $this->removeVersionsWithoutReleases($result); if (!($latestMajor = reset($result)) instanceof MajorVersion) { - throw new RuntimeException('No version found.', 1_638_022_071); + throw new \RuntimeException('No version found.', 1_638_022_071); } $releases = $this->majorVersionDescending($latestMajor); @@ -268,13 +264,13 @@ private function findStableReleases(): array } /** - * @throws RuntimeException + * @throws \RuntimeException * * @return array{latest_lts: string, latest_old_lts: string} */ private function findLtsReleases(): array { - $date = (new DateTimeImmutable())->format('Y-m-d'); + $date = (new \DateTimeImmutable())->format('Y-m-d'); $qb = $this->createQueryBuilder('m'); $qb->setMaxResults(2) ->where( @@ -286,7 +282,7 @@ private function findLtsReleases(): array $qb->orderBy('m.maintainedUntil', Criteria::DESC); if (!is_array($result = $qb->getQuery()->execute())) { - throw new RuntimeException('Query not returned an array type.', 1_638_022_071); + throw new \RuntimeException('Query not returned an array type.', 1_638_022_071); } $latestLts = array_shift($result); @@ -313,7 +309,7 @@ private function formatVersion(float|int|string $version): string { $version = (string)$version; if (!str_contains($version, '.')) { - if (in_array((int)$version, [7, 8, 9, 10, 11, 12, 13], true)) { + if (\in_array((int)$version, [7, 8, 9, 10, 11, 12, 13], true)) { $version .= '.0000'; } else { $version .= '.0'; @@ -326,7 +322,7 @@ private function formatVersion(float|int|string $version): string private function removeEltsReleases(MajorVersion $version): MajorVersion { $version->setReleases($version->getReleases()->filter( - static fn (Release $release): bool => !$release->isElts() + static fn(Release $release): bool => !$release->isElts() )); return $version; @@ -341,7 +337,7 @@ private function majorVersionDescending(MajorVersion $version): array usort( $releases, - static fn (Release $a, Release $b): int => version_compare($b->getVersion(), $a->getVersion()) + static fn(Release $a, Release $b): int => version_compare($b->getVersion(), $a->getVersion()) ); return $releases; diff --git a/src/Service/CacheWarmupService.php b/src/Service/CacheWarmupService.php index 1aa0e004..b46fe58f 100644 --- a/src/Service/CacheWarmupService.php +++ b/src/Service/CacheWarmupService.php @@ -33,7 +33,6 @@ use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\Routing\RouterInterface; -use Exception; class CacheWarmupService implements CacheWarmerInterface { @@ -156,7 +155,7 @@ private function warmUpLoopWithVersions(array $routes, array $versions): void try { $promise->wait(); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->logger->warning($exception->getMessage(), $exception->getTrace()); } } diff --git a/src/Service/ComposerPackagesService.php b/src/Service/ComposerPackagesService.php index d0cac64f..77c1cf2b 100644 --- a/src/Service/ComposerPackagesService.php +++ b/src/Service/ComposerPackagesService.php @@ -32,12 +32,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; -use RuntimeException; - -use function is_null; -use function ltrim; -use function preg_match; -use function sprintf; final class ComposerPackagesService { @@ -759,12 +753,12 @@ public function buildForm(FormBuilderInterface $builder): FormInterface { $majorVersion = $this->majorVersions->findLatestLtsComposerSupported(); if (!$majorVersion instanceof MajorVersion) { - throw new RuntimeException('No LTS release with Composer support found.', 1_624_353_394); + throw new \RuntimeException('No LTS release with Composer support found.', 1_624_353_394); } $release = $majorVersion->getLatestRelease(); if (!$release instanceof Release) { - throw new RuntimeException('No release found.', 1_624_353_494); + throw new \RuntimeException('No release found.', 1_624_353_494); } $versionChoices = [ @@ -789,7 +783,7 @@ public function buildForm(FormBuilderInterface $builder): FormInterface foreach ($versions as $version) { if ( - $version->getLatestRelease() instanceof Release && preg_match( + $version->getLatestRelease() instanceof Release && \preg_match( '#^(\d+)\.(\d+)\.(\d+)#', $version->getLatestRelease()->getVersion(), $matches @@ -798,7 +792,7 @@ public function buildForm(FormBuilderInterface $builder): FormInterface $nextMinor = $matches[1] . '.' . (((int)$matches[2]) + 1); $nextPatch = $matches[1] . '.' . $matches[2] . '.' . (((int)$matches[3]) + 1); - if (is_null($version->getLatestRelease()->getMajorVersion()->getLts())) { + if (\is_null($version->getLatestRelease()->getMajorVersion()->getLts())) { $versionChoices['choices'][self::SPECIAL_VERSIONS_GROUP] [$version->getTitle() . ' - next minor release (' . $nextMinor . ')'] = $this->getComposerVersionConstraint($nextMinor, true); @@ -847,7 +841,7 @@ public function getBundles(): array $sanitizedBundles = []; foreach (self::BUNDLES as $bundleName => $packages) { $sanitizedBundles[$bundleName] = Utils::jsonEncode( - array_map(static fn ($name): string => str_replace('/', '-', $name), $packages) + array_map(static fn($name): string => str_replace('/', '-', $name), $packages) ); } @@ -863,21 +857,21 @@ public function cleanPackagesForVersions(array $packages): array { $stability = 'stable'; - if (is_string($version = $packages['typo3_version']) && preg_match('#^\^(\d+)#', $version, $matches) > 0) { + if (is_string($version = $packages['typo3_version']) && \preg_match('#^\^(\d+)#', $version, $matches) > 0) { $stability = VersionParser::parseStability($version); $majorVersion = (int)$matches[1]; } else { $composerVersions = $this->majorVersions->findAllComposerSupported(); if ($composerVersions === []) { - throw new RuntimeException('No release found.', 1_624_353_639); + throw new \RuntimeException('No release found.', 1_624_353_639); } $release = $composerVersions[0]->getLatestRelease(); if (!$release instanceof Release) { - throw new RuntimeException('No release found.', 1_624_353_801); + throw new \RuntimeException('No release found.', 1_624_353_801); } - preg_match('#^\d+#', $release->getVersion(), $matches); + \preg_match('#^\d+#', $release->getVersion(), $matches); $majorVersion = (int)$matches[0]; } @@ -894,7 +888,7 @@ public function cleanPackagesForVersions(array $packages): array if (array_key_exists($packageName, $packages) && $packages[$packageName] === true) { if ($version !== '*' && $packageName === 'typo3/minimal') { - $packageVersion = sprintf('^%s', $majorVersion); + $packageVersion = \sprintf('^%s', $majorVersion); if ($stability !== 'stable') { $packageVersion .= '@' . $stability; } @@ -903,14 +897,14 @@ public function cleanPackagesForVersions(array $packages): array } if ($version === '') { - $composerPackages .= sprintf(' "%s"', $packageName); + $composerPackages .= \sprintf(' "%s"', $packageName); } else { - $composerPackages .= sprintf(' "%s:%s"', $packageName, $packageVersion); + $composerPackages .= \sprintf(' "%s:%s"', $packageName, $packageVersion); } } } - $packages['composer_packages'] = ltrim($composerPackages); + $packages['composer_packages'] = \ltrim($composerPackages); return $packages; } @@ -933,7 +927,7 @@ private function getComposerVersionConstraint(string $version, bool $development { if ($development) { $result = '^' . $version . '@dev'; - } elseif (preg_match('#^\d+\.\d+#', $version, $matches) > 0) { + } elseif (\preg_match('#^\d+\.\d+#', $version, $matches) > 0) { $result = '^' . $matches[0]; } else { $result = ''; diff --git a/src/Service/SitepackageGenerator.php b/src/Service/SitepackageGenerator.php index 7d61a605..5da216c0 100644 --- a/src/Service/SitepackageGenerator.php +++ b/src/Service/SitepackageGenerator.php @@ -28,8 +28,6 @@ use Symfony\Component\HttpKernel\KernelInterface; use Twig\Environment; use Twig\Loader\ArrayLoader; -use ZipArchive; -use RuntimeException; class SitepackageGenerator { @@ -49,13 +47,13 @@ public function create(Sitepackage $package): void $sourceDir = $this->kernel->getProjectDir() . '/resources/packages/' . $package->getBasePackage() . '/' . (string)$package->getTypo3Version() . '/src/'; $tempFileName = tempnam(sys_get_temp_dir(), $this->filename); if ($tempFileName === false) { - throw new RuntimeException(sprintf('Cannot create temporary name for %s/%s' . sys_get_temp_dir(), $this->filename), 1732123721); + throw new \RuntimeException(sprintf('Cannot create temporary name for %s/%s' . sys_get_temp_dir(), $this->filename), 1732123721); } $this->zipPath = $tempFileName; $fileList = FileUtility::listDirectory($sourceDir); - $zipFile = new ZipArchive(); - $opened = $zipFile->open($this->zipPath, ZipArchive::CREATE); + $zipFile = new \ZipArchive(); + $opened = $zipFile->open($this->zipPath, \ZipArchive::CREATE); if ($opened === true) { foreach ($fileList as $file) { if ($file !== $this->zipPath && file_exists($file)) { diff --git a/src/Twig/Extension/ReleaseNotesExtension.php b/src/Twig/Extension/ReleaseNotesExtension.php index 001a4b9d..f236fe29 100644 --- a/src/Twig/Extension/ReleaseNotesExtension.php +++ b/src/Twig/Extension/ReleaseNotesExtension.php @@ -35,7 +35,7 @@ public function getFilters(): array { return [ // format filters - new TwigFilter('removeWikiLink', fn (string $data): ?string => $this->removeWikiLink($data)), + new TwigFilter('removeWikiLink', fn(string $data): ?string => $this->removeWikiLink($data)), ]; } diff --git a/src/Twig/Extension/RequirementExtension.php b/src/Twig/Extension/RequirementExtension.php index 65ee9b08..6549e971 100644 --- a/src/Twig/Extension/RequirementExtension.php +++ b/src/Twig/Extension/RequirementExtension.php @@ -30,15 +30,6 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFilter; -use function array_key_exists; -use function implode; -use function in_array; -use function sprintf; -use function substr; -use function str_ends_with; - -use const null; - class RequirementExtension extends AbstractExtension { /** @@ -49,11 +40,11 @@ public function getFilters(): array return [ new TwigFilter( 'prepareRequirements', - fn (Collection $requirements): array => $this->prepareRequirements($requirements) + fn(Collection $requirements): array => $this->prepareRequirements($requirements) ), new TwigFilter( 'prepareRequirementsShort', - fn (Collection $requirements): array => $this->prepareRequirementsShort($requirements) + fn(Collection $requirements): array => $this->prepareRequirementsShort($requirements) ), ]; } @@ -87,7 +78,7 @@ public function prepareRequirementsShort(Collection $requirements): array foreach ($categories as $category => $categoryRequirements) { if ( - array_key_exists( + \array_key_exists( $category, $result ) @@ -120,10 +111,10 @@ public function prepareRequirementsShort(Collection $requirements): array } } - $result[$requirement->getCategory()] = sprintf( + $result[$requirement->getCategory()] = \sprintf( '%s %s', $requirement->getTitle(), - implode(', ', $supportedVersions) + \implode(', ', $supportedVersions) ); break; @@ -131,12 +122,12 @@ public function prepareRequirementsShort(Collection $requirements): array $result[$requirement->getCategory()] .= $result[$requirement->getCategory()] !== '' ? ' / ' : ''; $result[$requirement->getCategory()] .= $requirement->getTitle(); - if ($requirement->getMin() !== null) { + if ($requirement->getMin() !== \null) { $version = VersionUtility::normalize($requirement->getMin(), 3) ?? ''; - if (str_ends_with($version, '.0')) { - $version = substr($version, 0, -2); + if (\str_ends_with($version, '.0')) { + $version = \substr($version, 0, -2); } - $result[$requirement->getCategory()] .= sprintf( + $result[$requirement->getCategory()] .= \sprintf( ' %s+', $version ); @@ -201,7 +192,7 @@ private function normalizeVersionHelper(array &$requirements): void { foreach ($requirements as &$requirement) { if ( - in_array( + \in_array( $requirement->getCategory(), [ RequirementCategoryEnum::OPTION_PHP, @@ -231,6 +222,6 @@ private function normalizeVersionHelper(array &$requirements): void */ private function sortByTitleHelper(array &$data): void { - usort($data, static fn ($a, $b): int => strcasecmp($a->getTitle(), $b->getTitle())); + usort($data, static fn($a, $b): int => strcasecmp($a->getTitle(), $b->getTitle())); } } diff --git a/src/Twig/Filter/ChangeHighlighter.php b/src/Twig/Filter/ChangeHighlighter.php index 79f30aa8..c34fe1aa 100644 --- a/src/Twig/Filter/ChangeHighlighter.php +++ b/src/Twig/Filter/ChangeHighlighter.php @@ -36,7 +36,7 @@ public function getFilters(): array return [ new TwigFilter( 'changehighlighter', - fn (string $changeList): ?string => $this->highlightChanges($changeList) + fn(string $changeList): ?string => $this->highlightChanges($changeList) ), ]; } diff --git a/src/Twig/Filter/CommitLinker.php b/src/Twig/Filter/CommitLinker.php index 72c5a6d9..2532df98 100644 --- a/src/Twig/Filter/CommitLinker.php +++ b/src/Twig/Filter/CommitLinker.php @@ -34,7 +34,7 @@ class CommitLinker extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('commitlinker', fn (string $changeList): ?string => $this->linkCommits($changeList)), + new TwigFilter('commitlinker', fn(string $changeList): ?string => $this->linkCommits($changeList)), ]; } @@ -44,7 +44,7 @@ public function linkCommits(string $changeList): ?string return preg_replace_callback( $pattern, - static fn (array $matches): string => sprintf( + static fn(array $matches): string => sprintf( '%1$s', $matches['commit'] ), diff --git a/src/Twig/Filter/Parsedown.php b/src/Twig/Filter/Parsedown.php index 62c648fe..6aa1a665 100644 --- a/src/Twig/Filter/Parsedown.php +++ b/src/Twig/Filter/Parsedown.php @@ -34,7 +34,7 @@ class Parsedown extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('parsedown', fn (string $markdown): string => $this->parse($markdown)), + new TwigFilter('parsedown', fn(string $markdown): string => $this->parse($markdown)), ]; } diff --git a/src/Twig/Filter/SortByVersion.php b/src/Twig/Filter/SortByVersion.php index b397a869..18801619 100644 --- a/src/Twig/Filter/SortByVersion.php +++ b/src/Twig/Filter/SortByVersion.php @@ -36,7 +36,7 @@ class SortByVersion extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('sortByVersion', fn ($releases): array => $this->sort($releases)), + new TwigFilter('sortByVersion', fn($releases): array => $this->sort($releases)), ]; } @@ -48,7 +48,7 @@ public function getFilters(): array public function sort(Collection $releases): array { $array = $releases->toArray(); - usort($array, static fn ($a, $b): int => version_compare($b->getVersion(), $a->getVersion())); + usort($array, static fn($a, $b): int => version_compare($b->getVersion(), $a->getVersion())); return $array; } diff --git a/tests/Functional/AbstractCase.php b/tests/Functional/AbstractCase.php index 2312d798..31c84172 100644 --- a/tests/Functional/AbstractCase.php +++ b/tests/Functional/AbstractCase.php @@ -28,7 +28,6 @@ use Doctrine\Common\DataFixtures\Purger\ORMPurger; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ManagerRegistry; -use LogicException; use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Component\Panther\PantherTestCase; @@ -53,7 +52,7 @@ protected function logIn(): void { $userProvider = static::getContainer()->get(UserProviderInterface::class); if (!$userProvider instanceof UserProviderInterface) { - throw new LogicException('UserProvider instance is not a UserProviderInterface'); + throw new \LogicException('UserProvider instance is not a UserProviderInterface'); } $testUser = $userProvider->loadUserByIdentifier('test-user'); @@ -80,12 +79,12 @@ private function getFixtureExecutor(): ORMExecutor if ($this->fixtureExecutor === null) { $managerRegistry = static::getContainer()->get('doctrine'); if (!$managerRegistry instanceof ManagerRegistry) { - throw new LogicException('Doctrine instance is not a ManagerRegistry'); + throw new \LogicException('Doctrine instance is not a ManagerRegistry'); } $entityManager = $managerRegistry->getManager(); if (!$entityManager instanceof EntityManagerInterface) { - throw new LogicException('Manager instance is not a EntityManagerInterface'); + throw new \LogicException('Manager instance is not a EntityManagerInterface'); } $this->fixtureExecutor = new ORMExecutor($entityManager, new ORMPurger($entityManager)); diff --git a/tests/Functional/Controller/Api/ApiCase.php b/tests/Functional/Controller/Api/ApiCase.php index ee569c2a..15594483 100644 --- a/tests/Functional/Controller/Api/ApiCase.php +++ b/tests/Functional/Controller/Api/ApiCase.php @@ -24,7 +24,6 @@ namespace App\Tests\Functional\Controller\Api; use App\Tests\Functional\AbstractCase; -use LogicException; use Symfony\Component\HttpFoundation\Response; class ApiCase extends AbstractCase @@ -34,7 +33,7 @@ private function loadFixture(string $fileName): string $contents = file_get_contents($fileName); if ($contents === false) { - throw new LogicException(sprintf('Fixture "%s" not accessible', $fileName)); + throw new \LogicException(sprintf('Fixture "%s" not accessible', $fileName)); } return $contents; diff --git a/tests/Functional/Controller/Web/DownloadControllerTest.php b/tests/Functional/Controller/Web/DownloadControllerTest.php index 072138cf..792dca9e 100644 --- a/tests/Functional/Controller/Web/DownloadControllerTest.php +++ b/tests/Functional/Controller/Web/DownloadControllerTest.php @@ -23,11 +23,11 @@ namespace App\Tests\Functional\Controller\Web; +use App\Tests\Functional\AbstractCase; use App\Tests\Functional\Fixtures\MajorVersionFixtures; use App\Tests\Functional\Fixtures\ReleaseFixtures; -use App\Tests\Functional\AbstractCase; -use Symfony\Component\HttpFoundation\Response; use Iterator; +use Symfony\Component\HttpFoundation\Response; class DownloadControllerTest extends AbstractCase { @@ -66,7 +66,7 @@ public function webDownloadVersion( * expectedCode: int * }> */ - public function webDownloadVersionDataProvider(): Iterator + public function webDownloadVersionDataProvider(): \Iterator { yield 'Sprint version' => [ 'requestVersion' => '10.0.0', diff --git a/tests/Functional/Controller/Web/JsonControllerTest.php b/tests/Functional/Controller/Web/JsonControllerTest.php index 47f389b7..0e87da5d 100644 --- a/tests/Functional/Controller/Web/JsonControllerTest.php +++ b/tests/Functional/Controller/Web/JsonControllerTest.php @@ -26,11 +26,8 @@ use App\Tests\Functional\AbstractCase; use App\Tests\Functional\Fixtures\MajorVersionFixtures; use App\Tests\Functional\Fixtures\ReleaseFixtures; -use RuntimeException; use Symfony\Component\HttpFoundation\Response; -use function is_array; - class JsonControllerTest extends AbstractCase { protected function setUp(): void @@ -50,11 +47,11 @@ public function index(): void $response = $this->client->getResponse(); if (($json = $response->getContent()) === false) { - throw new RuntimeException('Error no response content.', 1_657_642_832); + throw new \RuntimeException('Error no response content.', 1_657_642_832); } - if (!is_array($content = json_decode($json, true, 512, JSON_THROW_ON_ERROR))) { - throw new RuntimeException('Error array expected.', 1_657_642_833); + if (!\is_array($content = json_decode($json, true, 512, JSON_THROW_ON_ERROR))) { + throw new \RuntimeException('Error array expected.', 1_657_642_833); } self::assertSame(Response::HTTP_OK, $response->getStatusCode()); diff --git a/tests/Functional/DatabasePrimer.php b/tests/Functional/DatabasePrimer.php index 05ada4a2..db9cbed4 100644 --- a/tests/Functional/DatabasePrimer.php +++ b/tests/Functional/DatabasePrimer.php @@ -26,7 +26,6 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Tools\SchemaTool; use Symfony\Component\HttpKernel\KernelInterface; -use LogicException; /** * Class DatabasePrimer. @@ -39,13 +38,13 @@ public static function prime(KernelInterface $kernel): void { // Make sure we are in the test environment if ($kernel->getEnvironment() !== 'test') { - throw new LogicException('Primer must be executed in the test environment'); + throw new \LogicException('Primer must be executed in the test environment'); } // Get the entity manager from the service container $entityManager = $kernel->getContainer()->get('doctrine.orm.entity_manager'); if (!$entityManager instanceof EntityManagerInterface) { - throw new LogicException('EntityManager could not be retrieved'); + throw new \LogicException('EntityManager could not be retrieved'); } // Recreate the database diff --git a/tests/Functional/Fixtures/MajorVersionFixtures.php b/tests/Functional/Fixtures/MajorVersionFixtures.php index 335fb397..9aed3ff8 100644 --- a/tests/Functional/Fixtures/MajorVersionFixtures.php +++ b/tests/Functional/Fixtures/MajorVersionFixtures.php @@ -27,8 +27,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Persistence\ObjectManager; -use DateTimeImmutable; -use Iterator; final class MajorVersionFixtures extends Fixture { @@ -77,11 +75,11 @@ public static function getVersions(): array } /** - * @return Iterator + * @return \Iterator */ protected function getData(): iterable { - $today = new DateTimeImmutable(); + $today = new \DateTimeImmutable(); yield new MajorVersionFixturesData( self::MAJOR_VERSION_SPRINT, diff --git a/tests/Functional/Fixtures/ReleaseFixtures.php b/tests/Functional/Fixtures/ReleaseFixtures.php index 96fe1b4f..f1fb33d2 100644 --- a/tests/Functional/Fixtures/ReleaseFixtures.php +++ b/tests/Functional/Fixtures/ReleaseFixtures.php @@ -29,9 +29,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; -use DateTime; -use DateTimeInterface; -use RuntimeException; final class ReleaseFixtures extends Fixture implements DependentFixtureInterface { @@ -78,13 +75,13 @@ protected function generateReleasesForMajorVersion( $fakeVersion = $ltsVersionData; $fakeVersion[2] = $i; $version = implode('.', $fakeVersion); - $date = DateTime::createFromFormat( - DateTimeInterface::ATOM, - $majorVersion->getReleaseDate()->modify('+' . ($i * 2) . ' months')->format(DateTimeInterface::ATOM) + $date = \DateTime::createFromFormat( + \DateTimeInterface::ATOM, + $majorVersion->getReleaseDate()->modify('+' . ($i * 2) . ' months')->format(\DateTimeInterface::ATOM) ); if ($date === false) { - throw new RuntimeException('Can not calculate date.', 1_624_354_915); + throw new \RuntimeException('Can not calculate date.', 1_624_354_915); } $release = new Release(); diff --git a/tests/Unit/Entity/MajorVersionExpected.php b/tests/Unit/Entity/MajorVersionExpected.php index c936e3e4..fd571bcd 100644 --- a/tests/Unit/Entity/MajorVersionExpected.php +++ b/tests/Unit/Entity/MajorVersionExpected.php @@ -23,17 +23,15 @@ namespace App\Tests\Unit\Entity; -use DateTimeImmutable; - class MajorVersionExpected { public function __construct( public readonly float $version, public readonly string $title, - public readonly DateTimeImmutable $releaseDate, - public readonly ?DateTimeImmutable $regularMaintenanceUntil, - public readonly ?DateTimeImmutable $maintainedUntil, - public readonly ?DateTimeImmutable $eltsUntil, + public readonly \DateTimeImmutable $releaseDate, + public readonly ?\DateTimeImmutable $regularMaintenanceUntil, + public readonly ?\DateTimeImmutable $maintainedUntil, + public readonly ?\DateTimeImmutable $eltsUntil, public readonly bool $active, public readonly bool $elts, ) {} diff --git a/tests/Unit/Entity/MajorVersionTest.php b/tests/Unit/Entity/MajorVersionTest.php index 3ba32a49..bee69d04 100644 --- a/tests/Unit/Entity/MajorVersionTest.php +++ b/tests/Unit/Entity/MajorVersionTest.php @@ -25,10 +25,7 @@ use App\Entity\MajorVersion; use Doctrine\Common\Collections\ArrayCollection; -use Iterator; -use LogicException; use PHPUnit\Framework\TestCase; -use DateTimeImmutable; class MajorVersionTest extends TestCase { @@ -78,7 +75,7 @@ public function entityToJsonTest(MajorVersion $majorVersion, MajorVersionExpecte $majorVersion = json_decode($majorVersion, true, 512, JSON_THROW_ON_ERROR); if (!is_array($majorVersion)) { - throw new LogicException('Array expected'); + throw new \LogicException('Array expected'); } self::assertEquals($expectedResult->active, $majorVersion['active'] ?? null); @@ -86,11 +83,11 @@ public function entityToJsonTest(MajorVersion $majorVersion, MajorVersionExpecte } /** - * @return Iterator> + * @return \Iterator> */ - public function entityTestDataProvider(): Iterator + public function entityTestDataProvider(): \Iterator { - $dateTimeToday = new DateTimeImmutable(); + $dateTimeToday = new \DateTimeImmutable(); $collection = new ArrayCollection(); yield 'SPRINT' => [ diff --git a/tests/Unit/Utility/VersionUtilityTest.php b/tests/Unit/Utility/VersionUtilityTest.php index 7b68cd58..357dea61 100644 --- a/tests/Unit/Utility/VersionUtilityTest.php +++ b/tests/Unit/Utility/VersionUtilityTest.php @@ -24,7 +24,6 @@ namespace App\Tests\Unit\Utility; use App\Utility\VersionUtility; -use Iterator; use PHPUnit\Framework\TestCase; class VersionUtilityTest extends TestCase @@ -41,9 +40,9 @@ public function extractMajorVersionNumberTest(string $version, float $expectedRe } /** - * @return Iterator> + * @return \Iterator> */ - public function extractMajorVersionNumberTestDataProvider(): Iterator + public function extractMajorVersionNumberTestDataProvider(): \Iterator { yield 'Minor 4' => ['4.5', 4.5]; yield 'Patch 4' => ['4.5.35', 4.5]; @@ -70,9 +69,9 @@ public function isValidSemverVersionTest(string $version, bool $expectedResult): } /** - * @return Iterator> + * @return \Iterator> */ - public function isValidSemverVersionTestDataProvider(): Iterator + public function isValidSemverVersionTestDataProvider(): \Iterator { yield 'Patch 6' => ['6.2.0', true]; yield 'Dev 6' => ['6.99.99-dev', true]; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ee694b5f..2d759861 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,15 +26,12 @@ use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Filesystem\Filesystem; -use function file_exists; -use function dirname; +require \dirname(__DIR__) . '/vendor/autoload.php'; -require dirname(__DIR__) . '/vendor/autoload.php'; - -if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) { - require dirname(__DIR__) . '/config/bootstrap.php'; +if (\file_exists(\dirname(__DIR__) . '/config/bootstrap.php')) { + require \dirname(__DIR__) . '/config/bootstrap.php'; } else { - (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); + (new Dotenv())->bootEnv(\dirname(__DIR__) . '/.env'); } // ensure a fresh cache when debug mode is disabled From bbde14b9699d2036bd547b5a51e465e6c5c1d098 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:38:22 +0100 Subject: [PATCH 11/45] [TASK] Drop php code sniffer --- .github/workflows/continuous-integration.yml | 38 -------------------- composer.json | 3 -- tools/phpcs/composer.json | 5 --- 3 files changed, 46 deletions(-) delete mode 100644 tools/phpcs/composer.json diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7733603c..2ff07e4f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -191,44 +191,6 @@ jobs: - name: Validation of coding standards for PHP files run: composer ci:php:cs - php_sniff: - name: PHP Code Sniffer - needs: - - php_lint - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - tools: composer:2 - - - name: Get Composer Cache Directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer-latest- - ${{ runner.os }}-composer- - - - name: Setup authentication for Composer - run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - - name: Install dependencies - run: composer install --prefer-dist --ansi --no-interaction --no-progress - - - name: Validation of coding standards - run: composer ci:php:sniff - php_stan: name: PHP Stan needs: diff --git a/composer.json b/composer.json index 4eec4c8d..0c26b548 100644 --- a/composer.json +++ b/composer.json @@ -197,12 +197,10 @@ "ci:php": [ "@ci:php:lint", "@ci:php:cs-fixer", - "@ci:php:sniff", "@ci:php:stan" ], "ci:php:cs-fixer": "@php php-cs-fixer fix -v --dry-run --diff", "ci:php:lint": "@php phplint --no-progress", - "ci:php:sniff": "@php phpcs --standard=PSR12 src tests || true", "ci:php:stan": "@php phpstan analyse --no-progress", "ci:static": [ "@ci:json:lint", @@ -226,7 +224,6 @@ "@fix:php:cs-fixer" ], "fix:php:cs-fixer": "@php php-cs-fixer fix", - "fix:php:sniff": "phpcbf src", "satis:install": [ "rm -fr satis", "@composer create-project --stability=dev --ansi composer/satis satis" diff --git a/tools/phpcs/composer.json b/tools/phpcs/composer.json deleted file mode 100644 index 5f0b1a4f..00000000 --- a/tools/phpcs/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "squizlabs/php_codesniffer": "*" - } -} From 8294b10ddde6454d9d9f63f422b161297537220a Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:46:48 +0100 Subject: [PATCH 12/45] [TASK] Update recipe for symfony/flex --- .env | 1 + symfony.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 34d06bcb..2ba0d126 100644 --- a/.env +++ b/.env @@ -9,6 +9,7 @@ # Real environment variables win over .env files. # # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. +# https://symfony.com/doc/current/configuration/secrets.html # # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration diff --git a/symfony.lock b/symfony.lock index 5ec60cca..b83b68fd 100644 --- a/symfony.lock +++ b/symfony.lock @@ -346,12 +346,12 @@ "version": "v5.1.9" }, "symfony/flex": { - "version": "1.0", + "version": "2.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "1.0", - "ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e" + "ref": "146251ae39e06a95be0fe3d13c807bcf3938b172" }, "files": [ ".env" From 6d1ff74b3dd071f725c249e02ae684e3acd06ea8 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:47:28 +0100 Subject: [PATCH 13/45] [TASK] Update recipe for symfony/translation --- config/packages/translation.yaml | 1 + symfony.lock | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/packages/translation.yaml b/config/packages/translation.yaml index 05a2b3d8..b3f8f9cf 100644 --- a/config/packages/translation.yaml +++ b/config/packages/translation.yaml @@ -4,3 +4,4 @@ framework: default_path: '%kernel.project_dir%/translations' fallbacks: - en + providers: diff --git a/symfony.lock b/symfony.lock index b83b68fd..fa1541d9 100644 --- a/symfony.lock +++ b/symfony.lock @@ -521,12 +521,12 @@ "version": "v5.1.9" }, "symfony/translation": { - "version": "3.3", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "3.3", - "ref": "2ad9d2545bce8ca1a863e50e92141f0b9d87ffcd" + "branch": "main", + "version": "6.3", + "ref": "e28e27f53663cc34f0be2837aba18e3a1bef8e7b" }, "files": [ "config/packages/translation.yaml", From 2981b126e0bbd6b616576b21b8fadefb24819529 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:50:08 +0100 Subject: [PATCH 14/45] [TASK] Update recipe for symfony/validator --- config/packages/test/validator.yaml | 3 --- config/packages/validator.yaml | 5 +++++ symfony.lock | 9 ++++----- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 config/packages/test/validator.yaml diff --git a/config/packages/test/validator.yaml b/config/packages/test/validator.yaml deleted file mode 100644 index 1e5ab788..00000000 --- a/config/packages/test/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - not_compromised_password: false diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml index 350786a1..0201281d 100644 --- a/config/packages/validator.yaml +++ b/config/packages/validator.yaml @@ -6,3 +6,8 @@ framework: # For instance, basic validation constraints will be inferred from Doctrine's metadata. #auto_mapping: # App\Entity\: [] + +when@test: + framework: + validation: + not_compromised_password: false diff --git a/symfony.lock b/symfony.lock index fa1541d9..d47a1d6e 100644 --- a/symfony.lock +++ b/symfony.lock @@ -566,15 +566,14 @@ ] }, "symfony/validator": { - "version": "4.3", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "4.3", - "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869" + "branch": "main", + "version": "5.3", + "ref": "c32cfd98f714894c4f128bb99aa2530c1227603c" }, "files": [ - "config/packages/test/validator.yaml", "config/packages/validator.yaml" ] }, From 7f68202960f1463b24ffbe86162cc453af7fcded Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 11:50:57 +0100 Subject: [PATCH 15/45] [TASK] Update recipe for symfony/web-profiler-bundle --- config/packages/web_profiler.yaml | 4 +++- symfony.lock | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml index 17893da1..b9461110 100644 --- a/config/packages/web_profiler.yaml +++ b/config/packages/web_profiler.yaml @@ -4,7 +4,9 @@ when@dev: intercept_redirects: false framework: - profiler: { only_exceptions: false } + profiler: + only_exceptions: false + collect_serializer_data: true when@test: web_profiler: diff --git a/symfony.lock b/symfony.lock index d47a1d6e..72317a7d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -587,12 +587,12 @@ "version": "v5.1.9" }, "symfony/web-profiler-bundle": { - "version": "5.4", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "5.3", - "ref": "24bbc3d84ef2f427f82104f766014e799eefcc3e" + "version": "6.1", + "ref": "e42b3f0177df239add25373083a564e5ead4e13a" }, "files": [ "config/packages/web_profiler.yaml", From 59c57668cb7b447dc6b1e7aff663c26a3a085334 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:15:46 +0100 Subject: [PATCH 16/45] [TASK] Update recipe for symfony/twig-bundle --- config/packages/test/twig.yaml | 2 -- config/packages/twig.yaml | 5 +++++ symfony.lock | 9 ++++----- 3 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 config/packages/test/twig.yaml diff --git a/config/packages/test/twig.yaml b/config/packages/test/twig.yaml deleted file mode 100644 index 8c6e0b40..00000000 --- a/config/packages/test/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 8f4c7e42..23e82bc3 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,7 +1,12 @@ twig: + file_name_pattern: '*.twig' default_path: '%kernel.project_dir%/templates' globals: baseUrl: '%env(BASE_URL)%' packagist: search: https://packagist.org/explore/?type=typo3-cms-extension submit: https://packagist.org/packages/submit + +when@test: + twig: + strict_variables: true diff --git a/symfony.lock b/symfony.lock index 72317a7d..e52189e1 100644 --- a/symfony.lock +++ b/symfony.lock @@ -540,15 +540,14 @@ "version": "v5.1.9" }, "symfony/twig-bundle": { - "version": "5.0", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.0", - "ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d" + "branch": "main", + "version": "6.4", + "ref": "cab5fd2a13a45c266d45a7d9337e28dee6272877" }, "files": [ - "config/packages/test/twig.yaml", "config/packages/twig.yaml", "templates/base.html.twig" ] From afe2830cc9e3ea478dfca34ab5cedd10e4d08405 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:16:51 +0100 Subject: [PATCH 17/45] [TASK] Update recipe for doctrine/annotations --- config/routes/annotations.yaml | 7 ------- symfony.lock | 12 +++++------- 2 files changed, 5 insertions(+), 14 deletions(-) delete mode 100644 config/routes/annotations.yaml diff --git a/config/routes/annotations.yaml b/config/routes/annotations.yaml deleted file mode 100644 index e92efc59..00000000 --- a/config/routes/annotations.yaml +++ /dev/null @@ -1,7 +0,0 @@ -controllers: - resource: ../../src/Controller/ - type: annotation - -kernel: - resource: ../../src/Kernel.php - type: annotation diff --git a/symfony.lock b/symfony.lock index e52189e1..4b31fb5f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -6,16 +6,14 @@ "version": "1.2.8" }, "doctrine/annotations": { - "version": "1.0", + "version": "2.0", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "1.0", - "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457" + "branch": "main", + "version": "1.10", + "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" }, - "files": [ - "config/routes/annotations.yaml" - ] + "files": [] }, "doctrine/cache": { "version": "1.10.2" From 07c5998677711f3419ec560b001c4debaf38dadd Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:19:30 +0100 Subject: [PATCH 18/45] [TASK] Update recipe for doctrine/doctrine-bundle --- .env | 3 ++- config/packages/doctrine.yaml | 27 +++++++++++++++++++++++++++ config/packages/prod/doctrine.yaml | 20 -------------------- symfony.lock | 9 ++++----- 4 files changed, 33 insertions(+), 26 deletions(-) delete mode 100644 config/packages/prod/doctrine.yaml diff --git a/.env b/.env index 2ba0d126..99cd9380 100644 --- a/.env +++ b/.env @@ -26,7 +26,8 @@ APP_SECRET=1a7aae67ad2d7c7ec1efeb892cbff4ff # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" DATABASE_URL=sqlite:///%kernel.project_dir%/var/gettr.db ###< doctrine/doctrine-bundle ### diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index bfc718bb..7ced169b 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -6,6 +6,7 @@ doctrine: charset: utf8mb4 orm: auto_generate_proxy_classes: true + enable_lazy_ghost_objects: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: @@ -15,3 +16,29 @@ doctrine: dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App + +when@test: + doctrine: + dbal: + # "TEST_TOKEN" is typically set by ParaTest + dbname_suffix: '_test%env(default::TEST_TOKEN)%' + +when@prod: + doctrine: + orm: + auto_generate_proxy_classes: false + proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies' + query_cache_driver: + type: pool + pool: doctrine.system_cache_pool + result_cache_driver: + type: pool + pool: doctrine.result_cache_pool + + framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/config/packages/prod/doctrine.yaml b/config/packages/prod/doctrine.yaml deleted file mode 100644 index 084f59a0..00000000 --- a/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,20 +0,0 @@ -doctrine: - orm: - auto_generate_proxy_classes: false - metadata_cache_driver: - type: pool - pool: doctrine.system_cache_pool - query_cache_driver: - type: pool - pool: doctrine.system_cache_pool - result_cache_driver: - type: pool - pool: doctrine.result_cache_pool - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/symfony.lock b/symfony.lock index 4b31fb5f..713652d5 100644 --- a/symfony.lock +++ b/symfony.lock @@ -34,16 +34,15 @@ "version": "v0.5.3" }, "doctrine/doctrine-bundle": { - "version": "2.0", + "version": "2.9", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "2.0", - "ref": "368794356c1fb634e58b38ad2addb36933f2e73e" + "branch": "main", + "version": "2.9", + "ref": "17a8aa6f671ae0d2b557f19b7b0d4ccd992aa57d" }, "files": [ "config/packages/doctrine.yaml", - "config/packages/prod/doctrine.yaml", "src/Entity/.gitignore", "src/Repository/.gitignore" ] From 7d015262aa636e010ba122e86179b67c86b850b2 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:21:50 +0100 Subject: [PATCH 19/45] [TASK] Update recipe for doctrine/doctrine-fixtures-bundle --- symfony.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/symfony.lock b/symfony.lock index 713652d5..c345de13 100644 --- a/symfony.lock +++ b/symfony.lock @@ -48,12 +48,12 @@ ] }, "doctrine/doctrine-fixtures-bundle": { - "version": "3.0", + "version": "3.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "3.0", - "ref": "e5b542d4ef47d8a003c91beb35650c76907f7e53" + "ref": "1f5514cfa15b947298df4d771e694e578d4c204d" }, "files": [ "src/DataFixtures/AppFixtures.php" From cbf0193b6cba9b21aa25f2d733b2743876dec540 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:23:37 +0100 Subject: [PATCH 20/45] [TASK] Update recipe for doctrine/doctrine-migrations-bundle --- config/packages/doctrine_migrations.yaml | 1 + symfony.lock | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/packages/doctrine_migrations.yaml b/config/packages/doctrine_migrations.yaml index 0a2b3cf0..e6d5ce4a 100644 --- a/config/packages/doctrine_migrations.yaml +++ b/config/packages/doctrine_migrations.yaml @@ -6,3 +6,4 @@ doctrine_migrations: storage: table_storage: table_name: 'migration_versions' + enable_profiler: false diff --git a/symfony.lock b/symfony.lock index c345de13..22a1d91f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -60,12 +60,12 @@ ] }, "doctrine/doctrine-migrations-bundle": { - "version": "2.2", + "version": "3.2", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "2.2", - "ref": "baaa439e3e3179e69e3da84b671f0a3e4a2f56ad" + "branch": "main", + "version": "3.1", + "ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33" }, "files": [ "config/packages/doctrine_migrations.yaml", From 92e984bdafb206358de7ab109ae6eaa64a4eccd9 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:24:43 +0100 Subject: [PATCH 21/45] [TASK] Update recipe for nelmio/cors-bundle --- symfony.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/symfony.lock b/symfony.lock index 22a1d91f..be491fb4 100644 --- a/symfony.lock +++ b/symfony.lock @@ -196,12 +196,12 @@ ] }, "nelmio/cors-bundle": { - "version": "1.5", + "version": "2.3", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "1.5", - "ref": "6388de23860284db9acce0a7a5d9d13153bcb571" + "ref": "6bea22e6c564fba3a1391615cada1437d0bde39c" }, "files": [ "config/packages/nelmio_cors.yaml" From 74750babc60d8f252ce51b85c9278f5347a8bba5 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:25:27 +0100 Subject: [PATCH 22/45] [TASK] Update recipe for jms/serializer-bundle --- config/packages/dev/jms_serializer.yaml | 7 ------- config/packages/jms_serializer.yaml | 17 +++++++++++++++++ config/packages/prod/jms_serializer.yaml | 6 ------ symfony.lock | 12 +++++------- 4 files changed, 22 insertions(+), 20 deletions(-) delete mode 100644 config/packages/dev/jms_serializer.yaml delete mode 100644 config/packages/prod/jms_serializer.yaml diff --git a/config/packages/dev/jms_serializer.yaml b/config/packages/dev/jms_serializer.yaml deleted file mode 100644 index f9460410..00000000 --- a/config/packages/dev/jms_serializer.yaml +++ /dev/null @@ -1,7 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_PRETTY_PRINT - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/config/packages/jms_serializer.yaml b/config/packages/jms_serializer.yaml index b6b9fb32..70d919e5 100644 --- a/config/packages/jms_serializer.yaml +++ b/config/packages/jms_serializer.yaml @@ -14,3 +14,20 @@ jms_serializer: # another-name: # namespace_prefix: "My\\BarBundle" # path: "@MyBarBundle/Resources/config/serializer" + +when@prod: + jms_serializer: + visitors: + json_serialization: + options: + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION + +when@dev: + jms_serializer: + visitors: + json_serialization: + options: + - JSON_PRETTY_PRINT + - JSON_UNESCAPED_SLASHES + - JSON_PRESERVE_ZERO_FRACTION diff --git a/config/packages/prod/jms_serializer.yaml b/config/packages/prod/jms_serializer.yaml deleted file mode 100644 index 89c86c89..00000000 --- a/config/packages/prod/jms_serializer.yaml +++ /dev/null @@ -1,6 +0,0 @@ -jms_serializer: - visitors: - json_serialization: - options: - - JSON_UNESCAPED_SLASHES - - JSON_PRESERVE_ZERO_FRACTION diff --git a/symfony.lock b/symfony.lock index be491fb4..60634b19 100644 --- a/symfony.lock +++ b/symfony.lock @@ -145,17 +145,15 @@ "version": "3.10.0" }, "jms/serializer-bundle": { - "version": "3.0", + "version": "4.2", "recipe": { "repo": "github.com/symfony/recipes-contrib", - "branch": "master", - "version": "3.0", - "ref": "384cec52df45f3bfd46a09930d6960a58872b268" + "branch": "main", + "version": "4.0", + "ref": "cc04e10cf7171525b50c18b36004edf64cb478be" }, "files": [ - "config/packages/dev/jms_serializer.yaml", - "config/packages/jms_serializer.yaml", - "config/packages/prod/jms_serializer.yaml" + "config/packages/jms_serializer.yaml" ] }, "justinrainbow/json-schema": { From 2b5c12d774d2d71ffd326afeb253bcada3b1a45c Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:26:39 +0100 Subject: [PATCH 23/45] [TASK] Update recipe for nelmio/security-bundle --- config/packages/nelmio_security.yaml | 6 ------ symfony.lock | 11 +++++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/config/packages/nelmio_security.yaml b/config/packages/nelmio_security.yaml index 292bbeb6..770f8e07 100644 --- a/config/packages/nelmio_security.yaml +++ b/config/packages/nelmio_security.yaml @@ -8,12 +8,6 @@ nelmio_security: content_type: nosniff: true - # forces Microsoft's XSS-Protection with - # its block mode - xss_protection: - enabled: true - mode_block: true - # Send a full URL in the `Referer` header when performing a same-origin request, # only send the origin of the document to secure destination (HTTPS->HTTPS), # and send no header to a less secure destination (HTTPS->HTTP). diff --git a/symfony.lock b/symfony.lock index 60634b19..2471fca9 100644 --- a/symfony.lock +++ b/symfony.lock @@ -206,13 +206,16 @@ ] }, "nelmio/security-bundle": { - "version": "2.4", + "version": "2.12", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "2.4", - "ref": "65726efb67ff51d89de38195bc0d230fa811f64d" - } + "ref": "71045833e4f882ad9de8c95fe47efb99a1eec2f7" + }, + "files": [ + "config/packages/nelmio_security.yaml" + ] }, "nikic/php-parser": { "version": "v4.10.3" From cf9759a013b71d47cc41e451fd95b2f8d86200fd Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:30:53 +0100 Subject: [PATCH 24/45] [BUGFIX] Disable lazy ghost objects for now doctrine/persistence" library version 3.1 or higher is required --- config/packages/doctrine.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 7ced169b..1a4deeab 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -6,7 +6,7 @@ doctrine: charset: utf8mb4 orm: auto_generate_proxy_classes: true - enable_lazy_ghost_objects: true + enable_lazy_ghost_objects: false naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: From 6cfb2e881d1737b82f8e32e217cfa7375b708f87 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:31:22 +0100 Subject: [PATCH 25/45] [TASK] Update recipe for symfony/console --- bin/console | 40 +++++++++------------------------------- symfony.lock | 8 ++++---- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/bin/console b/bin/console index 8fe9d494..d8d530e2 100755 --- a/bin/console +++ b/bin/console @@ -3,41 +3,19 @@ use App\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Dotenv\Dotenv; -use Symfony\Component\ErrorHandler\Debug; -if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { - echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; +if (!is_dir(dirname(__DIR__).'/vendor')) { + throw new LogicException('Dependencies are missing. Try running "composer install".'); } -set_time_limit(0); - -require dirname(__DIR__).'/vendor/autoload.php'; - -if (!class_exists(Application::class) || !class_exists(Dotenv::class)) { - throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.'); -} - -$input = new ArgvInput(); -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); +if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); } -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); +require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} +return function (array $context) { + $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); + return new Application($kernel); +}; diff --git a/symfony.lock b/symfony.lock index 2471fca9..77f05444 100644 --- a/symfony.lock +++ b/symfony.lock @@ -284,12 +284,12 @@ "version": "v5.1.9" }, "symfony/console": { - "version": "5.1", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.1", - "ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c" + "branch": "main", + "version": "5.3", + "ref": "1781ff40d8a17d87cf53f8d4cf0c8346ed2bb461" }, "files": [ "bin/console" From 6be4656a2a80347032d957f65505ce4a299d35ef Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:34:54 +0100 Subject: [PATCH 26/45] [BUGFIX] Disable coverage --- phpunit.xml.dist | 5 ----- src/Command/CoreExtensionsRedirectsCommand.php | 3 --- src/Command/ExtensionsTerJsonCreateCommand.php | 3 --- src/Command/ListMissingDownloadsCommand.php | 3 --- src/Command/SatisBuildCommand.php | 3 --- src/Command/SatisJsonCreateCommand.php | 3 --- src/Enum/AbstractEnum.php | 3 --- src/Model/SatisJson.php | 3 --- tests/Functional/phpunit.xml | 9 --------- tests/Unit/phpunit.xml | 9 --------- 10 files changed, 44 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 80b14570..89c5b37e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,11 +6,6 @@ colors="true" bootstrap="tests/bootstrap.php" > - - - src - - diff --git a/src/Command/CoreExtensionsRedirectsCommand.php b/src/Command/CoreExtensionsRedirectsCommand.php index 662519a7..fce60d15 100644 --- a/src/Command/CoreExtensionsRedirectsCommand.php +++ b/src/Command/CoreExtensionsRedirectsCommand.php @@ -28,9 +28,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -/** - * @codeCoverageIgnore - */ final class CoreExtensionsRedirectsCommand extends Command { /** diff --git a/src/Command/ExtensionsTerJsonCreateCommand.php b/src/Command/ExtensionsTerJsonCreateCommand.php index 6d76bd48..e9bada7a 100644 --- a/src/Command/ExtensionsTerJsonCreateCommand.php +++ b/src/Command/ExtensionsTerJsonCreateCommand.php @@ -31,9 +31,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -/** - * @codeCoverageIgnore - */ class ExtensionsTerJsonCreateCommand extends Command { /** diff --git a/src/Command/ListMissingDownloadsCommand.php b/src/Command/ListMissingDownloadsCommand.php index 4760e284..4f9e47b4 100644 --- a/src/Command/ListMissingDownloadsCommand.php +++ b/src/Command/ListMissingDownloadsCommand.php @@ -31,9 +31,6 @@ use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\Yaml\Yaml; -/** - * @codeCoverageIgnore - */ class ListMissingDownloadsCommand extends Command { /** diff --git a/src/Command/SatisBuildCommand.php b/src/Command/SatisBuildCommand.php index 41b236b7..b1bc2700 100644 --- a/src/Command/SatisBuildCommand.php +++ b/src/Command/SatisBuildCommand.php @@ -32,9 +32,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\Process; -/** - * @codeCoverageIgnore - */ class SatisBuildCommand extends Command { /** diff --git a/src/Command/SatisJsonCreateCommand.php b/src/Command/SatisJsonCreateCommand.php index 5a9d45e6..c826aacc 100644 --- a/src/Command/SatisJsonCreateCommand.php +++ b/src/Command/SatisJsonCreateCommand.php @@ -29,9 +29,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -/** - * @codeCoverageIgnore - */ class SatisJsonCreateCommand extends Command { /** diff --git a/src/Enum/AbstractEnum.php b/src/Enum/AbstractEnum.php index 6025429c..81db88bc 100644 --- a/src/Enum/AbstractEnum.php +++ b/src/Enum/AbstractEnum.php @@ -23,9 +23,6 @@ namespace App\Enum; -/** - * @codeCoverageIgnore No need to test this ... - */ abstract class AbstractEnum { /** diff --git a/src/Model/SatisJson.php b/src/Model/SatisJson.php index 89ab4915..7cb5b066 100644 --- a/src/Model/SatisJson.php +++ b/src/Model/SatisJson.php @@ -23,9 +23,6 @@ namespace App\Model; -/** - * @codeCoverageIgnore - */ class SatisJson implements \Stringable { /** diff --git a/tests/Functional/phpunit.xml b/tests/Functional/phpunit.xml index 47745e67..4786b1a7 100644 --- a/tests/Functional/phpunit.xml +++ b/tests/Functional/phpunit.xml @@ -14,15 +14,6 @@ stopOnFailure="false" bootstrap="../bootstrap.php" > - - - ../../src/ - - - - - - diff --git a/tests/Unit/phpunit.xml b/tests/Unit/phpunit.xml index c9fafe05..3d247391 100644 --- a/tests/Unit/phpunit.xml +++ b/tests/Unit/phpunit.xml @@ -14,15 +14,6 @@ stopOnFailure="false" bootstrap="../bootstrap.php" > - - - ../../src/ - - - - - - ./ From a3bf40a83a04a7aaf1f69fae7103dce1e0b1ac54 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:38:37 +0100 Subject: [PATCH 27/45] [TASK] Update recipe for symfony/debug-bundle --- config/bundles.php | 2 +- config/packages/debug.yaml | 5 +++++ config/packages/dev/debug.yaml | 4 ---- symfony.lock | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 config/packages/debug.yaml delete mode 100644 config/packages/dev/debug.yaml diff --git a/config/bundles.php b/config/bundles.php index ef9a69da..618ffff6 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -18,7 +18,7 @@ Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true], T3G\Bundle\TemplateBundle\TemplateBundle::class => ['all' => true], Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true], T3G\Bundle\UsercentricsBundle\UsercentricsBundle::class => ['all' => true], EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], ]; diff --git a/config/packages/debug.yaml b/config/packages/debug.yaml new file mode 100644 index 00000000..ad874afd --- /dev/null +++ b/config/packages/debug.yaml @@ -0,0 +1,5 @@ +when@dev: + debug: + # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. + # See the "server:dump" command to start a new server. + dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" diff --git a/config/packages/dev/debug.yaml b/config/packages/dev/debug.yaml deleted file mode 100644 index 26d4e53d..00000000 --- a/config/packages/dev/debug.yaml +++ /dev/null @@ -1,4 +0,0 @@ -debug: - # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. - # See the "server:dump" command to start a new server. - dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" diff --git a/symfony.lock b/symfony.lock index 77f05444..96df7099 100644 --- a/symfony.lock +++ b/symfony.lock @@ -299,15 +299,15 @@ "version": "v5.1.9" }, "symfony/debug-bundle": { - "version": "4.1", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "4.1", - "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea" + "branch": "main", + "version": "5.3", + "ref": "5aa8aa48234c8eb6dbdd7b3cd5d791485d2cec4b" }, "files": [ - "config/packages/dev/debug.yaml" + "config/packages/debug.yaml" ] }, "symfony/dependency-injection": { From 4217df7b070eb32294d6bef1e26152247950b719 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:39:01 +0100 Subject: [PATCH 28/45] [BUGFIX] Do not wait for removed sniff step --- .github/workflows/continuous-integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2ff07e4f..c32ccc59 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -285,7 +285,6 @@ jobs: - yaml_lint - validation - php_coding_standards - - php_sniff - php_stan if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/deployment.yml From 26efd33520c99ef911bc64de3a598425b9c51fad Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 12:47:42 +0100 Subject: [PATCH 29/45] [BUGFIX] Add missing route config --- config/routes.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/routes.yaml b/config/routes.yaml index c3283aa2..2d0ef99e 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,5 @@ -#index: -# path: / -# controller: App\Controller\DefaultController::index +controllers: + resource: + path: ../src/Controller/ + namespace: App\Controller + type: attribute From 5a08ec6c0b14c8eb79bb9ed711eb289eee476c7a Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:05:00 +0100 Subject: [PATCH 30/45] [TASK] Update recipe for symfony/security-bundle --- config/packages/security.yaml | 20 +++++++++++++++++--- config/routes/security.yaml | 3 +++ symfony.lock | 11 ++++++----- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 config/routes/security.yaml diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 6e888426..d4e23d1c 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,10 +1,11 @@ security: # https://symfony.com/doc/current/security/experimental_authenticators.html enable_authenticator_manager: true - # https://symfony.com/doc/current/security.html#c-hashing-passwords + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' - # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider + providers: users_in_memory: memory: @@ -32,7 +33,7 @@ security: target: app_login # activate different ways to authenticate - # https://symfony.com/doc/current/security.html#firewalls-authentication + # https://symfony.com/doc/current/security.html#the-firewall # https://symfony.com/doc/current/security/impersonating_user.html # switch_user: true @@ -45,3 +46,16 @@ security: # Special rules for get.typo3.dev - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1, 185.17.71.134, 2a04:503:0:1019::134], host: ^get\.typo3\.dev$ } - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED, host: ^get\.typo3\.dev$ } + +when@test: + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # are not important, waste resources and increase test times. The following + # reduces the work factor to the lowest possible values. + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/routes/security.yaml b/config/routes/security.yaml new file mode 100644 index 00000000..f853be15 --- /dev/null +++ b/config/routes/security.yaml @@ -0,0 +1,3 @@ +_security_logout: + resource: security.route_loader.logout + type: service diff --git a/symfony.lock b/symfony.lock index 96df7099..358a2627 100644 --- a/symfony.lock +++ b/symfony.lock @@ -486,15 +486,16 @@ "version": "v5.3.4" }, "symfony/security-bundle": { - "version": "5.1", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.1", - "ref": "0a4bae19389d3b9cba1ca0102e3b2bccea724603" + "branch": "main", + "version": "6.4", + "ref": "2ae08430db28c8eb4476605894296c82a642028f" }, "files": [ - "config/packages/security.yaml" + "config/packages/security.yaml", + "config/routes/security.yaml" ] }, "symfony/security-core": { From 46e587e22ebaf910a8687736223bc28c438789d2 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:06:47 +0100 Subject: [PATCH 31/45] [TASK] Update recipe for symfony/mailer --- .env | 2 +- symfony.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 99cd9380..4a853b35 100644 --- a/.env +++ b/.env @@ -36,7 +36,7 @@ CORS_ALLOW_ORIGIN=^https?://(get\.typo3\.org)(:[0-9]+)?$ ###< nelmio/cors-bundle ### ###> symfony/mailer ### -# MAILER_DSN=smtp://localhost +MAILER_DSN=null://null ###< symfony/mailer ### # todo: reduce to APP_DOMAIN diff --git a/symfony.lock b/symfony.lock index 358a2627..421d3a53 100644 --- a/symfony.lock +++ b/symfony.lock @@ -394,12 +394,12 @@ "version": "v5.1.9" }, "symfony/mailer": { - "version": "4.3", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "4.3", - "ref": "15658c2a0176cda2e7dba66276a2030b52bd81b2" + "ref": "09051cfde49476e3c12cd3a0e44289ace1c75a4f" }, "files": [ "config/packages/mailer.yaml" From d55f254badf01b51818b6b0ca3e84d0a9579812b Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:08:30 +0100 Subject: [PATCH 32/45] [TASK] Update recipe for symfony/routing --- config/packages/prod/routing.yaml | 3 --- config/packages/routing.yaml | 5 +++++ config/routes.yaml | 8 ++++---- symfony.lock | 9 ++++----- 4 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 config/packages/prod/routing.yaml diff --git a/config/packages/prod/routing.yaml b/config/packages/prod/routing.yaml deleted file mode 100644 index b3e6a0af..00000000 --- a/config/packages/prod/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: null diff --git a/config/packages/routing.yaml b/config/packages/routing.yaml index b45c1cec..4b766ce5 100644 --- a/config/packages/routing.yaml +++ b/config/packages/routing.yaml @@ -5,3 +5,8 @@ framework: # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands #default_uri: http://localhost + +when@prod: + framework: + router: + strict_requirements: null diff --git a/config/routes.yaml b/config/routes.yaml index 2d0ef99e..41ef8140 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,5 +1,5 @@ controllers: - resource: - path: ../src/Controller/ - namespace: App\Controller - type: attribute + resource: + path: ../src/Controller/ + namespace: App\Controller + type: attribute diff --git a/symfony.lock b/symfony.lock index 421d3a53..2ef7ec01 100644 --- a/symfony.lock +++ b/symfony.lock @@ -469,15 +469,14 @@ "version": "v5.3.4" }, "symfony/routing": { - "version": "5.1", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.1", - "ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43" + "branch": "main", + "version": "6.2", + "ref": "e0a11b4ccb8c9e70b574ff5ad3dfdcd41dec5aa6" }, "files": [ - "config/packages/prod/routing.yaml", "config/packages/routing.yaml", "config/routes.yaml" ] From 1e0cfc585f68f6d8fa178402e0f60911808496ef Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:12:10 +0100 Subject: [PATCH 33/45] [TASK] Update recipe for symfony/framework-bundle --- .env | 2 -- config/packages/framework.yaml | 3 ++- config/routes/dev/framework.yaml | 3 --- config/routes/framework.yaml | 4 ++++ config/services.yaml | 9 +-------- public/index.php | 30 ++++-------------------------- symfony.lock | 11 +++++------ 7 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 config/routes/dev/framework.yaml create mode 100644 config/routes/framework.yaml diff --git a/.env b/.env index 4a853b35..b78867a3 100644 --- a/.env +++ b/.env @@ -17,8 +17,6 @@ ###> symfony/framework-bundle ### APP_ENV=dev APP_SECRET=1a7aae67ad2d7c7ec1efeb892cbff4ff -#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 -#TRUSTED_HOSTS='^(localhost|example\.com)$' ###< symfony/framework-bundle ### ###> doctrine/doctrine-bundle ### diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 7853e9ed..e3b74d35 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,8 +1,9 @@ # see https://symfony.com/doc/current/reference/configuration/framework.html framework: secret: '%env(APP_SECRET)%' - #csrf_protection: true + annotations: true http_method_override: false + handle_all_throwables: true # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. diff --git a/config/routes/dev/framework.yaml b/config/routes/dev/framework.yaml deleted file mode 100644 index bcbbf13d..00000000 --- a/config/routes/dev/framework.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_errors: - resource: '@FrameworkBundle/Resources/config/routing/errors.xml' - prefix: /_error diff --git a/config/routes/framework.yaml b/config/routes/framework.yaml new file mode 100644 index 00000000..0fc74bba --- /dev/null +++ b/config/routes/framework.yaml @@ -0,0 +1,4 @@ +when@dev: + _errors: + resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + prefix: /_error diff --git a/config/services.yaml b/config/services.yaml index cd4c0610..b59088f2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -2,7 +2,7 @@ # Files in the packages/ subdirectory configure your dependencies. # Put parameters here that don't need to change on each machine where the app is deployed -# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration +# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: app.domain: '%env(APP_DOMAIN)%' @@ -20,13 +20,6 @@ services: - '../src/DependencyInjection/' - '../src/Entity/' - '../src/Kernel.php' - - '../src/Tests/' - - # controllers are imported separately to make sure services can be injected - # as action arguments even if you don't extend any base controller class - App\Controller\: - resource: '../src/Controller/' - tags: ['controller.service_arguments'] # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones diff --git a/public/index.php b/public/index.php index 18b71692..9982c218 100644 --- a/public/index.php +++ b/public/index.php @@ -1,31 +1,9 @@ bootEnv(dirname(__DIR__).'/.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - Debug::enable(); -} - -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO); -} - -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); - -$request = Request::createFromGlobals(); -$response = $kernel->handle($request); -$response->send(); -$kernel->terminate($request, $response); +return function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/symfony.lock b/symfony.lock index 2ef7ec01..181dbddc 100644 --- a/symfony.lock +++ b/symfony.lock @@ -359,19 +359,18 @@ "version": "v5.1.9" }, "symfony/framework-bundle": { - "version": "5.1", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.1", - "ref": "5f0d0fd82ffa3580fe0ce8e3b2d18506ebf37a0e" + "branch": "main", + "version": "6.4", + "ref": "32126346f25e1cee607cc4aa6783d46034920554" }, "files": [ "config/packages/cache.yaml", "config/packages/framework.yaml", - "config/packages/test/framework.yaml", "config/preload.php", - "config/routes/dev/framework.yaml", + "config/routes/framework.yaml", "config/services.yaml", "public/index.php", "src/Controller/.gitignore", From 3c27c01397018a0bfd1f44b3deccf767854511da Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:13:32 +0100 Subject: [PATCH 34/45] [TASK] Update recipe for symfony/monolog-bundle --- config/packages/dev/monolog.yaml | 19 -------- config/packages/monolog.yaml | 62 ++++++++++++++++++++++++++ config/packages/prod/deprecations.yaml | 8 ---- config/packages/prod/monolog.yaml | 16 ------- config/packages/test/monolog.yaml | 12 ----- symfony.lock | 13 +++--- 6 files changed, 67 insertions(+), 63 deletions(-) delete mode 100644 config/packages/dev/monolog.yaml create mode 100644 config/packages/monolog.yaml delete mode 100644 config/packages/prod/deprecations.yaml delete mode 100644 config/packages/prod/monolog.yaml delete mode 100644 config/packages/test/monolog.yaml diff --git a/config/packages/dev/monolog.yaml b/config/packages/dev/monolog.yaml deleted file mode 100644 index b1998da1..00000000 --- a/config/packages/dev/monolog.yaml +++ /dev/null @@ -1,19 +0,0 @@ -monolog: - handlers: - main: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - channels: ["!event"] - # uncomment to get logging in your browser - # you may have to allow bigger header sizes in your Web server configuration - #firephp: - # type: firephp - # level: info - #chromephp: - # type: chromephp - # level: info - console: - type: console - process_psr_3_messages: false - channels: ["!event", "!doctrine", "!console"] diff --git a/config/packages/monolog.yaml b/config/packages/monolog.yaml new file mode 100644 index 00000000..9db7d8a7 --- /dev/null +++ b/config/packages/monolog.yaml @@ -0,0 +1,62 @@ +monolog: + channels: + - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists + +when@dev: + monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + channels: ["!event"] + # uncomment to get logging in your browser + # you may have to allow bigger header sizes in your Web server configuration + #firephp: + # type: firephp + # level: info + #chromephp: + # type: chromephp + # level: info + console: + type: console + process_psr_3_messages: false + channels: ["!event", "!doctrine", "!console"] + +when@test: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [404, 405] + channels: ["!event"] + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + +when@prod: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [404, 405] + buffer_size: 50 # How many messages should be saved? Prevent memory leaks + nested: + type: stream + path: php://stderr + level: debug + formatter: monolog.formatter.json + console: + type: console + process_psr_3_messages: false + channels: ["!event", "!doctrine"] + deprecation: + type: stream + channels: [deprecation] + path: php://stderr + formatter: monolog.formatter.json diff --git a/config/packages/prod/deprecations.yaml b/config/packages/prod/deprecations.yaml deleted file mode 100644 index 920a0619..00000000 --- a/config/packages/prod/deprecations.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists -#monolog: -# channels: [deprecation] -# handlers: -# deprecation: -# type: stream -# channels: [deprecation] -# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" diff --git a/config/packages/prod/monolog.yaml b/config/packages/prod/monolog.yaml deleted file mode 100644 index bfe69c01..00000000 --- a/config/packages/prod/monolog.yaml +++ /dev/null @@ -1,16 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [404, 405] - buffer_size: 50 # How many messages should be saved? Prevent memory leaks - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - console: - type: console - process_psr_3_messages: false - channels: ["!event", "!doctrine"] diff --git a/config/packages/test/monolog.yaml b/config/packages/test/monolog.yaml deleted file mode 100644 index fc40641d..00000000 --- a/config/packages/test/monolog.yaml +++ /dev/null @@ -1,12 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [404, 405] - channels: ["!event"] - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/symfony.lock b/symfony.lock index 181dbddc..3a4ecb48 100644 --- a/symfony.lock +++ b/symfony.lock @@ -420,18 +420,15 @@ "version": "v5.1.9" }, "symfony/monolog-bundle": { - "version": "3.3", + "version": "3.10", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "3.3", - "ref": "d7249f7d560f6736115eee1851d02a65826f0a56" + "branch": "main", + "version": "3.7", + "ref": "aff23899c4440dd995907613c1dd709b6f59503f" }, "files": [ - "config/packages/dev/monolog.yaml", - "config/packages/prod/deprecations.yaml", - "config/packages/prod/monolog.yaml", - "config/packages/test/monolog.yaml" + "config/packages/monolog.yaml" ] }, "symfony/notifier": { From 921e835267779bb0d39c5056b67a787383bb1518 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:14:14 +0100 Subject: [PATCH 35/45] [TASK] Update recipe for symfony/notifier --- config/packages/notifier.yaml | 8 ++------ symfony.lock | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config/packages/notifier.yaml b/config/packages/notifier.yaml index 3984a48d..d02f986a 100644 --- a/config/packages/notifier.yaml +++ b/config/packages/notifier.yaml @@ -1,11 +1,7 @@ framework: notifier: - #chatter_transports: - # slack: '%env(SLACK_DSN)%' - # telegram: '%env(TELEGRAM_DSN)%' - #texter_transports: - # twilio: '%env(TWILIO_DSN)%' - # nexmo: '%env(NEXMO_DSN)%' + chatter_transports: + texter_transports: channel_policy: # use chat/slack, chat/telegram, sms/twilio or sms/nexmo urgent: ['email'] diff --git a/symfony.lock b/symfony.lock index 3a4ecb48..2b3d7c02 100644 --- a/symfony.lock +++ b/symfony.lock @@ -432,12 +432,12 @@ ] }, "symfony/notifier": { - "version": "5.0", + "version": "6.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "5.0", - "ref": "c31585e252b32fe0e1f30b1f256af553f4a06eb9" + "ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc" }, "files": [ "config/packages/notifier.yaml" From c96f95337928a3a088d7f26fbd03bc89ed866ad8 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:19:52 +0100 Subject: [PATCH 36/45] [TASK] Update recipe for symfony/panther --- phpunit.xml.dist | 3 +++ symfony.lock | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 89c5b37e..a4f7272b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -24,4 +24,7 @@ + + + diff --git a/symfony.lock b/symfony.lock index 2b3d7c02..e5d80d42 100644 --- a/symfony.lock +++ b/symfony.lock @@ -447,7 +447,13 @@ "version": "v5.1.9" }, "symfony/panther": { - "version": "v0.7.1" + "version": "2.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "673836afb0eac2b0ec36c44f2ff0379e5a4b2177" + } }, "symfony/password-hasher": { "version": "v5.3.4" From 7f1c143da4eba302111381e95f66c22805a464cf Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:29:43 +0100 Subject: [PATCH 37/45] [TASK] Use strict comparisons --- src/Controller/Api/AbstractController.php | 4 ++-- src/Entity/MajorVersion.php | 4 ++-- src/Service/LegacyDataService.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controller/Api/AbstractController.php b/src/Controller/Api/AbstractController.php index e361458c..717f7667 100644 --- a/src/Controller/Api/AbstractController.php +++ b/src/Controller/Api/AbstractController.php @@ -133,9 +133,9 @@ protected function mapObjects(object $baseObject, array $data): void if (array_key_exists($fieldName, $data) && \is_string($data[$fieldName])) { if (isset($metadata->fieldMappings[$field]['type'])) { - if ($metadata->fieldMappings[$field]['type'] == 'datetime') { + if ($metadata->fieldMappings[$field]['type'] === 'datetime') { $data[$fieldName] = new \DateTime($data[$fieldName]); - } elseif ($metadata->fieldMappings[$field]['type'] == 'datetime_immutable') { + } elseif ($metadata->fieldMappings[$field]['type'] === 'datetime_immutable') { $data[$fieldName] = new \DateTimeImmutable($data[$fieldName]); } } diff --git a/src/Entity/MajorVersion.php b/src/Entity/MajorVersion.php index ec9d0094..cc142c2b 100644 --- a/src/Entity/MajorVersion.php +++ b/src/Entity/MajorVersion.php @@ -313,11 +313,11 @@ public function isActive(): bool public function isElts(): bool { $dateTime = new \DateTimeImmutable(); - if ($this->getMaintainedUntil() == null) { + if ($this->getMaintainedUntil() === null) { return false; } - if ($this->getEltsUntil() == null) { + if ($this->getEltsUntil() === null) { return false; } diff --git a/src/Service/LegacyDataService.php b/src/Service/LegacyDataService.php index ea8f28cb..4ccca44a 100644 --- a/src/Service/LegacyDataService.php +++ b/src/Service/LegacyDataService.php @@ -39,7 +39,7 @@ public function getReleaseJson(): string return $this->cache->get('releases.json', function (ItemInterface $item): string { $item->tag(['major-versions', 'major-version', 'releases', 'release']); $content = json_encode($this->majorVersionRepository->findAllPreparedForJson(), JSON_THROW_ON_ERROR); - $content = $content != false ? $content : ''; + $content = $content !== false ? $content : ''; // remove version suffix only used for version sorting return str_replace('.0000', '', $content); }); From 60a5dc36bc33c216b9361f35f4ede097f8654d99 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Thu, 21 Nov 2024 14:43:34 +0100 Subject: [PATCH 38/45] [TASK] Use markdown parser included in template bundle --- composer.json | 1 - composer.lock | 2 +- src/Twig/Filter/Parsedown.php | 45 ------------------- .../partials/version/changes.html.twig | 4 +- .../default/partials/version/news.html.twig | 2 +- .../partials/version/upgrading.html.twig | 2 +- templates/default/release-notes.html.twig | 2 +- 7 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 src/Twig/Filter/Parsedown.php diff --git a/composer.json b/composer.json index 0c26b548..7753c59f 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,6 @@ "doctrine/orm": "^2.12", "doctrine/persistence": "^2.5", "easycorp/easyadmin-bundle": "^4.3", - "erusev/parsedown": "^1.7", "guzzlehttp/guzzle": "^7.4", "guzzlehttp/promises": "^1.5", "jms/serializer": "^3.17", diff --git a/composer.lock b/composer.lock index 22c4e009..21fb583a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6fcfb20305afa175c6da292c9d01e195", + "content-hash": "7339b545be1829fa90a1f0746acd4204", "packages": [ { "name": "composer/ca-bundle", diff --git a/src/Twig/Filter/Parsedown.php b/src/Twig/Filter/Parsedown.php deleted file mode 100644 index 6aa1a665..00000000 --- a/src/Twig/Filter/Parsedown.php +++ /dev/null @@ -1,45 +0,0 @@ - $this->parse($markdown)), - ]; - } - - public function parse(string $markdown): string - { - return (new \Parsedown())->parse($markdown); - } -} diff --git a/templates/default/partials/version/changes.html.twig b/templates/default/partials/version/changes.html.twig index c5f7aac6..5a8abd0e 100644 --- a/templates/default/partials/version/changes.html.twig +++ b/templates/default/partials/version/changes.html.twig @@ -2,9 +2,9 @@ {% frame with { id: 'changes', title: 'Changes' } %}
{% if current.elts %} - {{ current.releaseNotes.changes|removeWikiLink|escape('html')|parsedown|changehighlighter|raw }} + {{ current.releaseNotes.changes|removeWikiLink|escape('html')|markdown|changehighlighter|raw }} {% else %} - {{ current.releaseNotes.changes|removeWikiLink|escape('html')|parsedown|changehighlighter|commitlinker|raw }} + {{ current.releaseNotes.changes|removeWikiLink|escape('html')|markdown|changehighlighter|commitlinker|raw }} {% endif %}
{% endframe %} diff --git a/templates/default/partials/version/news.html.twig b/templates/default/partials/version/news.html.twig index fd3b480b..3845c11b 100644 --- a/templates/default/partials/version/news.html.twig +++ b/templates/default/partials/version/news.html.twig @@ -1,7 +1,7 @@ {% if current.releaseNotes.news or current.releaseNotes.newslink %} {% frame with { id: 'news', title: 'News' }%} {% if current.releaseNotes.news %} - {{ current.releaseNotes.news|parsedown|raw }} + {{ current.releaseNotes.news|markdown|raw }} {% endif %} {% if current.releaseNotes.newslink %} diff --git a/templates/default/partials/version/upgrading.html.twig b/templates/default/partials/version/upgrading.html.twig index d524140f..c8a8d9cf 100644 --- a/templates/default/partials/version/upgrading.html.twig +++ b/templates/default/partials/version/upgrading.html.twig @@ -1,5 +1,5 @@ {% if current.releaseNotes.upgradingInstructions %} {% frame with { id: 'upgrading', title: 'Upgrading' } %} - {{ current.releaseNotes.upgradingInstructions|parsedown|raw }} + {{ current.releaseNotes.upgradingInstructions|markdown|raw }} {% endframe %} {% endif %} diff --git a/templates/default/release-notes.html.twig b/templates/default/release-notes.html.twig index cb12fd8c..73f8e1ae 100644 --- a/templates/default/release-notes.html.twig +++ b/templates/default/release-notes.html.twig @@ -14,7 +14,7 @@ {% if currentVersion.current.releaseNotes.legacyContent %} {% frame %} - {{ currentVersion.current.releaseNotes.legacyContent|escape('html')|parsedown|changehighlighter|raw }} + {{ currentVersion.current.releaseNotes.legacyContent|escape('html')|markdown|changehighlighter|raw }} {% endframe %} {% include 'default/partials/version/signatures.html.twig' with currentVersion only %} {% else %} From 6bc9ab25007cfef658b460ef6f0b497488a81981 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:25:57 +0100 Subject: [PATCH 39/45] [TASK] Fix phpstan for level 5, Generate baseline for level max (#465) * [TASK] Fix phpstan for level 5 * [TASK] Raise phpstan level to max and generate baseline --- composer.json | 3 + phpstan-baseline.neon | 307 ++++++++++++++++++++++++ phpstan.neon | 2 + src/DataFixtures/ReleaseFixtures.php | 2 +- src/Entity/Release.php | 2 +- src/Form/SitepackageType.php | 2 +- src/Model/SatisJson.php | 4 +- src/Service/ComposerPackagesService.php | 2 +- src/Twig/Filter/ChangeHighlighter.php | 2 +- 9 files changed, 319 insertions(+), 7 deletions(-) create mode 100644 phpstan-baseline.neon diff --git a/composer.json b/composer.json index 7753c59f..403004e7 100644 --- a/composer.json +++ b/composer.json @@ -222,6 +222,9 @@ "fix:php": [ "@fix:php:cs-fixer" ], + "update:phpstan-baseline": [ + "@php phpstan analyse --generate-baseline" + ], "fix:php:cs-fixer": "@php php-cs-fixer fix", "satis:install": [ "rm -fr satis", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 00000000..b5f24234 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,307 @@ +parameters: + ignoreErrors: + - + message: '#^Parameter \#1 \$environment of class App\\Kernel constructor expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: public/index.php + + - + message: '#^Cannot access offset ''composer_name'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 2 + path: src/Command/ExtensionsTerJsonCreateCommand.php + + - + message: '#^Cannot access offset ''error'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Command/ExtensionsTerJsonCreateCommand.php + + - + message: '#^Parameter \#1 \$dependencies of method App\\Command\\ExtensionsTerJsonCreateCommand\:\:getPackageLinks\(\) expects array\\>, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/Command/ExtensionsTerJsonCreateCommand.php + + - + message: '#^Parameter \#1 \$message of class RuntimeException constructor expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Command/ExtensionsTerJsonCreateCommand.php + + - + message: '#^Property App\\Command\\ExtensionsTerJsonCreateCommand\:\:\$extensions \(array\\) does not accept array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Command/ExtensionsTerJsonCreateCommand.php + + - + message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable + count: 1 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Binary operation "\." between mixed and ''\:'' results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Cannot access offset ''releases'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Cannot access offset ''tar'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Cannot access offset ''url'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 2 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Cannot access offset ''zip'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Parameter \#1 \$url of method App\\Command\\ListMissingDownloadsCommand\:\:getFixedUrl\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 2 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Parameter \#2 \$release of method App\\Command\\ListMissingDownloadsCommand\:\:getFixedUrl\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 2 + path: src/Command/ListMissingDownloadsCommand.php + + - + message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(mixed\)\: mixed\)\|null, Closure\(Symfony\\Component\\Validator\\ConstraintViolationInterface\)\: \(string\|Stringable\) given\.$#' + identifier: argument.type + count: 1 + path: src/Controller/Api/SitepackageController.php + + - + message: '#^Parameter \#1 \$packages of method App\\Service\\ComposerPackagesService\:\:cleanPackagesForVersions\(\) expects array\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/Controller/DefaultController.php + + - + message: '#^Binary operation "\." between ''https\://typo3…'' and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Cannot access offset ''latest'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Cannot access offset ''releases'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Cannot access offset ''version'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Cannot access offset mixed on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Cannot cast mixed to string\.$#' + identifier: cast.string + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Method App\\Controller\\DownloadController\:\:getDownloadRedirect\(\) should return array\{url\: string, version\: string, format\: string\} but returns array\{url\: non\-falsy\-string, version\: mixed, format\: ''tar\.gz''\|''tar\.gz\.sig''\|''zip''\|''zip\.sig''\}\.$#' + identifier: return.type + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Parameter \#1 \$version1 of function version_compare expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Controller/DownloadController.php + + - + message: '#^Method App\\Controller\\SitepackageController\:\:createEditSitePackageForm\(\) return type with generic interface Symfony\\Component\\Form\\FormInterface does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Controller/SitepackageController.php + + - + message: '#^Method App\\Controller\\SitepackageController\:\:createNewSitepackageForm\(\) return type with generic interface Symfony\\Component\\Form\\FormInterface does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Controller/SitepackageController.php + + - + message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DataFixtures/ReleaseFixtures.php + + - + message: '#^Method App\\Entity\\Release\:\:getMajorVersion\(\) should return App\\Entity\\MajorVersion but returns App\\Entity\\MajorVersion\|null\.$#' + identifier: return.type + count: 1 + path: src/Entity/Release.php + + - + message: '#^Binary operation "\." between ''Unknown option \('' and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/Enum/AbstractEnum.php + + - + message: '#^Class App\\Form\\AuthorType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Form/AuthorType.php + + - + message: '#^Method App\\Form\\AuthorType\:\:buildForm\(\) has no return type specified\.$#' + identifier: missingType.return + count: 1 + path: src/Form/AuthorType.php + + - + message: '#^Cannot access offset ''icon'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Form/Extension/AbstractIconExtension.php + + - + message: '#^Class App\\Form\\SitepackageType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Form/SitepackageType.php + + - + message: '#^Parameter \#1 \$action of method Symfony\\Component\\Form\\FormConfigBuilderInterface\\:\:setAction\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Form/SitepackageType.php + + - + message: '#^Offset ''repositories'' might not exist on array\{name\: string, homepage\: string\|null, repositories\?\: array\\>\|null, require\?\: array\\|null, require\-all\: bool, require\-dependencies\: bool, require\-dev\-dependencies\: bool\}\.$#' + identifier: offsetAccess.notFound + count: 1 + path: src/Model/SatisJson.php + + - + message: '#^Offset ''require'' might not exist on array\{name\: string, homepage\: string\|null, repositories\?\: non\-empty\-array\\>\|null, require\?\: array\\|null, require\-all\: bool, require\-dependencies\: bool, require\-dev\-dependencies\: bool\}\.$#' + identifier: offsetAccess.notFound + count: 1 + path: src/Model/SatisJson.php + + - + message: '#^Method App\\Repository\\MajorVersionRepository\:\:findAllActiveElts\(\) should return array\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Repository/MajorVersionRepository.php + + - + message: '#^Method App\\Repository\\MajorVersionRepository\:\:findAllComposerSupported\(\) should return array\ but returns array\\.$#' + identifier: return.type + count: 1 + path: src/Repository/MajorVersionRepository.php + + - + message: '#^Method App\\Repository\\MajorVersionRepository\:\:findLatestLtsComposerSupported\(\) should return App\\Entity\\MajorVersion\|null but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/Repository/MajorVersionRepository.php + + - + message: '#^Parameter \#1 \$version of method App\\Repository\\MajorVersionRepository\:\:majorVersionDescending\(\) expects App\\Entity\\MajorVersion, mixed given\.$#' + identifier: argument.type + count: 2 + path: src/Repository/MajorVersionRepository.php + + - + message: '#^Parameter \#1 \$versions of method App\\Repository\\MajorVersionRepository\:\:removeVersionsWithoutReleases\(\) expects array\, array\ given\.$#' + identifier: argument.type + count: 3 + path: src/Repository/MajorVersionRepository.php + + - + message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/Service/CacheWarmupService.php + + - + message: '#^Cannot call method getStatusCode\(\) on mixed\.$#' + identifier: method.nonObject + count: 1 + path: src/Service/CacheWarmupService.php + + - + message: '#^Method App\\Service\\ComposerPackagesService\:\:buildForm\(\) has parameter \$builder with generic interface Symfony\\Component\\Form\\FormBuilderInterface but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Service/ComposerPackagesService.php + + - + message: '#^Method App\\Service\\ComposerPackagesService\:\:buildForm\(\) return type with generic interface Symfony\\Component\\Form\\FormInterface does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/Service/ComposerPackagesService.php + + - + message: '#^Offset 0 might not exist on array\{0\?\: string\}\.$#' + identifier: offsetAccess.notFound + count: 1 + path: src/Service/ComposerPackagesService.php + + - + message: '#^Parameter \#1 \$child of method Symfony\\Component\\Form\\FormBuilderInterface\\:\:add\(\) expects string\|Symfony\\Component\\Form\\FormBuilderInterface, list\\|string given\.$#' + identifier: argument.type + count: 1 + path: src/Service/ComposerPackagesService.php + + - + message: '#^Parameter \#1 \$releases of method App\\Twig\\Filter\\SortByVersion\:\:sort\(\) expects Doctrine\\Common\\Collections\\Collection\, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Twig/Filter/SortByVersion.php + + - + message: '#^Method App\\Tests\\Functional\\Controller\\Api\\ApiCase\:\:decodeResponse\(\) should return array\ but returns array\\.$#' + identifier: return.type + count: 1 + path: tests/Functional/Controller/Api/ApiCase.php diff --git a/phpstan.neon b/phpstan.neon index 5b2830e8..37618b76 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,5 @@ +includes: + - phpstan-baseline.neon parameters: level: max treatPhpDocTypesAsCertain: false diff --git a/src/DataFixtures/ReleaseFixtures.php b/src/DataFixtures/ReleaseFixtures.php index 20182337..3ebc0098 100644 --- a/src/DataFixtures/ReleaseFixtures.php +++ b/src/DataFixtures/ReleaseFixtures.php @@ -121,7 +121,7 @@ protected function generateReleasesForMajorVersion( for ($changeIteration = 0; $changeIteration < $faker->numberBetween(5, 50); ++$changeIteration) { $changelog[] = sprintf( '2019-10-30 7254d67918 [%s] ' . $faker->sentence($faker->numberBetween(4, 8)) . ' (thanks to %s)', - $faker->randomElement($changelogTypes), /** @phpstan-ignore-line */ + $faker->randomElement($changelogTypes), $faker->name() ); } diff --git a/src/Entity/Release.php b/src/Entity/Release.php index 71334cb6..cd419143 100644 --- a/src/Entity/Release.php +++ b/src/Entity/Release.php @@ -95,7 +95,7 @@ class Release implements \JsonSerializable, \Stringable #[Assert\NotNull] #[ORM\ManyToOne(targetEntity: MajorVersion::class, inversedBy: 'releases')] #[ORM\JoinColumn(name: 'major_version', referencedColumnName: 'version')] - private MajorVersion $majorVersion; + private ?MajorVersion $majorVersion; #[Assert\Valid] #[ORM\Embedded(class: ReleaseNotes::class)] diff --git a/src/Form/SitepackageType.php b/src/Form/SitepackageType.php index 66f46e08..068e3b03 100644 --- a/src/Form/SitepackageType.php +++ b/src/Form/SitepackageType.php @@ -34,7 +34,7 @@ class SitepackageType extends AbstractType { /** - * @param array{action: string} $options + * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Model/SatisJson.php b/src/Model/SatisJson.php index 7cb5b066..f6b6e6c8 100644 --- a/src/Model/SatisJson.php +++ b/src/Model/SatisJson.php @@ -29,8 +29,8 @@ class SatisJson implements \Stringable * @var array{ * name: string, * homepage: string|null, - * repositories: array>|array{}, - * require: array|array{}, + * repositories?: array>|null, + * require?: array|null, * require-all: bool, * require-dependencies: bool, * require-dev-dependencies: bool diff --git a/src/Service/ComposerPackagesService.php b/src/Service/ComposerPackagesService.php index 77c1cf2b..8e0137a8 100644 --- a/src/Service/ComposerPackagesService.php +++ b/src/Service/ComposerPackagesService.php @@ -818,7 +818,7 @@ public function buildForm(FormBuilderInterface $builder): FormInterface foreach (self::PACKAGES as $package) { $builder->add( - str_replace('/', '-', $package['name']), /** @phpstan-ignore-line */ + str_replace('/', '-', $package['name']), CheckboxType::class, [ 'value' => $package['name'], diff --git a/src/Twig/Filter/ChangeHighlighter.php b/src/Twig/Filter/ChangeHighlighter.php index c34fe1aa..ab857aff 100644 --- a/src/Twig/Filter/ChangeHighlighter.php +++ b/src/Twig/Filter/ChangeHighlighter.php @@ -48,7 +48,7 @@ public function highlightChanges(string $changeList): ?string $pattern, static function ($matches): string { $cssClass = 'change-' . strtolower($matches['type']); - if (isset($matches['important']) && $matches['important'] !== '') { + if ($matches['important'] !== '') { $cssClass .= ' change-important'; } From df8b8d1840f4722c2ef8d6c0a78a94d73c3c516c Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Fri, 22 Nov 2024 11:05:11 +0100 Subject: [PATCH 40/45] [TASK] Drop deploy targets and simplify deployment --- .github/workflows/continuous-integration.yml | 13 +------- .github/workflows/deployment.yml | 27 ++--------------- .github/workflows/manual-deployment.yml | 18 ------------ .mage.yml | 31 -------------------- 4 files changed, 3 insertions(+), 86 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c32ccc59..c6da8690 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -2,10 +2,6 @@ name: Continuous Integration / Deployment (CI/CD) on: push: - branches: - - develop - - production - - stage pull_request: jobs: @@ -21,7 +17,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -57,7 +52,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -93,7 +87,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -129,7 +122,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -167,7 +159,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -205,7 +196,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -243,7 +233,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.2' - tools: composer:2 - name: Get Composer Cache Directory id: composer-cache @@ -286,7 +275,7 @@ jobs: - validation - php_coding_standards - php_stan - if: ${{ github.event_name == 'push' }} + if: (github.ref == 'refs/heads/production') && github.event_name == 'push' && (github.repository == 'TYPO3/get.typo3.org') uses: ./.github/workflows/deployment.yml secrets: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ac4f5ae4..c6e349bb 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -2,17 +2,6 @@ name: Deployment on: workflow_call: - inputs: - php_version: - description: 'PHP version to be used for the deployment.' - default: '8.2' - required: false - type: string - composer_version: - description: 'Composer version to be used for the deployment.' - default: '2' - required: false - type: string secrets: SSH_PRIVATE_KEY: required: true @@ -20,20 +9,8 @@ on: required: true jobs: - print_inputs: - name: Print Inputs - runs-on: ubuntu-latest - - steps: - - name: Print the inputs - run: | - echo PHP version: ${{ inputs.php_version }} - echo Composer version: ${{ inputs.composer_version }} - deploy: name: Deploy - needs: - - print_inputs runs-on: ubuntu-latest steps: @@ -54,8 +31,8 @@ jobs: - name: Set up PHP Version uses: shivammathur/setup-php@v2 with: - php-version: ${{ inputs.php_version }} - tools: composer:${{ inputs.composer_version }}, andres-montanez/magallanes + php-version: '8.2' + tools: andres-montanez/magallanes - name: Get Environment id: environment diff --git a/.github/workflows/manual-deployment.yml b/.github/workflows/manual-deployment.yml index f57401d7..c63048d2 100644 --- a/.github/workflows/manual-deployment.yml +++ b/.github/workflows/manual-deployment.yml @@ -2,29 +2,11 @@ name: Manual Deployment on: workflow_dispatch: - inputs: - php_version: - description: 'PHP version to be used for the deployment.' - default: '8.2' - required: true - type: choice - options: - - '8.2' - - 'latest' - - 'nightly' - composer_version: - description: 'Composer version to be used for the deployment.' - default: '2' - required: true - type: string jobs: deployment: name: Deployment uses: ./.github/workflows/deployment.yml - with: - php_version: ${{ github.event.inputs.php_version }} - composer_version: ${{ github.event.inputs.composer_version }} secrets: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PASSPHRASE: ${{ secrets.SSH_PASSPHRASE }} diff --git a/.mage.yml b/.mage.yml index 8c7ce9a3..87645f89 100644 --- a/.mage.yml +++ b/.mage.yml @@ -18,37 +18,6 @@ magephp: - ./phpunit.xml.dist - ./README.md environments: - develop: - user: get-stage - from: ./* ./.env - host_path: ./site/mage/ - releases: 3 - hosts: - - t3o04.typo3server.ch - pre-deploy: - - exec: { cmd: "echo \"APP_ENV=prod\" >> .env.local", desc: "Create .env.local" } - - composer/install: { flags: '--no-dev --no-progress --optimize-autoloader' } - on-deploy: - - exec: { cmd: 'mkdir -p var', desc: 'Create var folder' } - - exec: { cmd: 'mkdir -p var/satis', desc: 'Create var/satis folder' } - - exec: { cmd: 'test -d ~/site/shared/public/satis || mkdir -p ~/site/shared/public/satis', desc: 'Create shared/public/satis folder' } - - fs/link: { from: "../../../shared/.env.local", to: ".env.local" } - - fs/link: { from: "../../../../shared/public/satis", to: "public/satis" } - - fs/link: { from: "satis/p", to: "public/p" } - - fs/link: { from: "satis/p2", to: "public/p2" } - - fs/link: { from: "satis/aliases.json", to: "public/aliases.json" } - - fs/link: { from: "satis/packages.json", to: "public/packages.json" } - - exec: { cmd: "sqlite3 ~/site/mage/current/var/gettr.db '.backup var/gettr.db'", desc: "Copy DB" } - - exec: { cmd: "php-restart", desc: "Restart PHP and reset OPcache" } - - exec: { cmd: "php ./bin/console doctrine:migrations:sync-metadata-storage --no-interaction", desc: "Synchronize DB Migrations" } - - exec: { cmd: "php ./bin/console doctrine:migrations:migrate --no-interaction", desc: "Apply DB Migrations" } - - exec: { cmd: "php ./bin/console cache:clear --env=prod", desc: "Clear Cache", timeout: 600 } - - exec: { cmd: "php ./bin/console cache:warmup --env=prod", desc: "Cache Warmup", timeout: 600 } - - exec: { cmd: "crontab cnf/crontab-dev.cron", desc: "Install crontab" } - on-release: - - exec: { cmd: "php-restart", desc: "Restart PHP and reset OPcache again" } - post-release: - post-deploy: production: user: get-prod from: ./* ./.env From 51b01ccd6d987188e850ed17a1afd79d90a07c0d Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:17:45 +0100 Subject: [PATCH 41/45] [TASK] Use PAGEVIEW with data processor page-content (#463) https://docs.typo3.org/m/typo3/reference-typoscript/13.4/en-us/ContentObjects/Pageview/Index.html https://docs.typo3.org/m/typo3/reference-typoscript/13.4/en-us/DataProcessing/PageContentFetchingProcessor.html --- ...le.tsconfig.twig => default.tsconfig.twig} | 5 +- .../Helper/DynamicContent.typoscript.twig | 64 ------------------- .../Sets/SitePackage/settings.yaml.twig | 12 ++-- .../Sets/SitePackage/setup.typoscript.twig | 50 ++------------- .../Layouts}/.gitkeep | 0 .../Partials}/.gitkeep | 0 .../Templates}/.gitkeep | 0 .../Private/Language/locallang_be.xlf.twig | 6 ++ .../Layouts}/Default.html.twig | 0 .../Private/PageView/Pages/Default.html.twig | 19 ++++++ .../PageView/Partials/Content.html.twig | 7 ++ .../Templates/ContentElements/.gitkeep | 1 - .../Private/Templates/Page/Default.html.twig | 19 ------ 13 files changed, 47 insertions(+), 136 deletions(-) rename resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/{example.tsconfig.twig => default.tsconfig.twig} (90%) delete mode 100644 resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/Helper/DynamicContent.typoscript.twig rename resources/packages/fluid_styled_content/13.4/src/Resources/Private/{Layouts/ContentElements => ContentElements/Layouts}/.gitkeep (100%) rename resources/packages/fluid_styled_content/13.4/src/Resources/Private/{Partials/ContentElements => ContentElements/Partials}/.gitkeep (100%) rename resources/packages/fluid_styled_content/13.4/src/Resources/Private/{Partials/Page => ContentElements/Templates}/.gitkeep (100%) rename resources/packages/fluid_styled_content/13.4/src/Resources/Private/{Layouts/Page => PageView/Layouts}/Default.html.twig (100%) create mode 100644 resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Pages/Default.html.twig create mode 100644 resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Partials/Content.html.twig delete mode 100644 resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/ContentElements/.gitkeep delete mode 100644 resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/Page/Default.html.twig diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/example.tsconfig.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/default.tsconfig.twig similarity index 90% rename from resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/example.tsconfig.twig rename to resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/default.tsconfig.twig index 628a7254..a7300948 100644 --- a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/example.tsconfig.twig +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/default.tsconfig.twig @@ -1,10 +1,10 @@ # -# BACKENDLAYOUT: EXAMPLE +# BACKENDLAYOUT: DEFAULT # mod { web_layout { BackendLayouts { - example { + default { title = LLL:EXT:{{ package.extensionKey }}/Resources/Private/Language/locallang_be.xlf:backend_layout.example config { backend_layout { @@ -16,6 +16,7 @@ mod { 1 { name = LLL:EXT:{{ package.extensionKey }}/Resources/Private/Language/locallang_be.xlf:backend_layout.column.normal colPos = 0 + identifier = main } } } diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/Helper/DynamicContent.typoscript.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/Helper/DynamicContent.typoscript.twig deleted file mode 100644 index 993b020b..00000000 --- a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/Helper/DynamicContent.typoscript.twig +++ /dev/null @@ -1,64 +0,0 @@ -################################################ -#### DYNAMIC CONTENT LIB FOR USAGE IN FLUID #### -################################################ -# -# EXAMPLE -# --------------- -# |'}" /> -# -# -# COLUMN NUMBERS -# --------------- -# -# 0 = main -# 1 = left -# 2 = right -# 3 = border -# -################# -lib.dynamicContent = COA -lib.dynamicContent { - 5 = LOAD_REGISTER - 5 { - colPos.cObject = TEXT - colPos.cObject { - field = colPos - ifEmpty.cObject = TEXT - ifEmpty.cObject { - value.current = 1 - ifEmpty = 0 - } - } - pageUid.cObject = TEXT - pageUid.cObject { - field = pageUid - ifEmpty.data = TSFE:id - } - contentFromPid.cObject = TEXT - contentFromPid.cObject { - data = DB:pages:{register:pageUid}:content_from_pid - data.insertData = 1 - } - wrap.cObject = TEXT - wrap.cObject { - field = wrap - } - } - 20 = CONTENT - 20 { - table = tt_content - select { - includeRecordsWithoutDefaultTranslation = 1 - orderBy = sorting - where = {{ '{#colPos}={register:colPos}' }} - where.insertData = 1 - pidInList.data = register:pageUid - pidInList.override.data = register:contentFromPid - } - stdWrap { - dataWrap = {register:wrap} - required = 1 - } - } - 90 = RESTORE_REGISTER -} diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/settings.yaml.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/settings.yaml.twig index bc6f8e57..7862ca31 100644 --- a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/settings.yaml.twig +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/settings.yaml.twig @@ -1,14 +1,12 @@ styles: templates: - layoutRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Layouts/ContentElements/' - partialRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Partials/ContentElements/' - templateRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Templates/ContentElements/' + layoutRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/ContentElements/Layouts/' + partialRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/ContentElements/Partials/' + templateRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/ContentElements/Templates/' page: - fluidtemplate: - layoutRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Layouts/Page/' - partialRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Partials/Page/' - templateRootPath: 'EXT:{{ package.extensionKey }}/Resources/Private/Templates/Page/' + pageview: + paths: 'EXT:{{ package.extensionKey }}/Resources/Private/PageView/' meta: viewport: 'width=device-width, initial-scale=1' diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig index 31b3d433..af881eb5 100644 --- a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig @@ -1,5 +1,3 @@ -@import './TypoScript/Helper/DynamicContent.typoscript' - ############## #### PAGE #### ############## @@ -8,58 +6,24 @@ page { typeNum = 0 shortcutIcon = EXT:{{ package.extensionKey }}/Resources/Public/Icons/favicon.ico - 10 = FLUIDTEMPLATE + 10 = PAGEVIEW 10 { - # Template names will be generated automatically by converting the applied - # backend_layout, there is no explicit mapping necessary anymore. - # - # BackendLayout Key - # subnavigation_right_2_columns -> SubnavigationRight2Columns.html - # - # Backend Record - # uid: 1 -> 1.html - # - # Database Entry - # value: -1 -> None.html - # value: pagets__subnavigation_right_2_columns -> SubnavigationRight2Columns.html - templateName = TEXT - templateName { - cObject = TEXT - cObject { - data = pagelayout - required = 1 - case = uppercamelcase - split { - token = pagets__ - cObjNum = 1 - 1.current = 1 - } - } - ifEmpty = Default - } - templateRootPaths { - 0 = EXT:{{ package.extensionKey }}/Resources/Private/Templates/Page/ - 1 = {$page.fluidtemplate.templateRootPath} - } - partialRootPaths { - 0 = EXT:{{ package.extensionKey }}/Resources/Private/Partials/Page/ - 1 = {$page.fluidtemplate.partialRootPath} - } - layoutRootPaths { - 0 = EXT:{{ package.extensionKey }}/Resources/Private/Layouts/Page/ - 1 = {$page.fluidtemplate.layoutRootPath} + paths { + 0 = EXT:{{ package.extensionKey }}/Resources/Private/PageView/ + 1 = {$page.pageview.paths} } dataProcessing { - 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 10 = files 10 { references.fieldName = media } - 20 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor + 20 = menu 20 { levels = 2 includeSpacer = 1 as = mainnavigation } + 30 = page-content } } diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Layouts/ContentElements/.gitkeep b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Layouts/.gitkeep similarity index 100% rename from resources/packages/fluid_styled_content/13.4/src/Resources/Private/Layouts/ContentElements/.gitkeep rename to resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Layouts/.gitkeep diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Partials/ContentElements/.gitkeep b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Partials/.gitkeep similarity index 100% rename from resources/packages/fluid_styled_content/13.4/src/Resources/Private/Partials/ContentElements/.gitkeep rename to resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Partials/.gitkeep diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Partials/Page/.gitkeep b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Templates/.gitkeep similarity index 100% rename from resources/packages/fluid_styled_content/13.4/src/Resources/Private/Partials/Page/.gitkeep rename to resources/packages/fluid_styled_content/13.4/src/Resources/Private/ContentElements/Templates/.gitkeep diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Language/locallang_be.xlf.twig b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Language/locallang_be.xlf.twig index fb3e2d8e..4f7dd7ce 100644 --- a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Language/locallang_be.xlf.twig +++ b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Language/locallang_be.xlf.twig @@ -9,9 +9,15 @@ Default + + Stage + Normal + + Right + diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Layouts/Page/Default.html.twig b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Layouts/Default.html.twig similarity index 100% rename from resources/packages/fluid_styled_content/13.4/src/Resources/Private/Layouts/Page/Default.html.twig rename to resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Layouts/Default.html.twig diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Pages/Default.html.twig b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Pages/Default.html.twig new file mode 100644 index 00000000..4df9efcd --- /dev/null +++ b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Pages/Default.html.twig @@ -0,0 +1,19 @@ + + + +
+
+
Template file
+
+ packages/{{ package.extensionKey }}/Resources/Private/PageView/Pages/Default.html +
+
Backend Configuration
+
+ packages/{{ package.extensionKey }}/Configuration/Sets/SitePackage/PageTsConfig/BackendLayouts/default.tsconfig +
+
+
+ + + +
diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Partials/Content.html.twig b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Partials/Content.html.twig new file mode 100644 index 00000000..8ce77703 --- /dev/null +++ b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/PageView/Partials/Content.html.twig @@ -0,0 +1,7 @@ + + + diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/ContentElements/.gitkeep b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/ContentElements/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/ContentElements/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/Page/Default.html.twig b/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/Page/Default.html.twig deleted file mode 100644 index 312fc91f..00000000 --- a/resources/packages/fluid_styled_content/13.4/src/Resources/Private/Templates/Page/Default.html.twig +++ /dev/null @@ -1,19 +0,0 @@ - - - -
-
-
Template file
-
- typo3conf/ext/{{ package.extensionKey }}/Resources/Private/Templates/Page/Default.html -
-
Backend Configuration
-
- typo3conf/ext/{{ package.extensionKey }}/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts/default.tsconfig -
-
-
- - - -
From 365afb3c2d4999536b01c9b461171cbaeee2dad0 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Mon, 25 Nov 2024 07:55:33 +0100 Subject: [PATCH 42/45] [TASK] Display information on how to install Site Package on success page (#470) Only added for current LTS versions, in the other versions some of the links do not yet work Co-authored-by: Benjamin Kott --- .../partials/typoscript-provider.twig | 7 +++ templates/sitepackage/success.html.twig | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 templates/sitepackage/partials/typoscript-provider.twig diff --git a/templates/sitepackage/partials/typoscript-provider.twig b/templates/sitepackage/partials/typoscript-provider.twig new file mode 100644 index 00000000..a3a5cb85 --- /dev/null +++ b/templates/sitepackage/partials/typoscript-provider.twig @@ -0,0 +1,7 @@ +{% if sitepackage.typo3Version > 13 %} +

Include the Set "{{ sitepackage.title }}" in your site configuration. + See also Create a basic site set.

+{% else %} +

Include the TypoScript Set "{{ sitepackage.title }}" in the TypoScript record of your root page: + TypoScript template

+{% endif %} diff --git a/templates/sitepackage/success.html.twig b/templates/sitepackage/success.html.twig index a07d18ec..8c440f6e 100644 --- a/templates/sitepackage/success.html.twig +++ b/templates/sitepackage/success.html.twig @@ -11,6 +11,63 @@ Download {% endframe %} + {% if sitepackage.typo3Version > 12 %} + {% frame with { indent: true, id: 'sitepackage-installation', title: 'Install the Site Package', color: 'lighter' } %} +
+
+ +
+
+
+
+

Download the Site Package and save it into folder + packages + in the root of your TYPO3 installation.

+

Require the Site Package using Composer:

+
+                                        composer req {{ sitepackage.vendorNameAlternative }}/{{ sitepackage.packageNameAlternative }}
+                                    
+ {% include 'sitepackage/partials/typoscript-provider.twig' %} +
+
+
+
+ +
+
+
+
+

Download the Site Package and save it into folder + typo3conf/ext/ + in the root of your TYPO3 installation.

+

Activate extension "{{ sitepackage.title }}" with key {{ sitepackage.extensionKey }} in the Extension Manager.

+ {% include 'sitepackage/partials/typoscript-provider.twig' %} +
+
+
+
+
+
+ {% endframe %} + {% endif %} {% frame with { indent: true } %}

Generated Configuration

From b296aeca5c0804e6f452d5ea480b6192dab4b44d Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:00:12 +0100 Subject: [PATCH 43/45] [TASK] Break up TypoScript in files (#469) Co-authored-by: Benjamin Kott --- .../TypoScript/config.typoscript.twig | 36 ++++++ .../TypoScript/page.typoscript.twig | 64 +++++++++++ .../Sets/SitePackage/setup.typoscript.twig | 103 +----------------- 3 files changed, 101 insertions(+), 102 deletions(-) create mode 100644 resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/config.typoscript.twig create mode 100644 resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/page.typoscript.twig diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/config.typoscript.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/config.typoscript.twig new file mode 100644 index 00000000..0e8d38ea --- /dev/null +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/config.typoscript.twig @@ -0,0 +1,36 @@ +################ +#### CONFIG #### +################ +config { + absRefPrefix = auto + no_cache = {$config.no_cache} + uniqueLinkVars = 1 + pageTitleFirst = 1 + linkVars = L + prefixLocalAnchors = {$config.prefixLocalAnchors} + renderCharset = utf-8 + metaCharset = utf-8 + doctype = html5 + removeDefaultJS = {$config.removeDefaultJS} + inlineStyle2TempFile = 1 + admPanel = {$config.admPanel} + debug = 0 + cache_period = 86400 + sendCacheHeaders = {$config.sendCacheHeaders} + intTarget = + extTarget = + disablePrefixComment = 1 + index_enable = 1 + index_externals = 1 + index_metatags = 1 + headerComment = {$config.headerComment} + + // Disable Image Upscaling + noScaleUp = 1 + + // Compression and Concatenation of CSS and JS Files + compressJs = 0 + compressCss = 0 + concatenateJs = 0 + concatenateCss = 0 +} diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/page.typoscript.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/page.typoscript.twig new file mode 100644 index 00000000..01d13ddd --- /dev/null +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/TypoScript/page.typoscript.twig @@ -0,0 +1,64 @@ +############## +#### PAGE #### +############## +page = PAGE +page { + typeNum = 0 + shortcutIcon = EXT:{{ package.extensionKey }}/Resources/Public/Icons/favicon.ico + + 10 = PAGEVIEW + 10 { + paths { + 0 = EXT:{{ package.extensionKey }}/Resources/Private/PageView/ + 1 = {$page.pageview.paths} + } + dataProcessing { + 10 = files + 10 { + references.fieldName = media + } + 20 = menu + 20 { + levels = 2 + includeSpacer = 1 + as = mainnavigation + } + 30 = page-content + } + } + + meta { + viewport = {$page.meta.viewport} + robots = {$page.meta.robots} + apple-mobile-web-app-capable = {$page.meta.apple-mobile-web-app-capable} + + X-UA-Compatible = {$page.meta.compatible} + X-UA-Compatible { + attribute = http-equiv + } + } + + includeCSSLibs { + + } + + includeCSS { + {{ package.extensionKey }}_layout = EXT:{{ package.extensionKey }}/Resources/Public/Css/layout.css + } + + includeJSLibs { + + } + + includeJS { + + } + + includeJSFooterlibs { + + } + + includeJSFooter { + {{ package.extensionKey }}_scripts = EXT:{{ package.extensionKey }}/Resources/Public/JavaScript/main.js + } +} diff --git a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig index af881eb5..5a93f263 100644 --- a/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig +++ b/resources/packages/fluid_styled_content/13.4/src/Configuration/Sets/SitePackage/setup.typoscript.twig @@ -1,102 +1 @@ -############## -#### PAGE #### -############## -page = PAGE -page { - typeNum = 0 - shortcutIcon = EXT:{{ package.extensionKey }}/Resources/Public/Icons/favicon.ico - - 10 = PAGEVIEW - 10 { - paths { - 0 = EXT:{{ package.extensionKey }}/Resources/Private/PageView/ - 1 = {$page.pageview.paths} - } - dataProcessing { - 10 = files - 10 { - references.fieldName = media - } - 20 = menu - 20 { - levels = 2 - includeSpacer = 1 - as = mainnavigation - } - 30 = page-content - } - } - - meta { - viewport = {$page.meta.viewport} - robots = {$page.meta.robots} - apple-mobile-web-app-capable = {$page.meta.apple-mobile-web-app-capable} - - X-UA-Compatible = {$page.meta.compatible} - X-UA-Compatible { - attribute = http-equiv - } - } - - includeCSSLibs { - - } - - includeCSS { - {{ package.extensionKey }}_layout = EXT:{{ package.extensionKey }}/Resources/Public/Css/layout.css - } - - includeJSLibs { - - } - - includeJS { - - } - - includeJSFooterlibs { - - } - - includeJSFooter { - {{ package.extensionKey }}_scripts = EXT:{{ package.extensionKey }}/Resources/Public/JavaScript/main.js - } -} - - -################ -#### CONFIG #### -################ -config { - absRefPrefix = auto - no_cache = {$config.no_cache} - uniqueLinkVars = 1 - pageTitleFirst = 1 - linkVars = L - prefixLocalAnchors = {$config.prefixLocalAnchors} - renderCharset = utf-8 - metaCharset = utf-8 - doctype = html5 - removeDefaultJS = {$config.removeDefaultJS} - inlineStyle2TempFile = 1 - admPanel = {$config.admPanel} - debug = 0 - cache_period = 86400 - sendCacheHeaders = {$config.sendCacheHeaders} - intTarget = - extTarget = - disablePrefixComment = 1 - index_enable = 1 - index_externals = 1 - index_metatags = 1 - headerComment = {$config.headerComment} - - // Disable Image Upscaling - noScaleUp = 1 - - // Compression and Concatenation of CSS and JS Files - compressJs = 0 - compressCss = 0 - concatenateJs = 0 - concatenateCss = 0 -} +@import './TypoScript/' From b54c4323525c1a6e71c6d063bed617168bc67ce4 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Mon, 25 Nov 2024 08:03:58 +0100 Subject: [PATCH 44/45] [BUGFIX] Make text more readable, prefer lighter background colors --- templates/default/composer-helper.html.twig | 2 +- templates/default/composer-repository.html.twig | 2 +- templates/default/composer.html.twig | 2 +- templates/default/elts.html.twig | 2 +- templates/default/list.html.twig | 2 +- .../default/partials/release-notes/version-selector.html.twig | 2 +- templates/default/partials/version/inactive.html.twig | 2 +- .../default/partials/version/system-requirements.html.twig | 2 +- templates/default/root.html.twig | 2 +- templates/default/version.html.twig | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/default/composer-helper.html.twig b/templates/default/composer-helper.html.twig index df1b1fbc..5a80e881 100644 --- a/templates/default/composer-helper.html.twig +++ b/templates/default/composer-helper.html.twig @@ -10,7 +10,7 @@

Composer Helper

{% endframe %} - {% frame with { color: 'light' } %} + {% frame with { color: 'lighter' } %}

Select the composer packages

# paste this into your console
$ composer require
diff --git a/templates/default/composer-repository.html.twig b/templates/default/composer-repository.html.twig index 0fbea630..92e43b86 100644 --- a/templates/default/composer-repository.html.twig +++ b/templates/default/composer-repository.html.twig @@ -17,7 +17,7 @@
{% endframe %} - {% frame with { color: 'light', id: 'what', title: "What Is It?" } %} + {% frame with { color: 'lighter', id: 'what', title: "What Is It?" } %}

TYPO3 offers a Composer repository, enabling you to install TYPO3 extensions from the TYPO3 Extension Repository (TER) including their TER dependencies via Composer. The packages are updated once every 15 minutes.

This repository includes only the following TYPO3 CMS extensions:

    diff --git a/templates/default/composer.html.twig b/templates/default/composer.html.twig index 7ad07d15..cd2a2b53 100644 --- a/templates/default/composer.html.twig +++ b/templates/default/composer.html.twig @@ -11,7 +11,7 @@

    {% endframe %} - {% frame with { color: 'light' } %} + {% frame with { color: 'lighter' } %}

    How to use it?

    As a quick way to use Composer, the Base Distribution can be downloaded. It is assuming you have Composer already installed on your system. Detailed information is available in the TYPO3 Documentation.

    diff --git a/templates/default/elts.html.twig b/templates/default/elts.html.twig index 52f3048c..806e5e4c 100644 --- a/templates/default/elts.html.twig +++ b/templates/default/elts.html.twig @@ -7,7 +7,7 @@

    The version you requested is only available as an Extended Long Term Support (ELTS) version.

    {% endframe %} - {% frame with { color: 'light' } %} + {% frame with { color: 'lighter' } %}

    How to get access to an ELTS version?

    You can buy an ELTS license, for more information please visit: