Issues (645)

src/Annotation/GraphQLAnnotationBase.php (3 issues)

1
<?php
2
3
namespace Drupal\graphql\Annotation;
4
5
use Doctrine\Common\Annotations\AnnotationException;
0 ignored issues
show
The type Doctrine\Common\Annotations\AnnotationException 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\Component\Annotation\Plugin;
0 ignored issues
show
The type Drupal\Component\Annotation\Plugin 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\CacheBackendInterface;
0 ignored issues
show
The type Drupal\Core\Cache\CacheBackendInterface 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
9
/**
10
 * Annotation for GraphQL input type plugins.
11
 *
12
 * @Annotation
13
 */
14
abstract class GraphQLAnnotationBase extends Plugin {
15
16
  /**
17
   * The plugin type.
18
   *
19
   * The type of component. Field, Interface, Type, Scalar ...
20
   *
21
   * @var string
22
   *
23
   * @see graphql.module
24
   */
25
  public $pluginType = NULL;
26
27
  /**
28
   * The component name.
29
   *
30
   * @var string
31
   */
32
  public $name;
33
34
  /**
35
   * The component description.
36
   *
37
   * @var string
38
   */
39
  public $description = '';
40
41
  /**
42
   * Weight for precedence calculations.
43
   *
44
   * If multiple components with the same name are available, the highest
45
   * weight wins.
46
   *
47
   * @var int
48
   */
49
  public $weight = 0;
50
51
  /**
52
   * The cache contexts for caching the type system definition in the schema.
53
   *
54
   * @var array
55
   */
56
  public $schema_cache_contexts = [];
57
58
  /**
59
   * The cache tags for caching the type system definition in the schema.
60
   *
61
   * @var array
62
   */
63
  public $schema_cache_tags = [];
64
65
  /**
66
   * The cache max age for caching the type system definition in the schema.
67
   *
68
   * @var array
69
   */
70
  public $schema_cache_max_age = CacheBackendInterface::CACHE_PERMANENT;
71
72
  /**
73
   * The cache contexts for caching the response.
74
   *
75
   * @var array
76
   */
77
  public $response_cache_contexts = ['user.permissions'];
78
79
  /**
80
   * The cache tags for caching the response.
81
   *
82
   * @var array
83
   */
84
  public $response_cache_tags = [];
85
86
  /**
87
   * The cache max age for caching the response.
88
   *
89
   * @var array
90
   */
91
  public $response_cache_max_age = CacheBackendInterface::CACHE_PERMANENT;
92
93
  /**
94
   * GraphQLAnnotationBase constructor.
95
   *
96
   * @param $values
97
   *   The plugin annotation values.
98
   *
99
   * @throws \Doctrine\Common\Annotations\AnnotationException
100
   *   In case of missing required annotation values.
101
   */
102
  public function __construct($values) {
103
    if (!array_key_exists('id', $values) || !$values['id']) {
104
      throw new AnnotationException('GraphQL plugin is missing an "id" property.');
105
    }
106
    parent::__construct($values);
107
  }
108
109
}
110