Skip to content

Commit

Permalink
Add PHPStan and level to max (#168)
Browse files Browse the repository at this point in the history
* tests: update to PHPUnit 6.0 with rector

* fix namespaces on tests

* composer + tests: use standard test namespace naming

* update travis

* resolve conflict

* phpstan lvl 2

* phpstan lvl 3

* phpstan lvl 4

* phpstan lvl 5

* phpstan lvl 6

* phpstan lvl 7

* level max

* resolve conflict

* [cs] clean empty docs

* composer: bump to PHPUnit 6.4

* cleanup

* composer + travis: add phpstan

* phpstan lvl 1

* composer: update dev deps

* phpstan fixes

* update Contributing with new tools

* docs: link fixes, PHP version update

* composer: drop php-cs-fixer, cs already handled by ecs

* ecs: add old set rules

* [cs] apply rest of rules
  • Loading branch information
Tomáš Votruba authored and akondas committed Jan 6, 2018
1 parent fbbe5c5 commit a348111
Show file tree
Hide file tree
Showing 103 changed files with 365 additions and 284 deletions.
32 changes: 0 additions & 32 deletions .php_cs

This file was deleted.

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ install:
script:
- vendor/bin/phpunit $PHPUNIT_FLAGS
- if [[ $STATIC_ANALYSIS != "" ]]; then vendor/bin/ecs check src tests; fi
- if [[ $STATIC_ANALYSIS != "" ]]; then vendor/bin/phpstan.phar analyse src tests --level max --configuration phpstan.neon; fi

after_success:
- |
Expand Down
27 changes: 18 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@ code base clean, unified and future proof.

## Branch

You should only open pull requests against the master branch.
You should only open pull requests against the `master` branch.

## Unit-Tests

Please try to add a test for your pull-request. You can run the unit-tests by calling:

```
bin/phpunit
```bash
vendor/bin/phpunit
```

## Travis

GitHub automatically run your pull request through Travis CI against PHP 7.
If you break the tests, I cannot merge your code, so please make sure that your code is working
before opening up a Pull-Request.
GitHub automatically run your pull request through Travis CI.
If you break the tests, I cannot merge your code, so please make sure that your code is working before opening up a Pull-Request.

## Merge

Please allow me time to review your pull requests. I will give my best to review everything as fast as possible, but cannot always live up to my own expectations.

## Coding Standards
## Coding Standards & Static Analysis

When contributing code to PHP-ML, you must follow its coding standards. To do that, just run:

```bash
vendor/bin/ecs check src tests --fix
```
[More about EasyCodingStandard](https://github.com/Symplify/EasyCodingStandard)

Code has to also pass static analysis by [PHPStan](https://github.com/phpstan/phpstan):

When contributing code to PHP-ML, you must follow its coding standards. It's as easy as executing `./bin/php-cs-fixer fix` in root directory.
```bash
vendor/bin/phpstan.phar analyse src tests --level max --configuration phpstan.neon
```

More about PHP-CS-Fixer: [http://cs.sensiolabs.org/](http://cs.sensiolabs.org/)

## Documentation

Expand Down
23 changes: 14 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Phpml\\": "src/Phpml"
}
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.4",
"friendsofphp/php-cs-fixer": "^2.4",
"symplify/easy-coding-standard": "dev-master as 2.5",
"symplify/coding-standard": "dev-master as 2.5",
"symplify/package-builder": "dev-master#3604bea as 2.5"
"symplify/easy-coding-standard": "v3.0.0-RC3",
"symplify/coding-standard": "v3.0.0-RC3",
"symplify/package-builder": "v3.0.0-RC3",
"phpstan/phpstan-shim": "^0.8"
},
"autoload": {
"psr-4": {
"Phpml\\": "src/Phpml"
}
},
"autoload-dev": {
"psr-4": {
"Phpml\\Tests\\": "tests/Phpml"
}
}
}
Loading

0 comments on commit a348111

Please sign in to comment.