Skip to content

Commit

Permalink
Start using PHP CS Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Aug 22, 2019
1 parent c757fa5 commit 22ba3c8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ clover.xml

# Ignore IDE's configuration files
.idea

# Ignore PHP CS Fixer cache
.php_cs.cache
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ before_install:
STRIPE_MOCK_PID=$!
- export PATH="${PATH}:${PWD}/stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}"

script: ./build.php ${AUTOLOAD}
script:
- ./build.php ${AUTOLOAD}
- ./vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no .

after_script: ./vendor/bin/coveralls -v
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"felixfbecker.php-intellisense",
"ikappas.phpcs",
"emallin.phpunit",
"EditorConfig.editorconfig"
"EditorConfig.editorconfig",
"sophisticode.php-formatter"
]
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

// Formatting
"editor.formatOnSave": true,
"phpformatter.composer": true,
"phpformatter.arguments": [""],

// Linting
"phpcs.enable": true,
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ Update bundled CA certificates from the [Mozilla cURL release][curl]:
./update_certs.php
```

The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:

```bash
./vendor/bin/php-cs-fixer fix -v .
```

## Attention plugin developers

Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:
Expand All @@ -256,6 +262,7 @@ See the "SSL / TLS compatibility issues" paragraph above for full context. If yo
[composer]: https://getcomposer.org/
[connect]: https://stripe.com/connect
[curl]: http://curl.haxx.se/docs/caextract.html
[psr3]: http://www.php-fig.org/psr/psr-3/
[idempotency-keys]: https://stripe.com/docs/api/php#idempotent_requests
[php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[psr3]: http://www.php-fig.org/psr/psr-3/
[stripe-mock]: https://github.com/stripe/stripe-mock
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"phpunit/phpunit": "^5.7",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4"
"symfony/process": "~3.4",
"friendsofphp/php-cs-fixer": "^2.15"
},
"autoload": {
"psr-4": { "Stripe\\" : "lib/" }
Expand Down

0 comments on commit 22ba3c8

Please sign in to comment.