Skip to content

Commit

Permalink
Add linting stage
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 31, 2018
1 parent 4ee4570 commit 5456caf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .php_cs.php
@@ -0,0 +1,14 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('.')
;

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder)
->setUsingCache(false)
;
4 changes: 4 additions & 0 deletions .phpstan.neon
@@ -0,0 +1,4 @@
parameters:
ignoreErrors:
- '#Result of method React\\Socket\\ServerInterface::close\(\) \(void\) is used#'
- '#Call to an undefined static method Symfony\\Component\\Process\\ProcessUtils::escapeArgument\(\)#'
29 changes: 29 additions & 0 deletions .travis.yml
@@ -0,0 +1,29 @@
sudo: false

language: php

install:
- composer validate
- composer install

matrix:
fast_finish: true

jobs:
include:
- stage: lint
php: 7.1
install:
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- composer require "phpstan/phpstan" "friendsofphp/php-cs-fixer:^2.8"
script:
# Static analyzer check
- ./vendor/bin/phpstan analyze -c .phpstan.neon --level=4 --no-progress Bootstraps Bridges Laravel
# Check the code style
- IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS
- ./vendor/bin/php-cs-fixer fix --config=.php_cs.php -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}"

# Cache package sources
cache:
directories:
- $HOME/.composer/cache

0 comments on commit 5456caf

Please sign in to comment.