Skip to content

Commit 2bc3225

Browse files
[All] Add doctrine persistence 4 (#174)
This pull request updates the codebase to support PHP 8.4 and modernizes dependencies and configuration files for improved compatibility and maintainability. The most significant changes include updating CI workflows and test matrices for PHP 8.4, raising minimum versions for key dependencies (including PHPUnit, PHPStan, Rector, and Psalm), and refactoring PHPUnit configuration files to align with PHPUnit 10 standards. Additionally, the Symfony Stimulus bundle is now included, and several code annotations and overrides have been added for better clarity and static analysis support. **Platform and Dependency Upgrades** * CI workflows (`.github/workflows/ci.yaml`, `monorepo.yaml`, `qa.yaml`, `split_ci.yaml`) now test against PHP 8.4, updating all relevant matrices and job definitions. [[1]](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL14-R32) [[2]](diffhunk://#diff-c807f1f07915bfe6b561350c38134836c4aae8288a6ee205aec569d75e7e085cL15-R15) [[3]](diffhunk://#diff-6cda67a2225baf6fd03fab6c06f989f6ed05461024b036dbf7eea8e11fc95da3L14-R14) [[4]](diffhunk://#diff-c255c954d67add37f0fe00bf40275e61b446cf28527c99016229c31537aed7a0L17-R17) [[5]](diffhunk://#diff-c255c954d67add37f0fe00bf40275e61b446cf28527c99016229c31537aed7a0L36-R36) * Composer dependencies in `composer.json`, `packages/basic-page-bundle/composer.json`, and `packages/ckeditor-sonata-media-bundle/composer.json` are updated to require newer versions, including PHPUnit 10, PHPStan 2.x, Rector 2.x, Psalm 6.x, and Symfony Stimulus Bundle. [[1]](diffhunk://#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34L17-R19) [[2]](diffhunk://#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34L59-R80) [[3]](diffhunk://#diff-3241b904b4180f03c366cfa9ea34506d1d809e675c15465c86323cfa708de4d8L25-R25) [[4]](diffhunk://#diff-3241b904b4180f03c366cfa9ea34506d1d809e675c15465c86323cfa708de4d8L47-R57) [[5]](diffhunk://#diff-bddaf4a4056c2af8c1430016f875c17ab339991fef9985cda597f9fd88034839L36-R46) **Testing and Static Analysis Improvements** * PHPUnit configuration files (`phpunit.xml.dist` in both bundles) are refactored for PHPUnit 10, including schema updates, cache directory settings, removal of deprecated listeners, and migration from `<coverage>` to `<source>`. [[1]](diffhunk://#diff-d6a8c5108cf1c3f3e2fccbe9a7d2f9985d8f0cd3c4afb1e69b68adc8fe24397fL6-L39) [[2]](diffhunk://#diff-0477cb7bafd9b0e20e3f472dbd3d278cedf555c866379a9d5225636893d7f802L6-L39) * Development dependencies in `monorepo-builder.php` are updated to match the new minimum versions for static analysis and testing tools. **Symfony and Bundle Enhancements** * The Symfony Stimulus bundle is now included in both production and test environments (`composer.json`, `Kernel.php`), supporting modern frontend integration. [[1]](diffhunk://#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34L59-R80) [[2]](diffhunk://#diff-3241b904b4180f03c366cfa9ea34506d1d809e675c15465c86323cfa708de4d8L47-R57) [[3]](diffhunk://#diff-e1942184052ea6a037d0862107c9183b48b78da5743df5cd0b8691a7ce4d3f0aR36) [[4]](diffhunk://#diff-e1942184052ea6a037d0862107c9183b48b78da5743df5cd0b8691a7ce4d3f0aR58-R78) **Code Quality and Annotation Updates** * Added `@api` annotations to key entity classes and `#[\Override]` attributes to overridden methods for improved static analysis and documentation. [[1]](diffhunk://#diff-2aa398dd56e69e0a5d49490b8d9c218ef769c3020dc4d2091b510d047b009bbdR24-R26) [[2]](diffhunk://#diff-67a04b170ba555970cc7e28952c8f496aa92025aac59e941e65761b2a4de053eR23-R25) [[3]](diffhunk://#diff-b2d670f86e93dbbc4bd8c0a4794a0e4d81bb3e5b9d0f2b520b9f10172890a159R21) [[4]](diffhunk://#diff-49277f5d5184d863f419106dd66f845ae60bce9d2a60e5e2e253aa0ccdb99209R34-R50) [[5]](diffhunk://#diff-d695325593b9abf5de4edf68cfbc86a60f00f93f3f9ad814365e8188f385356dR29) [[6]](diffhunk://#diff-df733786eb79b5b7b27301cdc1cffc9883880e9c991c9a0ff69ff20eb964be24R37) * Minor code quality improvements, such as suppressing Psalm warnings and updating entity methods for better testability. [[1]](diffhunk://#diff-debc95e230ea9fbca72a94b8363cf0c7e72aa2fecbc9f2209222df894c32c88bR20-R22) [[2]](diffhunk://#diff-debc95e230ea9fbca72a94b8363cf0c7e72aa2fecbc9f2209222df894c32c88bR31-R37) [[3]](diffhunk://#diff-bd41bcbda81bc0d4b77992c220c0efe08e0ee30ab44ac37c5c35aa482278ff1eR27) **Coding Standards** * Updated `.php-cs-fixer.dist.php` to refine ignored PHPDoc tags and remove obsolete rules for better code style enforcement. ## Checklist Ensure your pull request meets the following requirements: - [x] Tests have been added or updated. - [x] Documentation has been updated (if applicable). - [x] I have applied neccessary labels to this PR. - [x] I have tested this change locally and on staging. - [x] At a functional level, it has been validated with the team/PO.
2 parents f538c6b + 42e2743 commit 2bc3225

File tree

172 files changed

+651
-386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+651
-386
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: ['8.1', '8.2', '8.3']
14+
php: ['8.1', '8.2', '8.3', '8.4']
1515
dependencies: [highest]
1616
symfony-require: [highest]
1717
include:
1818
- php: '8.1'
1919
dependencies: lowest
2020
symfony-require: highest
21-
- php: '8.3'
21+
- php: '8.4'
2222
dependencies: highest
2323
symfony-require: 6.4.*
24-
- php: '8.3'
24+
- php: '8.4'
2525
dependencies: highest
2626
symfony-require: 7.1.*
27+
- php: '8.4'
28+
dependencies: highest
29+
symfony-require: 7.2.*
30+
- php: '8.4'
31+
dependencies: highest
32+
symfony-require: 7.3.*
2733
env:
2834
SYMFONY_REQUIRE: ${{ matrix.symfony-require }}
2935
steps:

.github/workflows/monorepo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php: ['8.3']
15+
php: ['8.4']
1616
package:
1717
- { folder: basic-page-bundle, repository: RunroomBasicPageBundle }
1818
- { folder: ckeditor-sonata-media-bundle, repository: RunroomCkeditorSonataMediaBundle }

.github/workflows/qa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: ['8.3']
14+
php: ['8.4']
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: shivammathur/setup-php@v2

.github/workflows/split_ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
php: ['8.3']
17+
php: ['8.4']
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: shivammathur/setup-php@v2
@@ -33,7 +33,7 @@ jobs:
3333
needs: provide_packages_json
3434
strategy:
3535
matrix:
36-
php: ['8.3']
36+
php: ['8.4']
3737
packages: ${{ fromJson(needs.provide_packages_json.outputs.matrix ) }}
3838
dependencies: [lowest, highest]
3939
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ phpunit.xml
55
.php-cs-fixer.php
66
.php-cs-fixer.cache
77
.phpunit.result.cache
8+
.phpunit.cache
89
/node_modules
910
yarn.lock
1011
coverage

.php-cs-fixer.dist.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747
['ORM\\*'],
4848
]],
4949
'php_unit_strict' => true,
50-
'php_unit_test_case_static_method_calls' => true,
51-
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var', 'phpstan-ignore-next-line', 'todo', 'return']],
50+
'phpdoc_to_comment' => ['ignored_tags' => ['var', 'psalm-suppress', 'phpstan-var', 'phpstan-ignore-next-line', 'todo', 'return']],
5251
'single_line_empty_body' => true,
5352
'single_line_throw' => false,
5453
'static_lambda' => true,

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"doctrine/dbal": "^3.6 || ^4.0",
1515
"doctrine/doctrine-bundle": "^2.10",
1616
"doctrine/orm": "^2.19 || ^3.2",
17-
"doctrine/persistence": "^3.1",
17+
"doctrine/persistence": "^3.1 || ^4.0",
1818
"gedmo/doctrine-extensions": "^3.11",
19-
"phpunit/phpunit": "^9.6",
19+
"phpunit/phpunit": "^10.5",
2020
"psr/container": "^1.1 || ^2.0",
2121
"sonata-project/admin-bundle": "^4.25",
2222
"sonata-project/doctrine-extensions": "^2.0",
@@ -56,28 +56,28 @@
5656
"friendsofsymfony/ckeditor-bundle": "^2.3",
5757
"imagine/imagine": "^1.3",
5858
"knplabs/knp-menu-bundle": "^3.1",
59-
"matthiasnoback/symfony-config-test": "^5.1",
60-
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
61-
"phpstan/phpstan": "^1.10",
62-
"phpstan/phpstan-doctrine": "^1.0",
63-
"phpstan/phpstan-phpunit": "^1.0",
64-
"phpstan/phpstan-strict-rules": "^1.0",
65-
"phpstan/phpstan-symfony": "^1.0",
59+
"matthiasnoback/symfony-config-test": "^6.1",
60+
"matthiasnoback/symfony-dependency-injection-test": "^6.1",
61+
"phpstan/phpstan": "^2.1",
62+
"phpstan/phpstan-doctrine": "^2.0",
63+
"phpstan/phpstan-phpunit": "^2.0",
64+
"phpstan/phpstan-strict-rules": "^2.0",
65+
"phpstan/phpstan-symfony": "^2.0",
6666
"psalm/plugin-phpunit": "^0.19",
6767
"psalm/plugin-symfony": "^5.0",
6868
"psr/event-dispatcher": "^1.0",
69-
"rector/rector": "^1.0",
69+
"rector/rector": "^2.1",
7070
"sonata-project/block-bundle": "^5.0",
7171
"sonata-project/doctrine-orm-admin-bundle": "^4.13",
7272
"sonata-project/form-extensions": "^2.0",
7373
"sonata-project/twig-extensions": "^2.0",
7474
"symfony/browser-kit": "^6.4 || ^7.1",
7575
"symfony/mailer": "^6.4 || ^7.1",
7676
"symfony/mime": "^6.4 || ^7.1",
77-
"symfony/phpunit-bridge": "^7.1",
77+
"symfony/stimulus-bundle": "^2.30",
7878
"symfonycasts/reset-password-bundle": "^1.10",
7979
"symplify/monorepo-builder": "^11.0 <11.1",
80-
"vimeo/psalm": "^5.14",
80+
"vimeo/psalm": "^6.13",
8181
"weirdan/doctrine-psalm-plugin": "^2.6",
8282
"zenstruck/foundry": "^2.0"
8383
},

