Issues (645)

src/GraphQL/Execution/QueryResult.php (3 issues)

1
<?php
2
3
namespace Drupal\graphql\GraphQL\Execution;
4
5
use Drupal\Core\Cache\CacheableDependencyInterface;
0 ignored issues
show
The type Drupal\Core\Cache\CacheableDependencyInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
0 ignored issues
show
The type Drupal\Core\Cache\Refina...ableDependencyInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Drupal\Core\Cache\RefinableCacheableDependencyTrait;
0 ignored issues
show
The type Drupal\Core\Cache\Refina...acheableDependencyTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use GraphQL\Executor\ExecutionResult;
9
10
class QueryResult extends ExecutionResult implements RefinableCacheableDependencyInterface {
11
  use RefinableCacheableDependencyTrait;
12
13
  /**
14
   * QueryResult constructor.
15
   *
16
   * @param array $data
17
   *   Result data.
18
   * @param array $errors
19
   *   Errors collected during execution.
20
   * @param array $extensions
21
   *   User specified array of extensions.
22
   * @param \Drupal\Core\Cache\CacheableDependencyInterface $metadata
23
   *   The cache metadata collected during query execution.
24
   */
25
  public function __construct(array $data = null, array $errors = [], array $extensions = [], CacheableDependencyInterface $metadata = NULL) {
26
    $this->data = $data;
27
    $this->errors = $errors;
28
    $this->extensions = $extensions;
29
30
    // If no cache metadata was given, assume this result is not cacheable.
31
    $this->addCacheableDependency($metadata);
32
  }
33
34
  /**
35
   * Don't serialize errors, since they might contain closures.
36
   *
37
   * @return string[]
38
   *   The property names to serialize.
39
   */
40
  public function __sleep() {
41
    // TODO: Find a better way to solve this.
42
    return array_filter(array_keys(get_object_vars($this)), function ($prop) {
43
      return $prop != 'errors';
44
    });
45
  }
46
47
}
48