annotate vendor/zendframework/zend-stdlib/CONTRIBUTING.md @ 2:92f882872392

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