Skip to content

Commit 23b1594

Browse files
committed
Drop PHP8.4 property hooks on Node interface
1 parent 4fc5bae commit 23b1594

File tree

10 files changed

+38
-9
lines changed

10 files changed

+38
-9
lines changed

src/Parser/Ast.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getNodesByType(string $type): array
3636
public function getNodeByTypeId(string $typeId): ?Node
3737
{
3838
foreach ($this->nodes as $node) {
39-
if ($node->typeId !== $typeId) {
39+
if ($node->getTypeId() !== $typeId) {
4040
continue;
4141
}
4242

src/Parser/Node/ArgNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ public function __construct(
1717
public bool $isRequired,
1818
public string $propertyName,
1919
) {}
20+
21+
public function getTypeId(): ?string
22+
{
23+
return $this->typeId;
24+
}
2025
}

src/Parser/Node/EnumNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public function __construct(
1616
public ?string $description,
1717
public array $cases,
1818
) {}
19+
20+
public function getTypeId(): string
21+
{
22+
return $this->typeId;
23+
}
1924
}

src/Parser/Node/FieldNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ public function __construct(
2121
public ?string $methodName,
2222
public ?string $propertyName,
2323
) {}
24+
25+
public function getTypeId(): ?string
26+
{
27+
return $this->typeId;
28+
}
2429
}

src/Parser/Node/InputTypeNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public function __construct(
1616
public ?string $description,
1717
public array $fieldNodes,
1818
) {}
19+
20+
public function getTypeId(): string
21+
{
22+
return $this->typeId;
23+
}
1924
}

src/Parser/Node/MutationNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ public function __construct(
2121
public bool $isRequired,
2222
public string $methodName,
2323
) {}
24+
25+
public function getTypeId(): string
26+
{
27+
return $this->typeId;
28+
}
2429
}

src/Parser/Node/Node.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,5 @@
66

77
interface Node
88
{
9-
public ?string $typeId {
10-
get;
11-
}
12-
13-
public string $name {
14-
get;
15-
}
9+
public function getTypeId(): ?string;
1610
}

src/Parser/Node/QueryNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ public function __construct(
2121
public bool $isRequired,
2222
public string $methodName,
2323
) {}
24+
25+
public function getTypeId(): string
26+
{
27+
return $this->typeId;
28+
}
2429
}

src/Parser/Node/TypeNode.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public function __construct(
1616
public ?string $description,
1717
public array $fieldNodes,
1818
) {}
19+
20+
public function getTypeId(): string
21+
{
22+
return $this->typeId;
23+
}
1924
}

src/TypeResolver/RootTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ public function resolveChild(ArgNode|FieldNode $child, array $args, Ast $ast): m
7474
));
7575
}
7676

77-
throw ResolveException::logicError(sprintf('Node %s cannot be handled', $node->name));
77+
throw ResolveException::logicError(sprintf('Node %s cannot be handled', $node->getTypeId()));
7878
}
7979
}

0 commit comments

Comments
 (0)