|
| 1 | +# CONTRIBUTING |
| 2 | + |
| 3 | +## RESOURCES |
| 4 | + |
| 5 | +If you wish to contribute to Zend Framework, please be sure to |
| 6 | +read/subscribe to the following resources: |
| 7 | + |
| 8 | + - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) |
| 9 | + - [Contributor's Guide](CONTRIBUTING.md) |
| 10 | + - ZF Contributor's mailing list: |
| 11 | + Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html |
| 12 | + |
| 13 | + - ZF Contributor's IRC channel: |
| 14 | + #zftalk.dev on Freenode.net |
| 15 | + |
| 16 | +If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-expressive-zendviewrenderer/issues/new). |
| 17 | + |
| 18 | +## Reporting Potential Security Issues |
| 19 | + |
| 20 | +If you have encountered a potential security vulnerability, please **DO NOT** report it on the public |
| 21 | +issue tracker: send it to us at [[email protected]](mailto:[email protected]) instead. |
| 22 | +We will work with you to verify the vulnerability and patch it as soon as possible. |
| 23 | + |
| 24 | +When reporting issues, please provide the following information: |
| 25 | + |
| 26 | +- Component(s) affected |
| 27 | +- A description indicating how to reproduce the issue |
| 28 | +- A summary of the security vulnerability and impact |
| 29 | + |
| 30 | +We request that you contact us via the email address above and give the project |
| 31 | +contributors a chance to resolve the vulnerability and issue a new release prior |
| 32 | +to any public exposure; this helps protect users and provides them with a chance |
| 33 | +to upgrade and/or update in order to protect their applications. |
| 34 | + |
| 35 | +For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). |
| 36 | + |
| 37 | +## RUNNING TESTS |
| 38 | + |
| 39 | +To run tests: |
| 40 | + |
| 41 | +- Clone the repository: |
| 42 | + |
| 43 | + ```console |
| 44 | + $ git clone [email protected]:zendframework/zend-expressive-zendviewrenderer.git |
| 45 | + $ cd zend-expressive-zendviewrenderer |
| 46 | + ``` |
| 47 | + |
| 48 | +- Install dependencies via composer: |
| 49 | + |
| 50 | + ```console |
| 51 | + $ curl -sS https://getcomposer.org/installer | php -- |
| 52 | + $ ./composer.phar install |
| 53 | + ``` |
| 54 | + |
| 55 | + If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ |
| 56 | + |
| 57 | +- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: |
| 58 | + |
| 59 | + ```console |
| 60 | + $ ./vendor/bin/phpunit |
| 61 | + ``` |
| 62 | + |
| 63 | +You can turn on conditional tests with the phpunit.xml file. |
| 64 | +To do so: |
| 65 | + |
| 66 | + - Copy `phpunit.xml.dist` file to `phpunit.xml` |
| 67 | + - Edit `phpunit.xml` to enable any specific functionality you |
| 68 | + want to test, as well as to provide test values to utilize. |
| 69 | + |
| 70 | +## Running Coding Standards Checks |
| 71 | + |
| 72 | +This component uses [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for coding |
| 73 | +standards checks, and provides configuration for our selected checks. |
| 74 | +`phpcs` is installed by default via Composer. |
| 75 | + |
| 76 | +To run checks only: |
| 77 | + |
| 78 | +```console |
| 79 | +$ ./vendor/bin/phpcs |
| 80 | +``` |
| 81 | + |
| 82 | +`phpcs` also includes a tool for fixing most CS violations, `phpcbf`: |
| 83 | + |
| 84 | + |
| 85 | +```console |
| 86 | +$ ./vendor/bin/phpcbf |
| 87 | +``` |
| 88 | + |
| 89 | +If you allow `phpcbf` to fix CS issues, please re-run the tests to ensure |
| 90 | +they pass, and make sure you add and commit the changes after verification. |
| 91 | + |
| 92 | +## Recommended Workflow for Contributions |
| 93 | + |
| 94 | +Your first step is to establish a public repository from which we can |
| 95 | +pull your work into the master repository. We recommend using |
| 96 | +[GitHub](https://github.com), as that is where the component is already hosted. |
| 97 | + |
| 98 | +1. Setup a [GitHub account](http://github.com/), if you haven't yet |
| 99 | +2. Fork the repository (http://github.com/zendframework/zend-expressive-zendviewrenderer) |
| 100 | +3. Clone the canonical repository locally and enter it. |
| 101 | + |
| 102 | + ```console |
| 103 | + $ git clone git://github.com:zendframework/zend-expressive-zendviewrenderer.git |
| 104 | + $ cd zend-expressive-zendviewrenderer |
| 105 | + ``` |
| 106 | + |
| 107 | +4. Add a remote to your fork; substitute your GitHub username in the command |
| 108 | + below. |
| 109 | + |
| 110 | + ```console |
| 111 | + $ git remote add {username} [email protected]:{username}/zend-expressive-zendviewrenderer.git |
| 112 | + $ git fetch {username} |
| 113 | + ``` |
| 114 | + |
| 115 | +### Keeping Up-to-Date |
| 116 | + |
| 117 | +Periodically, you should update your fork or personal repository to |
| 118 | +match the canonical ZF repository. Assuming you have setup your local repository |
| 119 | +per the instructions above, you can do the following: |
| 120 | + |
| 121 | + |
| 122 | +```console |
| 123 | +$ git checkout master |
| 124 | +$ git fetch origin |
| 125 | +$ git rebase origin/master |
| 126 | +# OPTIONALLY, to keep your remote up-to-date - |
| 127 | +$ git push {username} master:master |
| 128 | +``` |
| 129 | + |
| 130 | +If you're tracking other branches -- for example, the "develop" branch, where |
| 131 | +new feature development occurs -- you'll want to do the same operations for that |
| 132 | +branch; simply substitute "develop" for "master". |
| 133 | + |
| 134 | +### Working on a patch |
| 135 | + |
| 136 | +We recommend you do each new feature or bugfix in a new branch. This simplifies |
| 137 | +the task of code review as well as the task of merging your changes into the |
| 138 | +canonical repository. |
| 139 | + |
| 140 | +A typical workflow will then consist of the following: |
| 141 | + |
| 142 | +1. Create a new local branch based off either your master or develop branch. |
| 143 | +2. Switch to your new local branch. (This step can be combined with the |
| 144 | + previous step with the use of `git checkout -b`.) |
| 145 | +3. Do some work, commit, repeat as necessary. |
| 146 | +4. Push the local branch to your remote repository. |
| 147 | +5. Send a pull request. |
| 148 | + |
| 149 | +The mechanics of this process are actually quite trivial. Below, we will |
| 150 | +create a branch for fixing an issue in the tracker. |
| 151 | + |
| 152 | +```console |
| 153 | +$ git checkout -b hotfix/9295 |
| 154 | +Switched to a new branch 'hotfix/9295' |
| 155 | +``` |
| 156 | + |
| 157 | +... do some work ... |
| 158 | + |
| 159 | + |
| 160 | +```console |
| 161 | +$ git commit |
| 162 | +``` |
| 163 | + |
| 164 | +... write your log message ... |
| 165 | + |
| 166 | + |
| 167 | +```console |
| 168 | +$ git push {username} hotfix/9295:hotfix/9295 |
| 169 | +Counting objects: 38, done. |
| 170 | +Delta compression using up to 2 threads. |
| 171 | +Compression objects: 100% (18/18), done. |
| 172 | +Writing objects: 100% (20/20), 8.19KiB, done. |
| 173 | +Total 20 (delta 12), reused 0 (delta 0) |
| 174 | +To ssh://[email protected]/{username}/zend-expressive-zendviewrenderer.git |
| 175 | + b5583aa..4f51698 HEAD -> master |
| 176 | +``` |
| 177 | + |
| 178 | +To send a pull request, you have two options. |
| 179 | + |
| 180 | +If using GitHub, you can do the pull request from there. Navigate to |
| 181 | +your repository, select the branch you just created, and then select the |
| 182 | +"Pull Request" button in the upper right. Select the user/organization |
| 183 | +"zendframework" as the recipient. |
| 184 | + |
| 185 | +If using your own repository - or even if using GitHub - you can use `git |
| 186 | +format-patch` to create a patchset for us to apply; in fact, this is |
| 187 | +**recommended** for security-related patches. If you use `format-patch`, please |
| 188 | +send the patches as attachments to: |
| 189 | + |
| 190 | +- [email protected] for patches without security implications |
| 191 | +- [email protected] for security patches |
| 192 | + |
| 193 | +#### What branch to issue the pull request against? |
| 194 | + |
| 195 | +Which branch should you issue a pull request against? |
| 196 | + |
| 197 | +- For fixes against the stable release, issue the pull request against the |
| 198 | + "master" branch. |
| 199 | +- For new features, or fixes that introduce new elements to the public API (such |
| 200 | + as new public methods or properties), issue the pull request against the |
| 201 | + "develop" branch. |
| 202 | + |
| 203 | +### Branch Cleanup |
| 204 | + |
| 205 | +As you might imagine, if you are a frequent contributor, you'll start to |
| 206 | +get a ton of branches both locally and on your remote. |
| 207 | + |
| 208 | +Once you know that your changes have been accepted to the master |
| 209 | +repository, we suggest doing some cleanup of these branches. |
| 210 | + |
| 211 | +- Local branch cleanup |
| 212 | + |
| 213 | + ```console |
| 214 | + $ git branch -d <branchname> |
| 215 | + ``` |
| 216 | + |
| 217 | +- Remote branch removal |
| 218 | + |
| 219 | + ```console |
| 220 | + $ git push {username} :<branchname> |
| 221 | + ``` |
0 commit comments