Chris@12
|
1 # Contribute to Doctrine
|
Chris@12
|
2
|
Chris@12
|
3 Thank you for contributing to Doctrine!
|
Chris@12
|
4
|
Chris@12
|
5 Before we can merge your Pull-Request here are some guidelines that you need to follow.
|
Chris@12
|
6 These guidelines exist not to annoy you, but to keep the code base clean,
|
Chris@12
|
7 unified and future proof.
|
Chris@12
|
8
|
Chris@12
|
9 ## We only accept PRs to "master"
|
Chris@12
|
10
|
Chris@12
|
11 Our branching strategy is "everything to master first", even
|
Chris@12
|
12 bugfixes and we then merge them into the stable branches. You should only
|
Chris@12
|
13 open pull requests against the master branch. Otherwise we cannot accept the PR.
|
Chris@12
|
14
|
Chris@12
|
15 There is one exception to the rule, when we merged a bug into some stable branches
|
Chris@12
|
16 we do occasionally accept pull requests that merge the same bug fix into earlier
|
Chris@12
|
17 branches.
|
Chris@12
|
18
|
Chris@12
|
19 ## Coding Standard
|
Chris@12
|
20
|
Chris@12
|
21 We use [doctrine coding standard](https://github.com/doctrine/coding-standard) which is PSR-1 and PSR-2:
|
Chris@12
|
22
|
Chris@12
|
23 * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
|
Chris@12
|
24 * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
|
Chris@12
|
25
|
Chris@12
|
26 with some exceptions/differences:
|
Chris@12
|
27
|
Chris@12
|
28 * Keep the nesting of control structures per method as small as possible
|
Chris@12
|
29 * Align equals (=) signs
|
Chris@12
|
30 * Add spaces between assignment, control and return statements
|
Chris@12
|
31 * Prefer early exit over nesting conditions
|
Chris@12
|
32 * Add spaces around a negation if condition ``if ( ! $cond)``
|
Chris@12
|
33 * Add legal information at the beginning of each source file
|
Chris@12
|
34 * Add ``@author`` [phpDoc](https://www.phpdoc.org/docs/latest/references/phpdoc/tags/author.html) comment at DockBlock of class/interface/trait that you create.
|
Chris@12
|
35
|
Chris@12
|
36 ## Unit-Tests
|
Chris@12
|
37
|
Chris@12
|
38 Please try to add a test for your pull-request.
|
Chris@12
|
39
|
Chris@12
|
40 * If you want to contribute new functionality add unit- or functional tests
|
Chris@12
|
41 depending on the scope of the feature.
|
Chris@12
|
42
|
Chris@12
|
43 You can run the unit-tests by calling ``vendor/bin/phpunit`` from the root of the project.
|
Chris@12
|
44 It will run all the project tests.
|
Chris@12
|
45
|
Chris@12
|
46 In order to do that, you will need a fresh copy of doctrine/collections, and you
|
Chris@12
|
47 will have to run a composer installation in the project:
|
Chris@12
|
48
|
Chris@12
|
49 ```sh
|
Chris@12
|
50 git clone git@github.com:doctrine/collections.git
|
Chris@12
|
51 cd collections
|
Chris@12
|
52 curl -sS https://getcomposer.org/installer | php --
|
Chris@12
|
53 ./composer.phar install
|
Chris@12
|
54 ```
|
Chris@12
|
55
|
Chris@12
|
56 ## Travis
|
Chris@12
|
57
|
Chris@12
|
58 We automatically run your pull request through [Travis CI](https://www.travis-ci.org)
|
Chris@12
|
59 against supported PHP versions. If you break the tests, we cannot merge your code,
|
Chris@12
|
60 so please make sure that your code is working before opening up a Pull-Request.
|
Chris@12
|
61
|
Chris@12
|
62 ## Getting merged
|
Chris@12
|
63
|
Chris@12
|
64 Please allow us time to review your pull requests. We will give our best to review
|
Chris@12
|
65 everything as fast as possible, but cannot always live up to our own expectations.
|
Chris@12
|
66
|
Chris@12
|
67 Thank you very much again for your contribution!
|