Skip to content

Commit

Permalink
Merge pull request #147 from adriansuter/patch-phpcs-phpstan
Browse files Browse the repository at this point in the history
3.x - Add phpcs and phpstan
  • Loading branch information
l0gicgate committed Sep 11, 2019
2 parents 55d3ca5 + bbe4916 commit 472f2c1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitattributes
Expand Up @@ -9,4 +9,6 @@
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
/phpcs.xml export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -19,6 +19,8 @@ before_script:
script:
- if [[ "$ANALYSIS" != 'true' ]]; then vendor/bin/phpunit ; fi
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpcs ; fi
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpstan analyse src ; fi

after_success:
- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/php-coveralls --coverage_clover=clover.xml -v ; fi
4 changes: 3 additions & 1 deletion composer.json
Expand Up @@ -25,7 +25,9 @@
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"psr/http-factory": "^1.0"
"psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "^3.4.2",
"phpstan/phpstan": "^0.11.15"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 17 additions & 0 deletions phpcs.xml
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset name="Slim coding standard">
<description>Slim coding standard</description>

<!-- display progress -->
<arg value="p"/>
<!-- use colors in output -->
<arg name="colors"/>

<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>

<!-- Paths to check -->
<file>src</file>
<file>tests</file>
</ruleset>
3 changes: 3 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,3 @@
parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true

0 comments on commit 472f2c1

Please sign in to comment.