Issues (645)

src/Annotation/GraphQLSchema.php (2 issues)

Labels
Severity
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
/**
8
 * Annotation for GraphQL schema plugins.
9
 *
10
 * @Annotation
11
 */
12
class GraphQLSchema extends Plugin {
13
14
  /**
15
   * The schema name.
16
   *
17
   * @var string
18
   */
19
  public $name;
20
21
  /**
22
   * The schema path.
23
   *
24
   * @var string
25
   */
26
  public $path;
27
28
  /**
29
   * Weight for precedence calculations.
30
   *
31
   * If multiple components with the same name are available, the highest
32
   * weight wins.
33
   *
34
   * @var int
35
   */
36
  public $weight = 0;
37
38
  /**
39
   * GraphQLSchema constructor.
40
   *
41
   * @param mixed $values
42
   *   The plugin annotation values.
43
   *
44
   * @throws \Doctrine\Common\Annotations\AnnotationException
45
   *   In case of missing required values.
46
   */
47
  public function __construct($values) {
48
    if (!array_key_exists('id', $values) || !$values['id']) {
49
      throw new AnnotationException('GraphQL schema is missing an "id" property.');
50
    }
51
52
    if (!array_key_exists('path', $values) || !$values['path']) {
53
      throw new AnnotationException('GraphQL schema is missing an "path" property.');
54
    }
55
56
    parent::__construct($values);
57
  }
58
59
}
60