Skip to content

Commit 2d100cc

Browse files
Merge pull request #1 from andanteproject/symfony8-update
add symgony 8 to composer json and ci
2 parents f973121 + 46e3e77 commit 2d100cc

6 files changed

Lines changed: 26 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
php-version: ['8.1', '8.4', '8.5']
15-
symfony-version: ['5.4.*', '6.4.*', '7.0.*']
15+
symfony-version: ['5.4.*', '6.4.*', '7.0.*', '8.0.*']
1616
doctrine-orm-version: ['2.20.*', '3.0.*']
1717
exclude:
1818
# Symfony 5.4 is not compatible with PHP 8.3
@@ -26,6 +26,9 @@ jobs:
2626
symfony-version: '7.0.*'
2727
- php-version: '8.2'
2828
symfony-version: '7.0.*'
29+
# Symfony 8.0 requires PHP 8.2+
30+
- php-version: '8.1'
31+
symfony-version: '8.0.*'
2932
# Doctrine 3.0 requires PHP 8.4 or higher
3033
- php-version: '8.1'
3134
doctrine-orm-version: '3.0.*'
@@ -40,26 +43,26 @@ jobs:
4043
with:
4144
php-version: ${{ matrix.php-version }}
4245
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, sqlite3
43-
coverage: ${{ matrix.php-version == '8.5' && matrix.symfony-version == '7.0.*' && matrix.doctrine-orm-version == '3.0.*' && 'pcov' || 'none' }}
46+
coverage: ${{ matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' && 'pcov' || 'none' }}
4447

4548
- name: Install Composer dependencies
4649
uses: ramsey/composer-install@v3
4750
with:
4851
composer-options: "--prefer-dist --no-progress --no-interaction --optimize-autoloader"
4952

5053
- name: Run PHP-CS-Fixer
51-
if: matrix.php-version == '8.5' && matrix.symfony-version == '7.0.*'
54+
if: matrix.php-version == '8.1'
5255
run: vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --using-cache=no
5356

5457
- name: Run PHPStan
55-
if: matrix.php-version == '8.5' && matrix.symfony-version == '7.0.*'
58+
if: matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*'
5659
run: vendor/bin/phpstan analyse src tests --configuration=phpstan-8.5-plus.neon --memory-limit=1G
5760

5861
- name: Run PHPUnit tests
59-
run: vendor/bin/phpunit ${{ matrix.php-version == '8.5' && matrix.symfony-version == '7.0.*' && matrix.doctrine-orm-version == '3.0.*' && '--coverage-clover coverage.xml' || '' }}
62+
run: vendor/bin/phpunit ${{ matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*' && '--coverage-clover coverage.xml' || '' }}
6063

6164
- name: Upload coverage to Codecov
62-
if: matrix.php-version == '8.5' && matrix.symfony-version == '7.0.*' && matrix.doctrine-orm-version == '3.0.*'
65+
if: matrix.php-version == '8.5' && (matrix.symfony-version == '7.0.*' || matrix.symfony-version == '8.0.*') && matrix.doctrine-orm-version == '3.0.*'
6366
uses: codecov/codecov-action@v4
6467
with:
6568
files: ./coverage.xml

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'phpdoc_to_comment' => false,
2020
'phpdoc_var_without_name' => false,
2121
'@Symfony' => true,
22+
'no_useless_else' => false,
2223
];
2324

2425
$config = new PhpCsFixer\Config();

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Latest Version](https://img.shields.io/github/release/andanteproject/nullable-embeddable-bundle.svg)](https://github.com/andanteproject/nullable-embeddable-bundle/releases)
55
![Github actions](https://github.com/andanteproject/nullable-embeddable-bundle/actions/workflows/ci.yml/badge.svg?branch=main)
66
[![codecov](https://codecov.io/gh/andanteproject/nullable-embeddable-bundle/branch/main/graph/badge.svg)](https://codecov.io/gh/andanteproject/nullable-embeddable-bundle)
7-
![Framework](https://img.shields.io/badge/Symfony-5.x|6.x|7.x-informational?Style=flat&logo=symfony)
7+
![Framework](https://img.shields.io/badge/Symfony-5.x|6.x|7.x|8.x-informational?style=flat&logo=symfony)
88
![Php8](https://img.shields.io/badge/PHP-8.1|8.5%2B-informational?style=flat&logo=php)
99
![PhpStan](https://img.shields.io/badge/PHPStan-Level%209-success?style=flat&logo=php)
1010

@@ -47,7 +47,7 @@ class Country
4747
```
4848

4949
## Requirements
50-
* Symfony 5.x-7.x
50+
* Symfony 5.x–8.x
5151
* PHP 8.1+ (PHP 8.5+ for anonymous function processors)
5252
* [Doctrine ORM](https://www.doctrine-project.org/projects/doctrine-orm/en/3.5/tutorials/embeddables.html)
5353

@@ -265,7 +265,7 @@ The `PropertyAccessor` provided to your processor (or anonymous function) is a s
265265

266266
The `analyze` method of your processor must return one of two values from the `Result` enum:
267267

268-
* `Result::SHOULD_BE_NULL`: Indicates that the embeddable object should be treated as null. Note that "should" is used because the parent entity might have the embeddable class defined as not nullable. There is no guarantee the parent class accepts `null` as a value; this depends on database consistency and the user's data model.
268+
* `Result::SHOULD_BE_NULL`: Indicates that the embeddable object should be treated as null. Note that "should" is used because the parent entity might have the embeddable class defined as not nullable. There is no guarantee the parent entity accepts `null` as a value; this depends on database consistency and the user's data model.
269269
* `Result::KEEP_INITIALIZED`: Indicates that the embeddable object should remain initialized.
270270

271271
## PHPStan Extension
@@ -287,7 +287,7 @@ When Doctrine determines that an entire embeddable object should be null (which
287287
) {}
288288
```
289289

290-
2. **Nullable Columns**: All properties mapped to database columns must be nullable. This can be achieved either by using a PHP nullable type (`?string`) which Doctrine automatically infers as `nullable: true`, or by explicitly setting `nullable: true` in the `#[Column]` attribute. This is required because when the embeddable object is null, Doctrine will set all its database columns to `NULL`.
290+
2. **Nullable Columns**: All properties mapped to database columns must be nullable. This can be achieved either by using a PHP nullable type (`?string`), which Doctrine automatically infers as `nullable: true`, or by explicitly setting `nullable: true` in the `#[Column]` attribute. This is required because when the embeddable object is null, Doctrine will set all its database columns to `NULL`.
291291

292292
3. **Nested Embeddables with Defaults**: Embedded objects that have explicit non-null default values must be typed as nullable. Uninitialized embedded properties are fine since they remain uninitialized when the parent is null.
293293

@@ -338,7 +338,7 @@ class Address
338338
#[ORM\Column(type: Types::STRING, nullable: true)]
339339
private string $city;
340340

341-
// CORRECT: Uninitialized embedded property (will remain uninitialized when parent is null)
341+
// CORRECT: Uninitialized embedded property (will remain uninitialized when the parent is null)
342342
#[ORM\Embedded(class: Country::class)]
343343
private Country $country;
344344

composer.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
],
2222
"require": {
2323
"php": "^8.1",
24-
"symfony/config": "^5.0 || ^6.0 || ^7.0",
25-
"symfony/http-kernel": "^5.0 || ^6.0 || ^7.0",
26-
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0",
27-
"symfony/property-access": "^5.0 || ^6.0 || ^7.0",
24+
"symfony/config": "^5.0 || ^6.0 || ^7.0 || ^8.0",
25+
"symfony/http-kernel": "^5.0 || ^6.0 || ^7.0 || ^8.0",
26+
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0 || ^8.0",
27+
"symfony/property-access": "^5.0 || ^6.0 || ^7.0 || ^8.0",
2828
"doctrine/orm": "^2.0 | ^3.0"
2929
},
3030
"autoload": {
@@ -39,16 +39,17 @@
3939
},
4040
"require-dev": {
4141
"phpunit/phpunit": "^9.5",
42-
"symfony/cache": "^5.0 || ^6.0 || ^7.0",
42+
"symfony/cache": "^5.0 || ^6.0 || ^7.0 || ^8.0",
4343
"friendsofphp/php-cs-fixer": "^3.0",
4444
"phpstan/phpstan": "^1.0",
4545
"phpstan/phpstan-doctrine": "^1.0",
4646
"phpstan/phpstan-symfony": "^1.0",
4747
"phpstan/phpstan-webmozart-assert": "^1.0",
4848
"phpstan/extension-installer": "^1.0",
49-
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0",
49+
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0 || ^8.0",
5050
"doctrine/doctrine-bundle": "^2.0",
51-
"symfony/test-pack": "^1.0"
51+
"symfony/test-pack": "^1.0",
52+
"symfony/var-exporter": "^6.4 || ^7"
5253
},
5354
"config": {
5455
"allow-plugins": {

phpstan-8.5-plus.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ parameters:
1111
- phpstan-stubs
1212
- tests/Fixtures/ValidClosureProcessorEntity
1313
excludePaths:
14+
- src/DependencyInjection/Configuration.php
1415
- tests/PHPStan
16+
- tests/Fixtures/ValidClosureProcessorEntity
1517
- tests/Functional/PHPStanRulesIssuesTests/Fixtures

phpstan-lt-8.5.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ parameters:
1010
- tests
1111
- phpstan-stubs
1212
excludePaths:
13+
- src/DependencyInjection/Configuration.php
1314
- tests/Fixtures/ValidClosureProcessorEntity
1415
- tests/PHPStan
15-
- tests/Functional/PHPStanRulesIssuesTests/Fixtures

0 commit comments

Comments
 (0)