diff --git a/.gitignore b/.gitignore index 4fbb073..472359e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /vendor/ /composer.lock +.phpcs.xml +phpcs.xml diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 0000000..b6fa885 --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,129 @@ + + + Yoast WHIP rules for PHP_CodeSniffer + + + + . + + vendor/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /src/facades/wordpress\.php$ + + + /tests/doubles/WpCoreFunctionsMock\.php$ + + + + + + + + + + + + + + + + + /tests/doubles/WPCoreFunctionsMock\.php$ + + + + + + + + warning + + + + + /tests/doubles/WPCoreFunctionsMock\.php$ + + + + + /src/Whip_Host\.php$ + + + + + /tests/*\.php$ + + + /tests/*\.php$ + + + /tests/*\.php$ + + + /tests/*\.php$ + + + diff --git a/.travis.yml b/.travis.yml index 7e56b4f..5afe972 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ matrix: fast_finish: true include: - php: 7.2 + env: PHPCS=1 - php: 5.2 dist: precise - php: 5.3 @@ -35,7 +36,8 @@ before_install: install: - if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local 5.3.29; fi -- if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then composer remove --dev phpunit/phpunit; fi +- if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "5.3" ]]; then composer remove --dev yoast/yoastcs dealerdirect/phpcodesniffer-composer-installer; fi +- if [[ $TRAVIS_PHP_VERSION == "5.2" ]]; then composer remove --dev phpunit/phpunit; fi - composer install --prefer-dist --no-interaction - if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local --unset; fi @@ -44,3 +46,4 @@ script: - find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then phpunit; else ./vendor/bin/phpunit; fi - if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then composer validate --no-check-all; fi +- if [[ $PHPCS == "1" ]]; then vendor/bin/phpcs --runtime-set ignore_warnings_on_exit 1; fi diff --git a/composer.json b/composer.json index 44944ff..68f1924 100644 --- a/composer.json +++ b/composer.json @@ -2,10 +2,6 @@ "name": "yoast/whip", "description": "A WordPress package to nudge users to upgrade their software versions (starting with PHP)", "type": "library", - "require-dev": { - "phpunit/phpunit": "^3.6.12 | ^4.5 | ^5.7", - "roave/security-advisories": "dev-master" - }, "license": "GPL-3.0-or-later", "authors": [ { @@ -24,6 +20,12 @@ "require": { "xrstf/composer-php52": "^1.0" }, + "require-dev": { + "phpunit/phpunit": "^3.6.12 | ^4.5 | ^5.7", + "roave/security-advisories": "dev-master", + "yoast/yoastcs": "~0.5.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3" + }, "scripts": { "post-install-cmd": [ "xrstf\\Composer52\\Generator::onPostInstallCmd"