Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 1cb8170

Browse files
committed
Replace php-cs-fixer with phpcs
And: - Update to 5.6 as minimum supported PHP version - Add composer scripts for CS checks, unit tests, and coverage uploading
1 parent 9aaa0e6 commit 1cb8170

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

.travis.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ env:
2424
matrix:
2525
fast_finish: true
2626
include:
27-
- php: 5.5
28-
env:
29-
- EXECUTE_CS_CHECK=true
3027
- php: 5.6
3128
env:
32-
- EXECUTE_TEST_COVERALLS=true
29+
- TEST_COVERAGE=true
3330
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
3431
- PATH="$HOME/.local/bin:$PATH"
3532
- php: 7
33+
env:
34+
- CS_CHECK=true
3635
- php: hhvm
3736
allow_failures:
3837
- php: hhvm
@@ -42,21 +41,21 @@ notifications:
4241
email: false
4342

4443
before_install:
45-
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
44+
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
4645
- composer self-update
47-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
46+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
4847

4948
install:
5049
- travis_retry composer install --no-interaction --ignore-platform-reqs
5150

5251
script:
53-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
54-
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
55-
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi
52+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; fi
53+
- if [[ $TEST_COVERAGE != 'true' ]]; then composer test ; fi
54+
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
5655
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi
5756

5857
after_success:
5958
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi
6059

6160
after_script:
62-
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi
61+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
}
1414
},
1515
"require": {
16-
"php": "^5.5 || ^7.0"
16+
"php": "^5.6 || ^7.0"
1717
},
1818
"require-dev": {
19-
"fabpot/php-cs-fixer": "1.7.*",
19+
"athletic/athletic": "~0.1",
2020
"phpunit/PHPUnit": "~4.0",
21-
"athletic/athletic": "~0.1"
21+
"squizlabs/php_codesniffer": "^2.6.2"
2222
},
2323
"extra": {
2424
"branch-alias": {
@@ -31,5 +31,12 @@
3131
"ZendTest\\Stdlib\\": "test/",
3232
"ZendBench\\Stdlib\\": "benchmark/"
3333
}
34+
},
35+
"scripts": {
36+
"cs-check": "phpcs --colors",
37+
"cs-fix": "phpcbf --colors",
38+
"test": "phpunit --colors=always",
39+
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
40+
"upload-coverage": "coveralls -v"
3441
}
3542
}

phpcs.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Zend Framework coding standard">
3+
<description>Zend Framework coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="colors"/>
8+
9+
<!-- inherit rules from: -->
10+
<rule ref="PSR2"/>
11+
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
12+
<rule ref="Generic.Formatting.SpaceAfterNot"/>
13+
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
14+
<properties>
15+
<property name="ignoreNewlines" value="true"/>
16+
</properties>
17+
</rule>
18+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
19+
<properties>
20+
<property name="ignoreBlankLines" value="false"/>
21+
</properties>
22+
</rule>
23+
24+
<!-- Paths to check -->
25+
<file>src</file>
26+
<file>test</file>
27+
</ruleset>

0 commit comments

Comments
 (0)