Check CS in the whole project

Closes #284
This commit is contained in:
Simon Podlipsky 2018-09-02 16:31:14 +02:00
parent a4edb34deb
commit 7dbd72cebf
No known key found for this signature in database
GPG Key ID: 725C2BD962B42663
8 changed files with 30 additions and 33 deletions

View File

@ -2,26 +2,26 @@ dist: trusty
language: php language: php
php: php:
- 7.1 - 7.1
- 7.2 - 7.2
- nightly - nightly
matrix: matrix:
allow_failures: allow_failures:
- php: nightly - php: nightly
cache: cache:
directories: directories:
- $HOME/.composer/cache - $HOME/.composer/cache
before_install: before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
- travis_retry composer self-update - travis_retry composer self-update
install: install:
- composer require react/promise:2.* - composer require react/promise:2.*
- composer require psr/http-message:1.* - composer require psr/http-message:1.*
- travis_retry composer update --prefer-dist - travis_retry composer update --prefer-dist
script: ./vendor/bin/phpunit --group default,ReactPromise script: ./vendor/bin/phpunit --group default,ReactPromise
@ -45,21 +45,9 @@ jobs:
after_script: after_script:
- wget https://scrutinizer-ci.com/ocular.phar - wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover clover.xml - 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 install: travis_retry composer install --prefer-dist
script: script:
- | - ./vendor/bin/phpcs
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

View File

@ -65,7 +65,7 @@ values. Int can represent values between -(2^31) and 2^31 - 1. ';
} }
$int = intval($num); $int = intval($num);
// int cast with == used for performance reasons // int cast with == used for performance reasons
// @codingStandardsIgnoreLine // phpcs:ignore
if ($int != $num) { if ($int != $num) {
throw new Error( throw new Error(
'Int cannot represent non-integer value: ' . 'Int cannot represent non-integer value: ' .

View File

@ -255,7 +255,7 @@ class AST
} }
if (is_float($serialized)) { if (is_float($serialized)) {
// int cast with == used for performance reasons // int cast with == used for performance reasons
// @codingStandardsIgnoreLine // phpcs:ignore
if ((int) $serialized == $serialized) { if ((int) $serialized == $serialized) {
return new IntValueNode(['value' => $serialized]); return new IntValueNode(['value' => $serialized]);
} }

View File

@ -9,6 +9,9 @@ use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface; use Psr\Http\Message\UriInterface;
use function strtolower; use function strtolower;
/**
* phpcs:ignoreFile -- this is not a core file
*/
class PsrRequestStub implements ServerRequestInterface class PsrRequestStub implements ServerRequestInterface
{ {
public $queryParams = []; public $queryParams = [];

View File

@ -7,6 +7,9 @@ namespace GraphQL\Tests\Server\Psr7;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
/**
* phpcs:ignoreFile -- this is not a core file
*/
class PsrResponseStub implements ResponseInterface class PsrResponseStub implements ResponseInterface
{ {
public $headers = []; public $headers = [];

View File

@ -8,6 +8,9 @@ use Psr\Http\Message\StreamInterface;
use function strlen; use function strlen;
use const SEEK_SET; use const SEEK_SET;
/**
* phpcs:ignoreFile -- this is not a core file
*/
class PsrStreamStub implements StreamInterface class PsrStreamStub implements StreamInterface
{ {
public $content; public $content;

View File

@ -148,7 +148,7 @@ class StarWarsData
} }
/** /**
* @param $id * @param string $id
* @return mixed|null * @return mixed|null
*/ */
public static function getHuman($id) public static function getHuman($id)
@ -159,7 +159,7 @@ class StarWarsData
} }
/** /**
* @param $id * @param string $id
* @return mixed|null * @return mixed|null
*/ */
public static function getDroid($id) public static function getDroid($id)

View File

@ -47,7 +47,7 @@ class SchemaTest extends TestCase
'fieldName' => [ 'fieldName' => [
'type' => Type::string(), 'type' => Type::string(),
'resolve' => function () { 'resolve' => function () {
return ''; return '';
}, },
], ],
], ],