monorepo-builder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
ComposerJsonSection::REQUIRE_DEV => [
3333
'ergebnis/composer-normalize' => '^2.6',
3434
'friendsofphp/php-cs-fixer' => '^3.14',
35-
'phpstan/phpstan' => '^1.10',
36-
'phpstan/phpstan-doctrine' => '^1.0',
37-
'phpstan/phpstan-phpunit' => '^1.0',
38-
'phpstan/phpstan-symfony' => '^1.0',
39-
'phpstan/phpstan-strict-rules' => '^1.0',
35+
'phpstan/phpstan' => '^2.1',
36+
'phpstan/phpstan-doctrine' => '^2.0',
37+
'phpstan/phpstan-phpunit' => '^2.0',
38+
'phpstan/phpstan-symfony' => '^2.0',
39+
'phpstan/phpstan-strict-rules' => '^2.0',
4040
'psalm/plugin-phpunit' => '^0.19',
4141
'psalm/plugin-symfony' => '^5.0',
42-
'rector/rector' => '^1.0',
42+
'rector/rector' => '^2.1',
4343
'symplify/monorepo-builder' => '^11.0 <11.1',
44-
'vimeo/psalm' => '^5.14',
44+
'vimeo/psalm' => '^6.13',
4545
'weirdan/doctrine-psalm-plugin' => '^2.6',
4646
],
4747
]);

