From 59aa536706471fe12f4209014b4d130f9963548a Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 15:36:08 +0000 Subject: [PATCH 1/7] DevKit updates --- .github/workflows/test.yaml | 20 +++++++------------- rector.php | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c3133ef4..b4a28df65 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,7 +30,6 @@ jobs: strategy: matrix: php-version: - - '8.0' - '8.1' - '8.2' - '8.3' @@ -39,30 +38,25 @@ jobs: symfony-require: [''] variant: [normal] include: - - php-version: '8.0' + - php-version: '8.1' dependencies: lowest allowed-to-fail: false variant: normal - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 5.4.* - variant: symfony/symfony:"5.4.*" - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.3.* - variant: symfony/symfony:"6.3.*" + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" + symfony-require: 7.1.* + variant: symfony/symfony:"7.1.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 7.0.* - variant: symfony/symfony:"7.0.*" + symfony-require: 7.2.* + variant: symfony/symfony:"7.2.*" steps: - name: Checkout diff --git a/rector.php b/rector.php index 744632387..d57c8f491 100644 --- a/rector.php +++ b/rector.php @@ -31,7 +31,7 @@ ]); $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, + LevelSetList::UP_TO_PHP_81, PHPUnitSetList::PHPUNIT_90, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); From e367723bd28fa4199890dd5166a4dd0dbd9049b5 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 17:10:49 +0000 Subject: [PATCH 2/7] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index d57c8f491..295ccef6c 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitSetList; @@ -40,6 +41,7 @@ $rectorConfig->importShortClasses(false); $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, + ReadOnlyPropertyRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, ]); From 86a3744c73ea15eaf12c738c4fb6afea5a718117 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 16:53:35 +0100 Subject: [PATCH 3/7] Drop old versions --- composer.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index f6797de62..cf97488ba 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ ], "homepage": "https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle", "require": { - "php": "^8.0", + "php": "^8.1", "doctrine/dbal": "^3.4 || ^4.0", "doctrine/doctrine-bundle": "^2.10", "doctrine/orm": "^2.17 || ^3.0", @@ -33,16 +33,16 @@ "sonata-project/admin-bundle": "^4.18", "sonata-project/exporter": "^2.0 || ^3.0", "sonata-project/form-extensions": "^1.19 || ^2.0", - "symfony/config": "^5.4 || ^6.2 || ^7.0", - "symfony/console": "^5.4 || ^6.2 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0", - "symfony/doctrine-bridge": "^5.4 || ^6.2 || ^7.0", - "symfony/form": "^5.4 || ^6.2 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.2 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.2 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.2 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.2 || ^7.0", - "symfony/property-access": "^5.4 || ^6.2 || ^7.0", + "symfony/config": "^6.4 || ^7.1", + "symfony/console": "^6.4 || ^7.1", + "symfony/dependency-injection": "^6.4 || ^7.1", + "symfony/doctrine-bridge": "^6.4 || ^7.1", + "symfony/form": "^6.4 || ^7.1", + "symfony/framework-bundle": "^6.4 || ^7.1", + "symfony/http-foundation": "^6.4 || ^7.1", + "symfony/http-kernel": "^6.4 || ^7.1", + "symfony/options-resolver": "^6.4 || ^7.1", + "symfony/property-access": "^6.4 || ^7.1", "symfony/security-acl": "^3.0", "twig/twig": "^3.0" }, @@ -63,13 +63,13 @@ "rector/rector": "^1.1", "sonata-project/block-bundle": "^5.0", "sonata-project/entity-audit-bundle": "^1.1", - "symfony/browser-kit": "^5.4 || ^6.2 || ^7.0", - "symfony/css-selector": "^5.4 || ^6.2 || ^7.0", + "symfony/browser-kit": "^6.4 || ^7.1", + "symfony/css-selector": "^6.4 || ^7.1", "symfony/panther": "^2.0.1", - "symfony/phpunit-bridge": "^6.2 || ^7.0", - "symfony/templating": "^5.4 || ^6.2 || ^7.0", - "symfony/uid": "^5.4 || ^6.2 || ^7.0", - "symfony/yaml": "^5.4 || ^6.2 || ^7.0", + "symfony/phpunit-bridge": "^6.4 || ^7.1", + "symfony/templating": "^6.4 || ^7.1", + "symfony/uid": "^6.4 || ^7.1", + "symfony/yaml": "^6.4 || ^7.1", "vimeo/psalm": "^5.7", "weirdan/doctrine-psalm-plugin": "^2.0" }, From 3c44d8e489199299506d284cb3478f035062c132 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 18:35:41 +0100 Subject: [PATCH 4/7] Bump sonata admin --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cf97488ba..9dd095fc6 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "doctrine/doctrine-bundle": "^2.10", "doctrine/orm": "^2.17 || ^3.0", "doctrine/persistence": "^3.0.2", - "sonata-project/admin-bundle": "^4.18", + "sonata-project/admin-bundle": "^4.34", "sonata-project/exporter": "^2.0 || ^3.0", "sonata-project/form-extensions": "^1.19 || ^2.0", "symfony/config": "^6.4 || ^7.1", From e73d3697bc6423b72980496dffcb74b5ad2dc713 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 18:43:03 +0100 Subject: [PATCH 5/7] Remove useless action --- .github/workflows/test_orm_3.yaml | 65 ------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 .github/workflows/test_orm_3.yaml diff --git a/.github/workflows/test_orm_3.yaml b/.github/workflows/test_orm_3.yaml deleted file mode 100644 index 865a6f268..000000000 --- a/.github/workflows/test_orm_3.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# TEMPORARILY USED until AuditBundle is compatible with ORM 3 - -name: Test - -on: - pull_request: - -permissions: - contents: read - -jobs: - test: - name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} (ORM 3) - - runs-on: ubuntu-latest - - continue-on-error: ${{ matrix.allowed-to-fail }} - - env: - SYMFONY_REQUIRE: ${{matrix.symfony-require}} - - strategy: - matrix: - include: - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 7.0.* - variant: symfony/symfony:"7.0.*" - remove-audit-bundle: true - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - coverage: pcov - tools: composer:v2, flex - - - name: Add PHPUnit matcher - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: Remove AuditBundle - if: matrix.remove-audit-bundle - run: composer remove sonata-project/entity-audit-bundle --dev --no-update - - - name: Install variant - if: matrix.variant != 'normal' && !startsWith(matrix.variant, 'symfony/symfony') - run: composer require ${{ matrix.variant }} --no-update - - - name: Install Composer dependencies (${{ matrix.dependencies }}) - uses: ramsey/composer-install@v2 - with: - dependency-versions: ${{ matrix.dependencies }} - - - name: Run Tests with coverage - run: make coverage - - - name: Send coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: build/logs/clover.xml From a55e98f064697b11a6dab8d526c6b0dcde31b3b3 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 18:43:44 +0100 Subject: [PATCH 6/7] Rector --- src/Exporter/DataSource.php | 2 +- src/Filter/ModelFilter.php | 2 +- src/Util/SmartPaginatorFactory.php | 2 +- tests/Filter/CallbackFilterTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Exporter/DataSource.php b/src/Exporter/DataSource.php index ec47b7233..aed35b745 100644 --- a/src/Exporter/DataSource.php +++ b/src/Exporter/DataSource.php @@ -95,7 +95,7 @@ private function findFieldName(ProxyQueryInterface $query, string $alias): ?stri $joinAlias = $joinPart->getAlias(); if ($joinAlias === $alias) { - $joinParts = explode('.', $join); + $joinParts = explode('.', (string) $join); return end($joinParts); } diff --git a/src/Filter/ModelFilter.php b/src/Filter/ModelFilter.php index c7bed61af..68d811df5 100644 --- a/src/Filter/ModelFilter.php +++ b/src/Filter/ModelFilter.php @@ -126,7 +126,7 @@ private function getParentAlias(ProxyQueryInterface $query, string $alias): stri if (isset($joins[$rootAlias])) { foreach ($joins[$rootAlias] as $join) { if ($join->getAlias() === $alias) { - $parts = explode('.', $join->getJoin()); + $parts = explode('.', (string) $join->getJoin()); $parentAlias = $parts[0]; break; diff --git a/src/Util/SmartPaginatorFactory.php b/src/Util/SmartPaginatorFactory.php index 6c29bcf09..bb3f6ecd3 100644 --- a/src/Util/SmartPaginatorFactory.php +++ b/src/Util/SmartPaginatorFactory.php @@ -158,7 +158,7 @@ private static function hasOrderByWithToManyAssociation(ProxyQueryInterface $pro foreach ($orderByParts as $orderByPart) { foreach ($orderByPart->getParts() as $part) { foreach ($joinAliases as $joinAlias) { - if (str_starts_with($part, $joinAlias.'.')) { + if (str_starts_with((string) $part, $joinAlias.'.')) { return true; } } diff --git a/tests/Filter/CallbackFilterTest.php b/tests/Filter/CallbackFilterTest.php index 8d57ba7b2..bf8b5182d 100644 --- a/tests/Filter/CallbackFilterTest.php +++ b/tests/Filter/CallbackFilterTest.php @@ -58,7 +58,7 @@ public function testFilterMethod(): void $filter = new CallbackFilter(); $filter->initialize('field_name', [ - 'callback' => [$this, 'customCallback'], + 'callback' => $this->customCallback(...), ]); $filter->filter($proxyQuery, 'alias', 'field', FilterData::fromArray(['value' => 'myValue'])); From 1f68177380ec41f614c96f1c4be76a37418e4332 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 18:23:08 +0000 Subject: [PATCH 7/7] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index 295ccef6c..254341a3b 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; @@ -42,6 +43,7 @@ $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, ReadOnlyPropertyRector::class, + NullToStrictStringFuncCallArgRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, ]);