diff --git a/.travis.yml b/.travis.yml index 6f0bf6d..b12d6c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,26 +2,26 @@ dist: trusty language: php php: - - 7.1 - - 7.2 - - nightly + - 7.1 + - 7.2 + - nightly matrix: - allow_failures: - - php: nightly + allow_failures: + - php: nightly cache: - directories: - - $HOME/.composer/cache + directories: + - $HOME/.composer/cache before_install: - - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" - - travis_retry composer self-update + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" + - travis_retry composer self-update install: - - composer require react/promise:2.* - - composer require psr/http-message:1.* - - travis_retry composer update --prefer-dist + - composer require react/promise:2.* + - composer require psr/http-message:1.* + - travis_retry composer update --prefer-dist script: ./vendor/bin/phpunit --group default,ReactPromise @@ -45,21 +45,9 @@ jobs: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover clover.xml - - stage: Pull request coding standard - if: type = pull_request + + - stage: Coding standard + php: 7.1 install: travis_retry composer install --prefer-dist script: - - | - if [ $TRAVIS_BRANCH != "master" ]; then - git remote set-branches --add origin $TRAVIS_BRANCH; - git fetch origin $TRAVIS_BRANCH; - fi - - git merge-base origin/$TRAVIS_BRANCH $TRAVIS_PULL_REQUEST_SHA || git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge --unshallow - - wget https://github.com/diff-sniffer/git/releases/download/0.1.0/git-phpcs.phar - - php git-phpcs.phar origin/$TRAVIS_BRANCH...$TRAVIS_PULL_REQUEST_SHA -# - stage: Coding standard -# if: NOT type = pull_request -# php: 7.1 -# install: travis_retry composer install --prefer-dist -# script: -# - ./vendor/bin/phpcs + - ./vendor/bin/phpcs diff --git a/src/Type/Definition/IntType.php b/src/Type/Definition/IntType.php index 6c0a8f3..5b87643 100644 --- a/src/Type/Definition/IntType.php +++ b/src/Type/Definition/IntType.php @@ -65,7 +65,7 @@ values. Int can represent values between -(2^31) and 2^31 - 1. '; } $int = intval($num); // int cast with == used for performance reasons - // @codingStandardsIgnoreLine + // phpcs:ignore if ($int != $num) { throw new Error( 'Int cannot represent non-integer value: ' . diff --git a/src/Utils/AST.php b/src/Utils/AST.php index a1eaac2..ca61a94 100644 --- a/src/Utils/AST.php +++ b/src/Utils/AST.php @@ -255,7 +255,7 @@ class AST } if (is_float($serialized)) { // int cast with == used for performance reasons - // @codingStandardsIgnoreLine + // phpcs:ignore if ((int) $serialized == $serialized) { return new IntValueNode(['value' => $serialized]); } diff --git a/tests/Server/Psr7/PsrRequestStub.php b/tests/Server/Psr7/PsrRequestStub.php index 09513af..c60dcac 100644 --- a/tests/Server/Psr7/PsrRequestStub.php +++ b/tests/Server/Psr7/PsrRequestStub.php @@ -9,6 +9,9 @@ use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; use function strtolower; +/** + * phpcs:ignoreFile -- this is not a core file + */ class PsrRequestStub implements ServerRequestInterface { public $queryParams = []; diff --git a/tests/Server/Psr7/PsrResponseStub.php b/tests/Server/Psr7/PsrResponseStub.php index ae3f858..bac2ffb 100644 --- a/tests/Server/Psr7/PsrResponseStub.php +++ b/tests/Server/Psr7/PsrResponseStub.php @@ -7,6 +7,9 @@ namespace GraphQL\Tests\Server\Psr7; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; +/** + * phpcs:ignoreFile -- this is not a core file + */ class PsrResponseStub implements ResponseInterface { public $headers = []; diff --git a/tests/Server/Psr7/PsrStreamStub.php b/tests/Server/Psr7/PsrStreamStub.php index d05cf36..736ada9 100644 --- a/tests/Server/Psr7/PsrStreamStub.php +++ b/tests/Server/Psr7/PsrStreamStub.php @@ -8,6 +8,9 @@ use Psr\Http\Message\StreamInterface; use function strlen; use const SEEK_SET; +/** + * phpcs:ignoreFile -- this is not a core file + */ class PsrStreamStub implements StreamInterface { public $content; diff --git a/tests/StarWarsData.php b/tests/StarWarsData.php index 6a54935..9034d99 100644 --- a/tests/StarWarsData.php +++ b/tests/StarWarsData.php @@ -148,7 +148,7 @@ class StarWarsData } /** - * @param $id + * @param string $id * @return mixed|null */ public static function getHuman($id) @@ -159,7 +159,7 @@ class StarWarsData } /** - * @param $id + * @param string $id * @return mixed|null */ public static function getDroid($id) diff --git a/tests/Type/SchemaTest.php b/tests/Type/SchemaTest.php index ea07e65..c9db24f 100644 --- a/tests/Type/SchemaTest.php +++ b/tests/Type/SchemaTest.php @@ -47,7 +47,7 @@ class SchemaTest extends TestCase 'fieldName' => [ 'type' => Type::string(), 'resolve' => function () { - return ''; + return ''; }, ], ],