Skip to content

Commit 8290527

Browse files
committed
cs fixer integration
1 parent c4cab83 commit 8290527

29 files changed

+816
-137
lines changed

.php_cs.dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$config = new ServiceBus\CodeStyle\Config();
4+
$config->getFinder()
5+
->in(__DIR__ . '/src')
6+
->in(__DIR__ . '/tests');
7+
8+
$cacheDir = '' !== (string) \getenv('TRAVIS') ? (string) \getenv('HOME') . '/.php-cs-fixer' : __DIR__;
9+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
10+
11+
return $config;

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ language: php
33
php:
44
- 7.2
55
- 7.3
6+
- 7.4snapshot
7+
8+
matrix:
9+
allow_failures:
10+
- php: 7.4snapshot
611

712
cache:
813
directories:
914
- $HOME/.cache/composer
15+
- $HOME/.php-cs-fixer
1016

1117
before_script:
1218
- mkdir -p build/logs
@@ -15,10 +21,12 @@ install:
1521
- travis_retry composer install --no-interaction --no-suggest
1622
- travis_retry wget -c -nc --retry-connrefused --tries=0 https://scrutinizer-ci.com/ocular.phar
1723
- chmod +x ocular.phar
24+
- composer show
1825

1926
script:
2027
- ./vendor/bin/phpunit --configuration ./phpunit.xml --coverage-clover=coverage.clover
2128
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then ./vendor/bin/psalm --config=psalm.xml; fi
29+
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run; fi
2230

2331
after_script:
2432
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then wget -c -nc --retry-connrefused --tries=0 https://scrutinizer-ci.com/ocular.phar; fi

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Contributing
2+
Contributions are welcome. We accept pull requests on [GitHub](https://github.com/php-service-bus/service-bus/issues).
3+
4+
## Workflow
5+
If you have an idea for a new feature, it's a good idea to check out our [issues](https://github.com/php-service-bus/service-bus/issues) or active [pull requests](https://github.com/php-service-bus/service-bus/pulls) first to see if the feature is already being worked on. If not, feel free to submit an issue first, asking whether the feature is beneficial to the project. This will save you from doing a lot of development work only to have your feature rejected. We don't enjoy rejecting your hard work, but some features just don't fit with the goals of the project.
6+
7+
When you do begin working on your feature, here are some guidelines to consider:
8+
* Your pull request description should clearly detail the changes you have made.
9+
* Please write tests for any new features you add.
10+
* Please ensure that tests pass before submitting your pull request.
11+
* Use topic/feature branches. Please do not ask us to pull from your master branch.
12+
* Submit one feature per pull request. If you have multiple features you wish to submit, please break them up into separate pull requests.
13+
* Send coherent history. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
14+
15+
## Coding Guidelines
16+
This project comes with a configuration file and an executable for php-cs-fixer (.php_cs.dist) that you can use to (re)format your source code for compliance with this project's coding guidelines:
17+
```bash
18+
composer cs-fix
19+
```
20+
For a simple check of the code standard, there is a command:
21+
```bash
22+
composer cs-check
23+
```
24+
## Static analysis
25+
To improve the quality of the code used static analysis (via `psalm`). You can start it with the command:
26+
```bash
27+
composer psalm
28+
```
29+
## Running the tests
30+
The following tests must pass before we will accept a pull request. If any of these do not pass, it will result in a complete build failure.
31+
```bash
32+
composer tests
33+
```
34+
## Communication Channels
35+
You can find help and discussion in the following places:
36+
* [Telegram chat (RU)](https://t.me/php_service_bus)
37+
* Create issue [https://github.com/php-service-bus/service-bus/issues](https://github.com/php-service-bus/service-bus/issues)
38+
39+
## Security
40+
If you discover any security related issues, please email [`[email protected]`](mailto:[email protected]) instead of using the issue tracker.
41+
42+
## Reporting issues
43+
* [General problems](https://github.com/php-service-bus/service-bus/issues)
44+
* [Documentation](https://github.com/php-service-bus/documentation/issues)

LICENSE renamed to LICENSE.md

File renamed without changes.

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
"require": {
3131
"php": ">=7.2",
3232
"ext-json": "*",
33-
"symfony/serializer-pack": "^v1",
34-
"php-service-bus/common": "v3.0.7"
33+
"php-service-bus/common": "v3.0.8",
34+
"symfony/serializer-pack": "^v1"
3535
},
3636
"require-dev": {
37+
"php-service-bus/code-style-config": "^v0.1",
3738
"phpunit/phpunit": "^8",
3839
"ext-iconv": "*",
3940
"vimeo/psalm": "^v3"
@@ -42,11 +43,11 @@
4243
"minimum-stability": "dev",
4344
"scripts": {
4445
"psalm": "./vendor/bin/psalm --config=psalm.xml",
45-
"phpunit": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
46+
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
4647
"coverage": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose",
47-
"test": [
48-
"@phpunit"
49-
]
48+
"cs-check": "./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
49+
"cs-fix": "./vendor/bin/php-cs-fixer fix --allow-risky=yes",
50+
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpunit --configuration phpunit.xml --verbose"
5051
},
5152
"config": {
5253
"optimize-autoloader": true

0 commit comments

Comments
 (0)