|
| 1 | +# Contributing to php-cypher-dsl |
| 2 | + |
| 3 | +Welcome! We look forward to your contributions. This document outlines the guidelines for contributing to php-cypher-dsl. Keep in mind that these guidelines are mostly just suggestions, and shouldn't hold you back from improving php-cypher-dsl. Don't be afraid to ignore them. |
| 4 | + |
| 5 | +Below are some examples on how you can contribute: |
| 6 | + |
| 7 | +* [Report a bug](https://github.com/neo4j-php/php-cypher-dsl/issues/new?template=bug_report.md) |
| 8 | +* [Propose a new feature](https://github.com/neo4j-php/php-cypher-dsl/issues/new?template=missing_feature_request.md) |
| 9 | +* [Send a pull request](https://github.com/neo4j-php/php-cypher-dsl/pulls) |
| 10 | + |
| 11 | +## Code of conduct |
| 12 | + |
| 13 | +This project has a [Contributor Code of Conduct](https://github.com/neo4j-php/php-cypher-dsl/blob/main/CODE_OF_CONDUCT.md). By contributing to or participating in this project, you agree to abide to its terms. |
| 14 | + |
| 15 | +## Any contributions will be licensed under the GPL 2.0 or any later version |
| 16 | + |
| 17 | +When submitting code or changes, your submissions will automatically be licensed under the [GNU General Public License](https://github.com/neo4j-php/php-cypher-dsl/blob/main/LICENSE) version 2.0 or later. By contributing to this project, you agree that your contributions will be licensed under its terms. |
| 18 | + |
| 19 | +## Writing bug reports |
| 20 | + |
| 21 | +In your bug report, you should provide the following: |
| 22 | + |
| 23 | +* A short summary of the bug |
| 24 | +* What you expect would happen |
| 25 | +* What actually happens |
| 26 | +* Steps to reproduce |
| 27 | + * Be specific! Give sample code if possible. |
| 28 | + * Include the version of PHP and php-cypher-dsl. |
| 29 | + |
| 30 | +You should only report bugs for versions of php-cypher-dsl that [are supported](https://github.com/neo4j-php/php-cypher-dsl/blob/main/LIFECYCLE.md). Please only report bugs if you are using a php-cypher-dsl with a [compatible version of PHP](https://github.com/neo4j-php/php-cypher-dsl/blob/main/LIFECYCLE.md). |
| 31 | + |
| 32 | +## Proposing new features |
| 33 | + |
| 34 | +Feel free to propose a new feature by [opening an issue for it](https://github.com/neo4j-php/php-cypher-dsl/issues/new?template=missing_feature_request.md). |
| 35 | + |
| 36 | +## Workflow for pull requests |
| 37 | + |
| 38 | +1. Fork the repository. |
| 39 | +1. Create a new branch. |
| 40 | + 1. If you are **implementing new functionality**, create your branch from `development`. |
| 41 | + 1. If you are **fixing a bug**, create your branch from the oldest [supported](https://github.com/neo4j-php/php-cypher-dsl/blob/main/LIFECYCLE.md) branch that is affected by the bug. |
| 42 | +1. Implement your change and add tests for it. |
| 43 | +1. Make sure the test suite passes. |
| 44 | +1. Make sure that the code complies with the coding guidelines (see below). |
| 45 | +1. Submit your pull request! |
| 46 | + |
| 47 | +Some things to keep in mind: |
| 48 | + |
| 49 | +* Make sure that you have [configured a user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. |
| 50 | +* Keep backwards compatibility breaks to a minimum. |
| 51 | +* You are encouraged to [sign your commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) with GPG. |
| 52 | + |
| 53 | +## Branching model |
| 54 | + |
| 55 | +The branching model used by this project is [gitflow](https://nvie.com/posts/a-successful-git-branching-model/), with the following changes/additions: |
| 56 | + |
| 57 | +1. Feature branches must follow the naming convention `feature/*`. |
| 58 | +1. The name of a feature branch should reflect the feature added (e.g. `feature/support-indexing-operator` instead of `feature/feature-1`). |
| 59 | +1. Release branches must follow the naming convention `release/x.y`, where `x` and `y` are the major and minor version of the release respectively. A release branch should never be made for a patch. |
| 60 | +1. Hotfix branches must follow the naming convention `hotfix/x.y.z`, where `x`, `y` and `z` are the major, minor and patch version of the hot respectively. |
| 61 | +1. Hotfix branches must branch off from the oldest [supported](https://github.com/neo4j-php/php-cypher-dsl/blob/main/LIFECYCLE.md) branch that is affected by the bug. |
| 62 | +1. Right before a new **major** version is released, a *support* branch is created from `main`. |
| 63 | +1. Support branches must follow the naming convention `support/x.y`, where `x` and `y` are the major and minor version of the most recent release respectively. |
| 64 | + |
| 65 | +## Coding guidelines |
| 66 | + |
| 67 | +This project comes with a [configuration file](https://github.com/neo4j-php/php-cypher-dsl/blob/main/.php-cs-fixer.dist.php) for `php-cs-fixer` that you can use to format your code: |
| 68 | + |
| 69 | +``` |
| 70 | +$ php vendor/bin/php-cs-fixer fix --config .php-cs-fixer.dist.php |
| 71 | +``` |
| 72 | + |
| 73 | +This project uses PHPStan for static analysis: |
| 74 | + |
| 75 | +``` |
| 76 | +$ php vendor/bin/phpstan |
| 77 | +``` |
| 78 | + |
| 79 | +After making your changes and adding your tests, you can check whether the minimum coverage and minimum mutation score indicator requirements are still met: |
| 80 | + |
| 81 | +``` |
| 82 | +$ XDEBUG_MODE=coverage php vendor/bin/phpunit --testsuite unit |
| 83 | +$ php vendor/bin/coverage-check coverage/clover.xml 90 |
| 84 | +$ XDEBUG_MODE=coverage php vendor/bin/infection --min-msi=80 |
| 85 | +``` |
| 86 | + |
| 87 | +## Running test suites |
| 88 | + |
| 89 | +To run all tests, use: |
| 90 | + |
| 91 | +``` |
| 92 | +$ php vendor/bin/phpunit --no-coverage |
| 93 | +``` |
| 94 | + |
| 95 | +To only run *unit* tests, use: |
| 96 | + |
| 97 | +``` |
| 98 | +$ php vendor/bin/phpunit --testsuite unit --no-coverage |
| 99 | +``` |
| 100 | + |
| 101 | +To only run *end-to-end* tests, use: |
| 102 | + |
| 103 | +``` |
| 104 | +$ php vendor/bin/phpunit --testsuite end-to-end --no-coverage |
| 105 | +``` |
0 commit comments