diff --git a/.travis.yml b/.travis.yml index edab8bd..d8ec128 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,12 @@ language: php -# Required for HHVM, see https://github.com/travis-ci/travis-ci/issues/7712 dist: trusty php: - - 5.5 - 5.6 - 7.0 - 7.1 - - hhvm + - 7.2 - nightly matrix: @@ -20,7 +18,8 @@ cache: - $HOME/.composer/cache before_install: - - if [[ "$TRAVIS_PHP_VERSION" != "5.6" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini || true; fi + - if [[ "$TRAVIS_PHP_VERSION" != "5.6" ]]; then phpenv config-rm xdebug.ini || true; fi + - phpenv config-rm xdebug.ini || true - composer selfupdate install: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3672884..323dd6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,4 +123,4 @@ Improvements: - New docs and examples ## Older versions -Look at [Github Releases Page](https://github.com/webonyx/graphql-php/releases). +Look at [GitHub Releases Page](https://github.com/webonyx/graphql-php/releases). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 872e41b..cce2fb6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ ## Workflow If your contribution requires significant or breaking changes, or if you plan to propose a major new feature, -we recommend you to create an issue on the [Github](https://github.com/webonyx/graphql-php/issues) with +we recommend you to create an issue on the [GitHub](https://github.com/webonyx/graphql-php/issues) with a brief proposal and discuss it with us first. For smaller contributions just use this workflow: diff --git a/composer.json b/composer.json index 3b0abab..493767b 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "API" ], "require": { - "php": ">=5.5,<8.0-DEV", + "php": ">=5.6", "ext-mbstring": "*" }, "require-dev": { @@ -17,8 +17,13 @@ "psr/http-message": "^1.0" }, "config": { - "bin-dir": "bin" - }, + "bin-dir": "bin", + "platform": { + "php": "5.6.0" + }, + "preferred-install": "dist", + "sort-packages": true +}, "autoload": { "files": ["src/deprecated.php"], "psr-4": { diff --git a/docs/index.md b/docs/index.md index a10210c..c5c4e66 100644 --- a/docs/index.md +++ b/docs/index.md @@ -51,5 +51,5 @@ The current version (v0.10) supports all features described by GraphQL specifica Ready for real-world usage. -## Github +## GitHub Project source code is [hosted on GitHub](https://github.com/webonyx/graphql-php). diff --git a/examples/03-server/README.md b/examples/03-server/README.md index ee36ccb..4737d6e 100644 --- a/examples/03-server/README.md +++ b/examples/03-server/README.md @@ -10,10 +10,10 @@ php -S localhost:8080 ./graphql.php ### Try query ``` -curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }' +curl -d '{"query": "query { echo(message: \"Hello World\") }" }' -H "Content-Type: application/json" http://localhost:8080 ``` ### Try mutation ``` -curl http://localhost:8080 -d '{"query": "mutation { sum(x: 2, y: 2) }" }' +curl -d '{"query": "mutation { sum(x: 2, y: 2) }" }' -H "Content-Type: application/json" http://localhost:8080 ``` diff --git a/src/Type/Schema.php b/src/Type/Schema.php index 5bda972..bffe726 100644 --- a/src/Type/Schema.php +++ b/src/Type/Schema.php @@ -271,11 +271,11 @@ class Schema foreach ($types as $index => $type) { if (!$type instanceof Type) { - throw new InvariantViolation( + throw new InvariantViolation(sprintf( 'Each entry of schema types must be instance of GraphQL\Type\Definition\Type but entry at %s is %s', $index, Utils::printSafe($type) - ); + )); } yield $type; } diff --git a/src/Validator/DocumentValidator.php b/src/Validator/DocumentValidator.php index 3efd992..201a850 100644 --- a/src/Validator/DocumentValidator.php +++ b/src/Validator/DocumentValidator.php @@ -86,6 +86,12 @@ class DocumentValidator if (null === $rules) { $rules = static::allRules(); } + + if (true === is_array($rules) && 0 === count($rules)) { + // Skip validation if there are no rules + return []; + } + $typeInfo = $typeInfo ?: new TypeInfo($schema); $errors = static::visitUsingRules($schema, $typeInfo, $ast, $rules); return $errors;