packages/basic-page-bundle/composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"doctrine/dbal": "^3.6 || ^4.0",
2323
"doctrine/doctrine-bundle": "^2.10",
2424
"doctrine/orm": "^2.19 || ^3.2",
25-
"doctrine/persistence": "^3.1",
25+
"doctrine/persistence": "^3.1 || ^4.0",
2626
"gedmo/doctrine-extensions": "^3.11",
2727
"psr/container": "^1.1 || ^2.0",
2828
"runroom-packages/doctrine-translatable-bundle": "^0.21",
@@ -44,17 +44,17 @@
4444
"dama/doctrine-test-bundle": "^8.0",
4545
"friendsofsymfony/ckeditor-bundle": "^2.3",
4646
"knplabs/knp-menu-bundle": "^3.1",
47-
"matthiasnoback/symfony-config-test": "^5.1",
48-
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
49-
"phpunit/phpunit": "^9.6",
47+
"matthiasnoback/symfony-config-test": "^6.1",
48+
"matthiasnoback/symfony-dependency-injection-test": "^6.1",
49+
"phpunit/phpunit": "^10.5",
5050
"runroom-packages/testing": "^0.21",
5151
"sonata-project/admin-bundle": "^4.25",
5252
"sonata-project/doctrine-orm-admin-bundle": "^4.13",
5353
"sonata-project/media-bundle": "^4.9",
5454
"symfony/browser-kit": "^6.4 || ^7.1",
55-
"symfony/phpunit-bridge": "^7.1",
5655
"symfony/routing": "^6.4 || ^7.1",
5756
"symfony/security-bundle": "^6.4 || ^7.1",
57+
"symfony/stimulus-bundle": "^2.30",
5858
"symfony/twig-bundle": "^6.4 || ^7.1",
5959
"zenstruck/foundry": "^2.0"
6060
},

packages/basic-page-bundle/phpunit.xml.dist

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,33 @@
33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
117
processIsolation="false"
128
stopOnFailure="false"
139
bootstrap="tests/bootstrap.php"
14-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
10+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
11+
cacheDirectory=".phpunit.cache"
12+
backupStaticProperties="false"
1513
>
1614
<testsuite name="RunroomBasicPageBundle">
1715
<directory>tests</directory>
1816
</testsuite>
1917

20-
<listeners>
21-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
22-
</listeners>
23-
2418
<extensions>
25-
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
19+
<bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
2620
</extensions>
2721

28-
<coverage>
22+
<source>
2923
<include>
3024
<directory suffix=".php">src</directory>
3125
</include>
32-
</coverage>
26+
</source>
3327

3428
<php>
3529
<ini name="precision" value="8"/>
3630
<server name="APP_ENV" value="test" force="true" />
3731
<server name="APP_DEBUG" value="false" />
3832
<server name="SHELL_VERBOSITY" value="-1"/>
39-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
4033
<env name="KERNEL_CLASS" value="Runroom\BasicPageBundle\Tests\App\Kernel"/>
4134
</php>
4235
</phpunit>

0 commit comments

Comments
 (0)