diff --git a/.travis.yml b/.travis.yml index e506ea5f9..74c0221ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ matrix: include: - php: 7.0 env: coverage=on + - php: 7.1 + env: codingStandard=on allow_failures: - php: 7.0 @@ -15,25 +17,34 @@ matrix: script: - vendor/bin/tester tests -s -c tests/php-unix.ini $coverageArgs - - php temp/code-checker/src/code-checker.php --short-arrays --strict-types -i tests/Utils/fixtures.reflection + - > + if [ "$codingStandard" ]; then + php temp/code-checker/src/code-checker.php --short-arrays --strict-types -i tests/Utils/fixtures.reflection + && php temp/coding-standard/ecs check src tests --config tests/coding-standard.neon; + fi after_failure: # Print *.actual content - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done before_script: - # Install Nette Tester & Code Checker + # Install Nette Tester - travis_retry composer install --no-interaction --prefer-dist - - travis_retry composer create-project nette/code-checker temp/code-checker ~2.8 --no-interaction - - if [ "$coverage" == "on" ]; then coverageArgs="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi + # Install Code Checkers + - > + if [ "$codingStandard" ]; then + travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-interaction; + travis_retry composer create-project nette/coding-standard temp/coding-standard --no-interaction; + fi + - if [ "$coverage" ]; then coverageArgs="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi after_script: # Report Code Coverage - > - if [ "$coverage" == "on" ]; then + if [ "$coverage" ]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar - && php coveralls.phar --verbose --config tests/.coveralls.yml - || true; fi + && php coveralls.phar --verbose --config tests/.coveralls.yml; + fi sudo: false diff --git a/src/Utils/Arrays.php b/src/Utils/Arrays.php index f80d3eeb1..f3117488f 100644 --- a/src/Utils/Arrays.php +++ b/src/Utils/Arrays.php @@ -142,7 +142,7 @@ public static function flatten(array $arr, bool $preserveKeys = false): array $res = []; $cb = $preserveKeys ? function ($v, $k) use (&$res) { $res[$k] = $v; } - : function ($v) use (&$res) { $res[] = $v; }; + : function ($v) use (&$res) { $res[] = $v; }; array_walk_recursive($arr, $cb); return $res; } diff --git a/tests/coding-standard.neon b/tests/coding-standard.neon new file mode 100644 index 000000000..59603b8c3 --- /dev/null +++ b/tests/coding-standard.neon @@ -0,0 +1,13 @@ +includes: + - ../temp/coding-standard/coding-standard-php70.neon + +parameters: + skip: + PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff: + - tests/Utils/FileSystem.phpt # RemoteStream extends streamWrapper + + PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer: + - src/Utils/Arrays.php # use function + - src/Utils/Callback.php # use function + - src/Utils/Html.php # use function + - src/Utils/Strings.php # use function