Skip to content

Commit bd3ed98

Browse files
committed
Merge 4.2
2 parents b728f87 + 0e899fa commit bd3ed98

File tree

95 files changed

+2451
-328
lines changed

Some content is hidden

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

95 files changed

+2451
-328
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
composer global require soyuka/pmu
4949
composer global config allow-plugins.soyuka/pmu true --no-interaction
5050
composer global link .
51+
composer require --dev doctrine/mongodb-odm-bundle
5152
- run: composer check-dependencies
5253

5354
php-cs-fixer:
@@ -89,7 +90,7 @@ jobs:
8990
uses: shivammathur/setup-php@v2
9091
with:
9192
php-version: ${{ matrix.php }}
92-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
93+
extensions: intl, bcmath, curl, openssl, mbstring
9394
ini-values: memory_limit=-1
9495
tools: composer
9596
coverage: none
@@ -149,6 +150,7 @@ jobs:
149150
composer global require soyuka/pmu
150151
composer global config allow-plugins.soyuka/pmu true --no-interaction
151152
composer global link .
153+
composer require --dev doctrine/mongodb-odm-bundle
152154
- name: Cache PHPStan results
153155
uses: actions/cache@v4
154156
with:
@@ -202,7 +204,7 @@ jobs:
202204
with:
203205
php-version: ${{ matrix.php }}
204206
tools: pecl, composer
205-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
207+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
206208
coverage: pcov
207209
ini-values: memory_limit=-1
208210
- name: Get composer cache directory
@@ -219,6 +221,9 @@ jobs:
219221
composer global require soyuka/pmu
220222
composer global config allow-plugins.soyuka/pmu true --no-interaction
221223
composer global link .
224+
- name: Force PHPUnit 11.5 for PHP 8.2
225+
if: matrix.php == '8.2'
226+
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
222227
- name: Clear test app cache
223228
run: tests/Fixtures/app/console cache:clear --ansi
224229
- name: Run PHPUnit tests
@@ -291,12 +296,17 @@ jobs:
291296
with:
292297
php-version: ${{ matrix.php.version }}
293298
tools: pecl, composer
294-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
299+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
295300
ini-values: memory_limit=-1
296301
- name: PMU
297302
run: |
298303
composer global require soyuka/pmu
299304
composer global config allow-plugins.soyuka/pmu true --no-interaction
305+
- name: Force PHPUnit 11.5 for PHP 8.2
306+
if: matrix.php.version == '8.2'
307+
run: |
308+
cd $(composer ${{matrix.component}} --cwd)
309+
composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
300310
- name: Linking
301311
if: ${{ !matrix.php.lowest && !matrix.php.minimal-changes }}
302312
run: |
@@ -371,7 +381,7 @@ jobs:
371381
with:
372382
php-version: ${{ matrix.php.version }}
373383
tools: pecl, composer
374-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
384+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
375385
ini-values: memory_limit=-1
376386
- name: Linking
377387
run: |
@@ -413,7 +423,7 @@ jobs:
413423
with:
414424
php-version: ${{ matrix.php }}
415425
tools: pecl, composer
416-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
426+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
417427
coverage: pcov
418428
ini-values: memory_limit=-1
419429
- name: Get composer cache directory
@@ -430,6 +440,9 @@ jobs:
430440
composer global require soyuka/pmu
431441
composer global config allow-plugins.soyuka/pmu true --no-interaction
432442
composer global link .
443+
- name: Force PHPUnit 11.5 for PHP 8.2
444+
if: matrix.php == '8.2'
445+
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
433446
- name: Clear test app cache
434447
run: tests/Fixtures/app/console cache:clear --ansi
435448
- name: Run Behat tests (PHP ${{ matrix.php }})
@@ -497,7 +510,7 @@ jobs:
497510
with:
498511
php-version: ${{ matrix.php }}
499512
tools: pecl, composer
500-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_pgsql, mongodb
513+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_pgsql
501514
coverage: none
502515
ini-values: memory_limit=-1
503516
- name: Get composer cache directory
@@ -548,7 +561,7 @@ jobs:
548561
with:
549562
php-version: ${{ matrix.php }}
550563
tools: pecl, composer
551-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_mysql, mongodb
564+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_mysql
552565
coverage: none
553566
ini-values: memory_limit=-1
554567
- name: Get composer cache directory
@@ -830,7 +843,7 @@ jobs:
830843
with:
831844
php-version: ${{ matrix.php }}
832845
tools: pecl, composer
833-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
846+
extensions: intl, bcmath, curl, openssl, mbstring
834847
coverage: none
835848
ini-values: memory_limit=-1
836849
- name: Get composer cache directory
@@ -883,7 +896,7 @@ jobs:
883896
with:
884897
php-version: ${{ matrix.php }}
885898
tools: pecl, composer
886-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
899+
extensions: intl, bcmath, curl, openssl, mbstring
887900
coverage: none
888901
ini-values: memory_limit=-1
889902
- name: Get composer cache directory
@@ -923,7 +936,7 @@ jobs:
923936
with:
924937
php-version: ${{ matrix.php }}
925938
tools: pecl, composer
926-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
939+
extensions: intl, bcmath, curl, openssl, mbstring
927940
coverage: none
928941
ini-values: memory_limit=-1
929942
- name: Get composer cache directory
@@ -962,7 +975,7 @@ jobs:
962975
with:
963976
php-version: ${{ matrix.php }}
964977
tools: pecl, composer
965-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
978+
extensions: intl, bcmath, curl, openssl, mbstring
966979
coverage: none
967980
ini-values: memory_limit=-1
968981
- name: Get composer cache directory
@@ -1005,7 +1018,7 @@ jobs:
10051018
with:
10061019
php-version: ${{ matrix.php }}
10071020
tools: pecl, composer
1008-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
1021+
extensions: intl, bcmath, curl, openssl, mbstring
10091022
coverage: none
10101023
ini-values: memory_limit=-1
10111024
- name: Install additional packages
@@ -1053,7 +1066,7 @@ jobs:
10531066
with:
10541067
php-version: ${{ matrix.php }}
10551068
tools: pecl, composer
1056-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo, mongodb
1069+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo
10571070
coverage: none
10581071
ini-values: memory_limit=-1
10591072
- name: Get composer cache directory
@@ -1103,7 +1116,7 @@ jobs:
11031116
with:
11041117
php-version: ${{ matrix.php }}
11051118
tools: pecl, composer
1106-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
1119+
extensions: intl, bcmath, curl, openssl, mbstring
11071120
coverage: none
11081121
ini-values: memory_limit=-1
11091122
- name: Get composer cache directory
@@ -1147,7 +1160,7 @@ jobs:
11471160
with:
11481161
php-version: ${{ matrix.php }}
11491162
tools: pecl, composer
1150-
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
1163+
extensions: intl, bcmath, curl, openssl, mbstring
11511164
coverage: none
11521165
ini-values: memory_limit=-1
11531166
- name: Install additional packages
@@ -1319,7 +1332,7 @@ jobs:
13191332
with:
13201333
php-version: ${{ matrix.php }}
13211334
tools: pecl, composer
1322-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
1335+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
13231336
ini-values: memory_limit=-1
13241337
- name: Setup node
13251338
uses: actions/setup-node@v4
@@ -1376,8 +1389,12 @@ jobs:
13761389
with:
13771390
php-version: ${{ matrix.php }}
13781391
tools: pecl, composer
1379-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
1392+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
13801393
ini-values: memory_limit=-1
1394+
- name: Force PHPUnit 11.5 for PHP 8.2
1395+
if: matrix.php == '8.2'
1396+
working-directory: 'src/Laravel'
1397+
run: composer require phpunit/phpunit:^11.5 --dev --with-all-dependencies
13811398
- name: Update project dependencies
13821399
run: |
13831400
composer global require soyuka/pmu
@@ -1402,7 +1419,7 @@ jobs:
14021419
with:
14031420
php-version: 8.5
14041421
tools: pecl, composer
1405-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
1422+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite
14061423
ini-values: memory_limit=-1
14071424
- name: Update project dependencies
14081425
run: |

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@
77
* [21aa2572d](https://github.com/api-platform/core/commit/21aa2572d8fef2b3f05f7307c51348a6c9767e45) feat(elasticsearch): add SSL options for Elasticsearch configuration (#4059)
88
* [ba0c76c](https://github.com/api-platform/core/commit/ba0c76c6f5c8afa8622e87a155b8b99f453d6453) feat(doctrine): remove put & path for readonly entity (#7019)
99

10+
## v4.2.11
11+
12+
### Bug fixes
13+
14+
* [0d9a44bef](https://github.com/api-platform/core/commit/0d9a44bef81db4db3656b3d83a9fdaa36a229579) fix(laravel): allow custom error handler for non-api operations (#7622)
15+
* [17415f789](https://github.com/api-platform/core/commit/17415f789e5aba9d833d12b74c0bf64fb8f64b07) fix(serializer): allow CsvEncoder::AS_COLLECTION_KEY in context (#7613)
16+
* [2a3449818](https://github.com/api-platform/core/commit/2a3449818a542a33e82800a3a1c3e83396e3510c) fix(symfony): check that required package are installed before configuring services (#7607)
17+
* [40ad56859](https://github.com/api-platform/core/commit/40ad5685960bfc0bd3dede7860f0a1eda31a3c5b) fix(jsonld): allow mapping collection output with itemUriTemplate (#7620)
18+
* [9f11aed8a](https://github.com/api-platform/core/commit/9f11aed8a44ac52b51b6f9c40f7000968d12823a) fix(state): delete with stateOptions and object mapper (#7615)
19+
* [a2da50905](https://github.com/api-platform/core/commit/a2da509059f5f63ad9c9dd3adce68ce74b543651) fix(symfony): enable ReDoc when Swagger UI is disabled (#7617)
20+
* [c0998928e](https://github.com/api-platform/core/commit/c0998928e651dcbffbf765cc7028badea15a3830) fix(symfony): enable to set default values for `stale-while-revalidate` and `stale-if-error` cache headers via config file (#7606)
21+
* [d847ad629](https://github.com/api-platform/core/commit/d847ad62918d561333ecb8ecb0e246b3c48b3758) fix(jsonapi): handle missing attributes in ErrorNormalizer (#7569)
22+
23+
## v4.2.10
24+
25+
### Bug fixes
26+
27+
* [01fd0b578](https://github.com/api-platform/core/commit/01fd0b578d68f590670caf92b9a02a854a019311) fix(symfony): do not redeclare object_mapper (#7602)
28+
* [0ef0ba63a](https://github.com/api-platform/core/commit/0ef0ba63a41af000836dd5631b43bcdf10c50c71) fix(metadata): update tests to use MappedObjectPaginator instead of ArrayPaginator (#7591)
29+
* [6561eb1ec](https://github.com/api-platform/core/commit/6561eb1ec96c296021baa3e36e04843412632c8f) fix(symfony): do not load docs routes if docs disabled (#7448)
30+
* [8f4bc086f](https://github.com/api-platform/core/commit/8f4bc086fcc811c69a67e29c313b12160c6efa45) fix(symfony): disable Swagger UI and ReDoc when Swagger is off (#7586)
31+
* [9814f27ee](https://github.com/api-platform/core/commit/9814f27ee4bc11d03dd9cc9ca5c0caa53061ae44) fix(metadata): property placeholder on multiple parameters (#7598)
32+
* [bc1fd4c10](https://github.com/api-platform/core/commit/bc1fd4c10c04fcd552e7b385efc08a1be0826614) fix(laravel): belongs-to-many relations dont have a get-foreign-key-name method (#7589)
33+
* [d3bcded9b](https://github.com/api-platform/core/commit/d3bcded9baf5ddc2e52d8ea2d894f328e9dd4a8e) fix(metadata): use operation output class for mapping instead of operation class (#7601)
34+
* [d7bab4bb3](https://github.com/api-platform/core/commit/d7bab4bb36af636ee11fc2c875dbb1ce687a50d1) fix(serializer): properly handle read link parameters when generating iris (#7520)
35+
1036
## v4.2.9
1137

1238
### Bug fixes

CRUSH.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# API Platform Core Development
2+
3+
This document provides guidelines for developing on the API Platform core.
4+
5+
## Laravel development:
6+
7+
Everything goes inside `src/Laravel`.
8+
Tests need to run at `src/Laravel/vendor/bin/phpunit`.
9+
10+
## Development Commands
11+
12+
- **Run all tests:**
13+
```bash
14+
vendor/bin/phpunit
15+
```
16+
17+
- **Run a single test file:**
18+
```bash
19+
vendor/bin/phpunit tests/Path/To/YourTest.php
20+
```
21+
22+
- **Lint files:**
23+
```bash
24+
vendor/bin/php-cs-fixer fix --dry-run --diff
25+
```
26+
27+
- **Fix linting issues:**
28+
```bash
29+
vendor/bin/php-cs-fixer fix
30+
```
31+
32+
- **Run static analysis:**
33+
```bash
34+
vendor/bin/phpstan analyse
35+
```
36+
37+
## Code Style
38+
39+
- **Standard:** Follow PSR-12 and the rules in `.php-cs-fixer.dist.php`.
40+
- **Imports:** Use `use` statements for all classes, and group them by namespace.
41+
- **Naming:**
42+
- Classes: `PascalCase`
43+
- Methods: `camelCase`
44+
- Variables: `camelCase`
45+
- **Types:** Use strict types (`declare(strict_types=1);`) in all PHP files. Use type hints for all arguments and return types where possible.
46+
- **Error Handling:** Use exceptions for error handling.
47+

Caddyfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# To run this make sure you have php zts installed
2+
# In the `php.ini` set output_buffering = Off (or else you may not get the same measures)
3+
# Run `php-fpm -F` (it should default to 127.0.0.1:9000)
4+
# Run `frankenphp start --config Caddyfile` (do not use `run` or printing in the terminal will slow down the server)
5+
# You now have 2 servers:
6+
# - localhost:8080 with PHP FPM
7+
# - localhost:8081 with FrankenPHP
8+
#
9+
# Note that with no worker mode the performances on HTTP Request (sequentially !) will be likely the same.
10+
{
11+
frankenphp
12+
}
13+
14+
localhost:8080 {
15+
header {
16+
Access-Control-Allow-Origin *
17+
Access-Control-Allow-Credentials true
18+
Access-Control-Allow-Methods *
19+
Access-Control-Allow-Headers *
20+
defer
21+
}
22+
root * public/
23+
php_fastcgi 127.0.0.1:9000
24+
file_server
25+
}
26+
27+
localhost:8081 {
28+
header {
29+
Access-Control-Allow-Origin *
30+
Access-Control-Allow-Credentials true
31+
Access-Control-Allow-Methods *
32+
Access-Control-Allow-Headers *
33+
defer
34+
}
35+
root * public/
36+
file_server
37+
log
38+
php_server
39+
}

GEMINI.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
You are a code assistant that only writes tests on the API Platform code base. You do not need to fix bugs only write the test we ask for. You do not need to run the test.
2+
3+
Language is PHP, project is API Platform. User will always specify either Symfony or Laravel as tests are not in the same directories.
4+
5+
IMPORTANT: avoid changing existing fixtures as they may alter current tests behavior. If a fixture already exist just invent new names, we don't really care about business logic here we only do tests for a framework.
6+
7+
# API Platform Core Development
8+
9+
This document provides guidelines for developing on the API Platform core.
10+
11+
## Laravel development:
12+
13+
Everything goes inside `src/Laravel`.
14+
Tests need to run at `src/Laravel/vendor/bin/phpunit`.
15+
Fixtures are located at `src/Laravel/workbench/app/` you can either write a DTO as ApiResource inside the `ApiResource` directory in the workbench, or add an Eloquent `Model` that gets declared as a resource with the correct attribute.
16+
17+
You'll add only functional testing inside `src/Laravel/Tests/`, we recommend to inspire from @src/Laravel/Tests/EloquentTest.php or @src/Laravel/Tests/JsonLdTest.php.
18+
19+
## Symfony development:
20+
21+
Fixtures are located at `tests/Fixtures/TestBundle/ApiResource/`
22+
Entities at `tests/Fixtures/TestBundle/Entity/` and they almost always see their equivalent in `tests/Fixtures/TestBundle/Document/`
23+
Functional tests at `tests/Functional`, unit tests are in more specific directories of each component inside `src/Component/Tests`.
24+
25+
## Development Commands
26+
27+
You can not run command only the user can. Don't attempt to run phpunit or else.
28+
29+
## Code Style
30+
31+
- **Standard:** Follow PSR-12 and the rules in `.php-cs-fixer.dist.php`.
32+
- **Imports:** Use `use` statements for all classes, and group them by namespace.
33+
- **Naming:**
34+
- Classes: `PascalCase`
35+
- Methods: `camelCase`
36+
- Variables: `camelCase`
37+
- **Types:** Use strict types (`declare(strict_types=1);`) in all PHP files. Use type hints for all arguments and return types where possible.
38+
- **Error Handling:** Use exceptions for error handling.

0 commit comments

Comments
 (0)