Completed
Push — 8.x-3.x ( d7a068...174067 )
by Sebastian
04:46
created

Schema::getSchemaBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\graphql\GraphQL\Schema;
4
5
use Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilderInterface;
6
use Youshido\GraphQL\Config\Schema\SchemaConfig;
7
use Youshido\GraphQL\Schema\AbstractSchema;
8
9
class Schema extends AbstractSchema {
10
11
  /**
12
   * The corresponding plugin for this schema.
13
   *
14
   * @var \Drupal\graphql\Plugin\GraphQL\SchemaPluginInterface
15
   */
16
  protected $builder;
17
18
  /**
19
   * Schema constructor.
20
   *
21
   * @param \Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilderInterface $builder
22
   *   The schema builder.
23
   * @param array $config
24
   *   The schema configuration array.
25
   */
26
  public function __construct(PluggableSchemaBuilderInterface $builder, array $config = []) {
27
    parent::__construct($config);
28
    $this->builder = $builder;
0 ignored issues
show
Documentation Bug introduced by
$builder is of type object<Drupal\graphql\Pl...SchemaBuilderInterface>, but the property $builder was declared to be of type object<Drupal\graphql\Pl...\SchemaPluginInterface>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
29
  }
30
31
  /**
32
   * Retrieves the schema's plugin instance.
33
   *
34
   * @return \Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilderInterface
35
   *   The schema builder.
36
   */
37
  public function getSchemaBuilder() {
38
    return $this->builder;
39
  }
40
41
  /**
42
   * {@inheritdoc}
43
   */
44
  public function build(SchemaConfig $config) {
45
    // Nothing to do here.
46
  }
47
48
}
49