-
-
Notifications
You must be signed in to change notification settings - Fork 574
Expand file tree
/
Copy pathEnumValueDefinition.php
More file actions
54 lines (42 loc) · 1.31 KB
/
EnumValueDefinition.php
File metadata and controls
54 lines (42 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php declare(strict_types=1);
namespace GraphQL\Type\Definition;
use GraphQL\Language\AST\DirectiveNode;
use GraphQL\Language\AST\EnumValueDefinitionNode;
/**
* @phpstan-type EnumValueConfig array{
* name: string,
* value?: mixed,
* deprecationReason?: string|null,
* description?: string|null,
* directives?: array<DirectiveNode>|null,
* astNode?: EnumValueDefinitionNode|null
* }
*/
class EnumValueDefinition
{
public string $name;
/** @var mixed */
public $value;
public ?string $deprecationReason;
public ?string $description;
public ?EnumValueDefinitionNode $astNode;
/** @var array<DirectiveNode> */
public array $directives;
/** @phpstan-var EnumValueConfig */
public array $config;
/** @phpstan-param EnumValueConfig $config */
public function __construct(array $config)
{
$this->name = $config['name'];
$this->value = $config['value'] ?? null;
$this->deprecationReason = $config['deprecationReason'] ?? null;
$this->description = $config['description'] ?? null;
$this->astNode = $config['astNode'] ?? null;
$this->directives = $config['directives'] ?? [];
$this->config = $config;
}
public function isDeprecated(): bool
{
return (bool) $this->deprecationReason;
}
}