This commit is contained in:
Vladimir Razuvaev 2018-04-17 17:49:52 +08:00
commit f265320c3c
8 changed files with 24 additions and 14 deletions

View File

@ -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:

View File

@ -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).

View File

@ -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:

View File

@ -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": {

View File

@ -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).

View File

@ -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
```

View File

@ -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;
}

View File

@ -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;