mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 06:16:05 +03:00
Add static analysis tool
This commit is contained in:
parent
6c40fec35a
commit
d8f41e854f
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ composer.phar
|
||||
composer.lock
|
||||
phpcs.xml
|
||||
vendor/
|
||||
bin/
|
||||
phpstan.phar
|
||||
|
21
.travis.yml
21
.travis.yml
@ -6,10 +6,6 @@ php:
|
||||
- 7.2
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
@ -18,12 +14,9 @@ before_install:
|
||||
- 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
|
||||
install: composer install --dev --prefer-dist
|
||||
|
||||
script: ./vendor/bin/phpunit --group default,ReactPromise
|
||||
script: bin/phpunit --group default,ReactPromise
|
||||
|
||||
jobs:
|
||||
allow_failures:
|
||||
@ -41,13 +34,19 @@ jobs:
|
||||
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
|
||||
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
|
||||
script:
|
||||
- ./vendor/bin/phpunit --coverage-clover clover.xml
|
||||
- bin/phpunit --coverage-clover clover.xml
|
||||
after_script:
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover clover.xml
|
||||
|
||||
- stage: Coding standard
|
||||
- stage: Code Quality
|
||||
php: 7.1
|
||||
install: travis_retry composer install --prefer-dist
|
||||
script:
|
||||
- ./vendor/bin/phpcs
|
||||
|
||||
- stage: Code Quality
|
||||
php: 7.2
|
||||
env: STATIC_ANALYSIS
|
||||
install: travis_retry composer install --prefer-dist
|
||||
script: composer static-analysis
|
||||
|
@ -16,9 +16,12 @@
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^4.0",
|
||||
"phpunit/phpunit": "^7.2",
|
||||
"psr/http-message": "^1.0"
|
||||
"phpstan/phpstan-shim": "^0.10",
|
||||
"psr/http-message": "^1.0",
|
||||
"react/promise": "2.*"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
@ -39,6 +42,7 @@
|
||||
"psr/http-message": "To use standard GraphQL server"
|
||||
},
|
||||
"scripts": {
|
||||
"lint" : "phpcs"
|
||||
"lint" : "phpcs",
|
||||
"static-analysis": "@php bin/phpstan.phar analyse --ansi -l 1 -c phpstan.neon src"
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace GraphQL\Executor\Promise;
|
||||
|
||||
use GraphQL\Executor\Promise\Adapter\SyncPromise;
|
||||
use GraphQL\Utils\Utils;
|
||||
use React\Promise\Promise as ReactPromise;
|
||||
|
||||
/**
|
||||
* Convenience wrapper for promises represented by Promise Adapter
|
||||
|
@ -264,6 +264,7 @@ class Visitor
|
||||
|
||||
if ($visitFn) {
|
||||
$result = call_user_func($visitFn, $node, $key, $parent, $path, $ancestors);
|
||||
$editValue = null;
|
||||
|
||||
if ($result !== null) {
|
||||
if ($result instanceof VisitorOperation) {
|
||||
|
@ -8,7 +8,7 @@ use GraphQL\Error\FormattedError;
|
||||
use GraphQL\Error\InvariantViolation;
|
||||
use GraphQL\Executor\ExecutionResult;
|
||||
use GraphQL\Executor\Promise\Promise;
|
||||
use GraphQL\Utils;
|
||||
use GraphQL\Utils\Utils;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
@ -7,7 +7,9 @@ namespace GraphQL\Validator\Rules;
|
||||
use GraphQL\Error\Error;
|
||||
use GraphQL\Language\AST\DirectiveNode;
|
||||
use GraphQL\Language\AST\InputObjectTypeDefinitionNode;
|
||||
use GraphQL\Language\AST\Node;
|
||||
use GraphQL\Language\AST\NodeKind;
|
||||
use GraphQL\Language\AST\NodeList;
|
||||
use GraphQL\Language\DirectiveLocation;
|
||||
use GraphQL\Validator\ValidationContext;
|
||||
use function count;
|
||||
@ -59,7 +61,9 @@ class KnownDirectives extends ValidationRule
|
||||
}
|
||||
|
||||
/**
|
||||
* @param (Node|NodeList)[] $ancestors
|
||||
* @param Node[]|NodeList[] $ancestors
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getDirectiveLocationForASTPath(array $ancestors)
|
||||
{
|
||||
|
@ -44,10 +44,10 @@ class VariablesDefaultValueAllowed extends ValidationRule
|
||||
|
||||
return Visitor::skipNode();
|
||||
},
|
||||
NodeKind::SELECTION_SET => function (SelectionSetNode $node) use ($context) {
|
||||
NodeKind::SELECTION_SET => function (SelectionSetNode $node) {
|
||||
return Visitor::skipNode();
|
||||
},
|
||||
NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) {
|
||||
NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) {
|
||||
return Visitor::skipNode();
|
||||
},
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user