Skip to content

Commit c4dc559

Browse files
committedJul 21, 2017
travis: tested using Nette Coding Standard
1 parent f43de13 commit c4dc559

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed
 

‎.travis.yml

+18-7
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,43 @@ matrix:
88
include:
99
- php: 7.0
1010
env: coverage=on
11+
- php: 7.1
12+
env: codingStandard=on
1113

1214
allow_failures:
1315
- php: 7.0
1416
env: coverage=on
1517

1618
script:
1719
- vendor/bin/tester tests -s -c tests/php-unix.ini $coverageArgs
18-
- php temp/code-checker/src/code-checker.php --short-arrays --strict-types -i tests/Utils/files
20+
- >
21+
if [ "$codingStandard" ]; then
22+
php temp/code-checker/src/code-checker.php --short-arrays --strict-types
23+
&& php temp/coding-standard/ecs check src tests --config tests/coding-standard.neon;
24+
fi
1925
2026
after_failure:
2127
# Print *.actual content
2228
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
2329

2430
before_script:
25-
# Install Nette Tester & Code Checker
31+
# Install Nette Tester
2632
- travis_retry composer install --no-interaction --prefer-dist
27-
- travis_retry composer create-project nette/code-checker temp/code-checker ~2.8 --no-interaction
28-
- if [ "$coverage" == "on" ]; then coverageArgs="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi
33+
# Install Code Checkers
34+
- >
35+
if [ "$codingStandard" ]; then
36+
travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-interaction;
37+
travis_retry composer create-project nette/coding-standard temp/coding-standard --no-interaction;
38+
fi
39+
- if [ "$coverage" ]; then coverageArgs="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi
2940

3041
after_script:
3142
# Report Code Coverage
3243
- >
33-
if [ "$coverage" == "on" ]; then
44+
if [ "$coverage" ]; then
3445
wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
35-
&& php coveralls.phar --verbose --config tests/.coveralls.yml
36-
|| true; fi
46+
&& php coveralls.phar --verbose --config tests/.coveralls.yml;
47+
fi
3748
3849
sudo: false
3950

‎src/Utils/Arrays.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public static function flatten(array $arr, bool $preserveKeys = false): array
142142
$res = [];
143143
$cb = $preserveKeys
144144
? function ($v, $k) use (&$res) { $res[$k] = $v; }
145-
: function ($v) use (&$res) { $res[] = $v; };
145+
: function ($v) use (&$res) { $res[] = $v; };
146146
array_walk_recursive($arr, $cb);
147147
return $res;
148148
}

‎tests/coding-standard.neon

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
includes:
2+
- ../temp/coding-standard/coding-standard-php70.neon
3+
4+
parameters:
5+
skip:
6+
PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff:
7+
- tests/Utils/FileSystem.phpt # RemoteStream extends streamWrapper
8+
9+
PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer:
10+
- src/Utils/Arrays.php # use function
11+
- src/Utils/Callback.php # use function
12+
- src/Utils/Html.php # use function
13+
- src/Utils/Strings.php # use function

0 commit comments

Comments
 (0)
Failed to load comments.