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