Skip to content

Commit d4c3a89

Browse files
jasonrhodesrichleland
authored andcommitted
Add php-cs-fixer as composer script and make initial fix-style run
* Add php-cs-fixer as composer script * Make initial fix-style run * Fix indentation on all files * Add editorconfig file
1 parent d96d825 commit d4c3a89

30 files changed

+2100
-1673
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_style = space
16+
indent_size = 2

CONTRIBUTING.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ Follow the instructions at [xdebug.org](http://xdebug.org/wizard.php)
5050

5151
- Provide documentation for any newly added code.
5252
- Provide tests for any newly added code.
53-
- Follow [PSR-1](http://www.php-fig.org/psr/psr-1/)
53+
- Follow [PSR-2](http://www.php-fig.org/psr/psr-2/) (_will be auto-enforced by php-cs-fixer in a later step_)
5454

5555
1. Create a new branch named after the issue you’ll be fixing (include the issue number as the branch name, example: Issue in GH is #8 then the branch name should be ISSUE-8)
56-
2. Write corresponding tests and code (only what is needed to satisfy the issue and tests please)
56+
1. Write corresponding tests and code (only what is needed to satisfy the issue and tests please)
5757
* Include your tests in the 'test' directory in an appropriate test file
5858
* Write code to satisfy the tests
59-
3. Ensure automated tests pass
60-
4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to [AUTHORS](https://github.com/SparkPost/php-sparkpost/blob/master/AUTHORS.md).
59+
1. Ensure automated tests pass
60+
1. Run `composer run-script fix-style` to enforce PSR-2 style
61+
1. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to [AUTHORS](https://github.com/SparkPost/php-sparkpost/blob/master/AUTHORS.md).
6162

6263

6364
### Testing

composer.json

+32-30
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
{
2-
"name": "sparkpost/php-sparkpost",
3-
"description": "Client library for interfacing with the SparkPost API.",
4-
"license": "Apache 2.0",
5-
"authors": [
6-
{
7-
"name": "SparkPost"
8-
}
9-
],
10-
"minimum-stability": "stable",
11-
"scripts": {
12-
"post-install-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi",
13-
"post-update-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi",
14-
"test": "phpunit ./test/unit/"
15-
},
16-
"require": {
17-
"php": ">=5.5.0",
18-
"egeloen/http-adapter": "*"
19-
},
20-
"require-dev": {
21-
"phpunit/phpunit": "4.3.*",
22-
"guzzlehttp/guzzle": "6.*",
23-
"mockery/mockery": "^0.9.4",
24-
"satooshi/php-coveralls": "dev-master"
25-
},
26-
"autoload": {
27-
"psr-4": {
28-
"SparkPost\\": "lib/SparkPost/",
29-
"SparkPost\\SendGridCompatibility\\": "lib/SendGridCompatibility/",
30-
"SparkPost\\Test\\TestUtils\\": "test/unit/TestUtils/"
31-
}
2+
"name": "sparkpost/php-sparkpost",
3+
"description": "Client library for interfacing with the SparkPost API.",
4+
"license": "Apache 2.0",
5+
"authors": [
6+
{
7+
"name": "SparkPost"
328
}
9+
],
10+
"minimum-stability": "stable",
11+
"scripts": {
12+
"post-install-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi",
13+
"post-update-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi",
14+
"test": "phpunit ./test/unit/",
15+
"fix-style": "php-cs-fixer fix ."
16+
},
17+
"require": {
18+
"php": ">=5.5.0",
19+
"egeloen/http-adapter": "*"
20+
},
21+
"require-dev": {
22+
"phpunit/phpunit": "4.3.*",
23+
"guzzlehttp/guzzle": "6.*",
24+
"mockery/mockery": "^0.9.4",
25+
"satooshi/php-coveralls": "dev-master",
26+
"fabpot/php-cs-fixer": "^1.11"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"SparkPost\\": "lib/SparkPost/",
31+
"SparkPost\\SendGridCompatibility\\": "lib/SendGridCompatibility/",
32+
"SparkPost\\Test\\TestUtils\\": "test/unit/TestUtils/"
33+
}
34+
}
3335
}

0 commit comments

Comments
 (0)