Skip to content

Commit 26cfe16

Browse files
authored
Merge pull request #2748 from teohhanhui/merge-2.4
Merge 2.4 into master
2 parents bc0806b + 433ce07 commit 26cfe16

30 files changed

+714
-422
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
First of all, thank you for contributing, you're awesome!
44

5-
To have your code integrated in the API Platform project, there is some rules to follow, but don't panic, it's easy!
5+
To have your code integrated in the API Platform project, there are some rules to follow, but don't panic, it's easy!
66

77
## Reporting Bugs
88

99
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
1010

1111
* Check the [project documentation available online](https://api-platform.com/docs/)
1212

13-
Then, if it appears that it's a real bug, you may report it using Github by following these 3 points:
13+
Then, if it appears that it's a real bug, you may report it using GitHub by following these 3 points:
1414

1515
* Check if the bug is not already reported!
1616
* A clear title to resume the issue
1717
* A description of the workflow needed to reproduce the bug
1818

19-
> _NOTE:_ Dont hesitate giving as much information as you can (OS, PHP version extensions...)
19+
> _NOTE:_ Don't hesitate giving as much information as you can (OS, PHP version extensions...)
2020
21-
### Security issues
21+
### Security Issues
2222

2323
If you find a security issue, send a mail to Kévin Dunglas <[email protected]>. **Please do not report security problems
2424
publicly**. We will disclose details of the issue and credit you after having released a new version including a fix.
2525

26-
## Pull requests
26+
## Pull Requests
2727

2828
### Writing a Pull Request
2929

@@ -33,14 +33,14 @@ See [the dedicated documentation entry](https://api-platform.com/docs/extra/rele
3333
### Matching Coding Standards
3434

3535
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
36-
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool
36+
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool:
3737

38-
```bash
38+
```shell
3939
php-cs-fixer.phar fix
4040
```
4141

42-
And then, add fixed file to your commit before push.
43-
Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit.
42+
And then, add the fixed file to your commit before pushing.
43+
Be sure to add only **your modified files**. If any other file is fixed by cs tools, just revert it before committing.
4444

4545
### Sending a Pull Request
4646

@@ -52,7 +52,7 @@ When you send a PR, just make sure that:
5252
* You make the PR on the same branch you based your changes on. If you see commits
5353
that you did not make in your PR, you're doing it wrong.
5454
* Also don't forget to add a comment when you update a PR with a ping to [the maintainers](https://github.com/orgs/api-platform/people), so he/she will get a notification.
55-
* Squash your commits into one commit. (see the next chapter)
55+
* Squash your commits into one commit (see the next chapter).
5656

5757
All Pull Requests must include [this header](.github/PULL_REQUEST_TEMPLATE.md).
5858

@@ -62,23 +62,23 @@ On `api-platform/core` there are two kinds of tests: unit (`phpunit`) and integr
6262

6363
Both `phpunit` and `behat` are development dependencies and should be available in the `vendor` directory.
6464

65-
#### Phpunit and Coverage Generation
65+
#### PHPUnit and Coverage Generation
6666

6767
To launch unit tests:
6868

69-
```
69+
```shell
7070
vendor/bin/phpunit --stop-on-failure -vvv
7171
```
7272

7373
If you want coverage, you will need the `phpdbg` package and run:
7474

75-
```
75+
```shell
7676
phpdbg -qrr vendor/bin/phpunit --coverage-html coverage -vvv --stop-on-failure
7777
```
7878

7979
Sometimes there might be an error with too many open files when generating coverage. To fix this, you can increase the `ulimit`, for example:
8080

81-
```
81+
```shell
8282
ulimit -n 4000
8383
```
8484

@@ -88,15 +88,21 @@ Coverage will be available in `coverage/index.html`.
8888

8989
The command to launch Behat tests is:
9090

91-
```
91+
```shell
9292
./vendor/bin/behat --suite=default --stop-on-failure -vvv
9393
```
9494

95+
If you want to launch Behat tests for MongoDB, the command is:
96+
97+
```shell
98+
APP_ENV=mongodb ./vendor/bin/behat --suite=mongodb --stop-on-failure -vvv
99+
```
100+
95101
## Squash your Commits
96102

97-
If you have 3 commits. So start with:
103+
If you have 3 commits, start with:
98104

99-
```bash
105+
```shell
100106
git rebase -i HEAD~3
101107
```
102108

@@ -106,18 +112,18 @@ Replace all `pick` prefixes by `fixup` (or `f`) **except the first commit** of t
106112

107113
Save and quit the editor.
108114

109-
After that, all your commits where squashed into the first one and the commit message of the first commit.
115+
After that, all your commits will be squashed into the first one and the commit message will be the first one.
110116

111-
If you would like to rename your commit message type:
117+
If you would like to rename your commit message, type:
112118

113-
```bash
119+
```shell
114120
git commit --amend
115121
```
116122

117123
Now force push to update your PR:
118124

119-
```bash
120-
git push --force
125+
```shell
126+
git push --force-with-lease
121127
```
122128

123129
# License and Copyright Attribution

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
"symfony/messenger": "^4.2",
7575
"symfony/phpunit-bridge": "^3.4.5 || ^4.0.5",
7676
"symfony/routing": "^3.4 || ^4.0",
77-
"symfony/security": "^3.4 || ^4.0",
7877
"symfony/security-bundle": "^3.4 || ^4.0",
78+
"symfony/security-core": "^3.4 || ^4.0",
7979
"symfony/twig-bundle": "^3.4 || ^4.0",
8080
"symfony/validator": "^3.4 || ^4.0",
8181
"symfony/web-profiler-bundle": "^4.2",

features/graphql/input_output.feature

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Feature: GraphQL DTO input and output
2-
In order to use a hypermedia API
2+
In order to use the GraphQL API
33
As a client software developer
44
I need to be able to use DTOs on my resources as Input or Output objects.
55

66
@createSchema
7-
Scenario: Retrieve an Output with GraphQl
7+
Scenario: Retrieve an Output with GraphQL
88
When I add "Content-Type" header equal to "application/ld+json"
99
And I send a "POST" request to "/dummy_dto_input_outputs" with body:
1010
"""
@@ -162,8 +162,7 @@ Feature: GraphQL DTO input and output
162162
}
163163
"""
164164

165-
@!mongodb
166-
Scenario: Use messenger with graphql and an input where the handler gives a synchronous result
165+
Scenario: Use messenger with GraphQL and an input where the handler gives a synchronous result
167166
When I send the following GraphQL request:
168167
"""
169168
mutation {

features/jsonld/input_output.feature

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Feature: JSON-LD DTO input and output
9292
"ipsum": "1"
9393
}
9494
"""
95-
Then the response status code should be 201
95+
Then the response status code should be 204
9696
And the response should be empty
9797

9898
@createSchema
@@ -187,15 +187,50 @@ Feature: JSON-LD DTO input and output
187187

188188
@createSchema
189189
Scenario: Create a resource with no input
190-
When I send a "POST" request to "/dummy_dto_no_inputs" with body:
190+
When I send a "POST" request to "/dummy_dto_no_inputs"
191+
Then the response status code should be 201
192+
And the response should be in JSON
193+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
194+
And the JSON should be equal to:
191195
"""
192196
{
193-
"foo": "test",
194-
"bar": 1
197+
"@context": {
198+
"@vocab": "http://example.com/docs.jsonld#",
199+
"hydra": "http://www.w3.org/ns/hydra/core#",
200+
"id": "OutputDto/id",
201+
"baz": "OutputDto/baz",
202+
"bat": "OutputDto/bat"
203+
},
204+
"@type": "DummyDtoNoInput",
205+
"@id": "/dummy_dto_no_inputs/1",
206+
"id": 1,
207+
"baz": 1,
208+
"bat": "test"
209+
}
210+
"""
211+
212+
Scenario: Update a resource with no input
213+
When I send a "POST" request to "/dummy_dto_no_inputs/1/double_bat"
214+
Then the response status code should be 200
215+
And the response should be in JSON
216+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
217+
And the JSON should be equal to:
218+
"""
219+
{
220+
"@context": {
221+
"@vocab": "http://example.com/docs.jsonld#",
222+
"hydra": "http://www.w3.org/ns/hydra/core#",
223+
"id": "OutputDto/id",
224+
"baz": "OutputDto/baz",
225+
"bat": "OutputDto/bat"
226+
},
227+
"@type": "DummyDtoNoInput",
228+
"@id": "/dummy_dto_no_inputs/1",
229+
"id": 1,
230+
"baz": 1,
231+
"bat": "testtest"
195232
}
196233
"""
197-
Then the response status code should be 201
198-
And the response should be empty
199234

200235
@!mongodb
201236
Scenario: Use messenger with an input where the handler gives a synchronous result

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ parameters:
6767
-
6868
message: '#Method ApiPlatform\\Core\\Bridge\\Doctrine\\Orm\\Util\\QueryBuilderHelper::mapJoinAliases() should return array<string, array<string>\|string> but returns array<int|string, mixed>\.#'
6969
path: %currentWorkingDirectory%/src/Bridge/Doctrine/Orm/Util/QueryBuilderHelper.php
70+
-
71+
message: "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component.+' and 'addRemovedBindingIds?' will always evaluate to false\\.#"
72+
path: %currentWorkingDirectory%/tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php
7073
- "#Call to method PHPUnit\\\\Framework\\\\Assert::assertSame\\(\\) with array\\('(collection_context|item_context|subresource_context)'\\) and array<Symfony\\\\Component\\\\VarDumper\\\\Cloner\\\\Data>\\|bool\\|float\\|int\\|string\\|null will always evaluate to false\\.#"
7174
# https://github.com/doctrine/doctrine2/pull/7298/files
7275
- '#Strict comparison using === between null and int will always evaluate to false\.#'

src/Api/IdentifiersExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
4242
$this->resourceClassResolver = $resourceClassResolver;
4343

4444
if (null === $this->resourceClassResolver) {
45-
@trigger_error(sprintf('Not injecting %s in the CachedIdentifiersExtractor might introduce cache issues with object identifiers.', ResourceClassResolverInterface::class), E_USER_DEPRECATED);
45+
@trigger_error(sprintf('Not injecting %s in the IdentifiersExtractor might introduce cache issues with object identifiers.', ResourceClassResolverInterface::class), E_USER_DEPRECATED);
4646
}
4747
}
4848

0 commit comments

Comments
 (0)