|
9 | 9 | use Graphpinator\Parser\OperationType; |
10 | 10 | use Graphpinator\Parser\Variable\VariableSet; |
11 | 11 |
|
12 | | -final class Operation |
| 12 | +final readonly class Operation |
13 | 13 | { |
14 | | - private VariableSet $variables; |
15 | | - private DirectiveSet $directives; |
16 | | - |
17 | 14 | public function __construct( |
18 | | - private OperationType $type, |
19 | | - private ?string $name, |
20 | | - ?VariableSet $variables, |
21 | | - ?DirectiveSet $directives, |
22 | | - private FieldSet $children, |
| 15 | + public OperationType $type, |
| 16 | + public FieldSet $children, |
| 17 | + public ?string $name = null, |
| 18 | + public VariableSet $variables = new VariableSet(), |
| 19 | + public DirectiveSet $directives = new DirectiveSet(), |
23 | 20 | ) |
24 | 21 | { |
25 | | - $this->variables = $variables |
26 | | - ?? new VariableSet(); |
27 | | - $this->directives = $directives |
28 | | - ?? new DirectiveSet(); |
29 | | - } |
30 | | - |
31 | | - public function getType() : OperationType |
32 | | - { |
33 | | - return $this->type; |
34 | | - } |
35 | | - |
36 | | - public function getName() : ?string |
37 | | - { |
38 | | - return $this->name; |
39 | | - } |
40 | | - |
41 | | - public function getFields() : FieldSet |
42 | | - { |
43 | | - return $this->children; |
44 | | - } |
45 | | - |
46 | | - public function getVariables() : VariableSet |
47 | | - { |
48 | | - return $this->variables; |
49 | | - } |
50 | | - |
51 | | - public function getDirectives() : DirectiveSet |
52 | | - { |
53 | | - return $this->directives; |
54 | 22 | } |
55 | 23 | } |
0 commit comments