for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Drupal\graphql\GraphQL\Execution\Visitor;
use Youshido\GraphQL\Exception\ResolveException;
use Youshido\GraphQL\Field\FieldInterface;
class MaxComplexityVisitor implements VisitorInterface {
/**
* @var int
*/
protected $defaultCost;
* MaxComplexityQueryVisitor constructor.
*
* @param int $maxComplexity
$maxComplexity
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* The allowed maximum complexity.
public function __construct($defaultCost = 1) {
$this->defaultCost = $defaultCost;
}
* {@inheritdoc}
public function visit(array $args, FieldInterface $field, $children) {
/** @var \Youshido\GraphQL\Config\Field\FieldConfig $config */
$config = $field->getConfig();
$cost = $config->get('cost', NULL);
if (is_callable($cost)) {
$cost = $cost($args, $field, $children);
return isset($cost) ? $cost : $this->defaultCost;
public function reduce($carry, $current) {
return !empty($current) ? $carry + $current : $carry;
public function initial() {
return 0;
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.