Skip to content

Commit fbb26ce

Browse files
committed
Make class Printer fully static
1 parent 7d55c2c commit fbb26ce

File tree

14 files changed

+182
-148
lines changed

14 files changed

+182
-148
lines changed

docs/class-reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,8 @@ $printed = GraphQL\Language\Printer::doPrint($ast);
12601260
*
12611261
* Handles both executable definitions and schema definitions.
12621262
*
1263+
* @throws \JsonException
1264+
*
12631265
* @api
12641266
*/
12651267
static function doPrint(GraphQL\Language\AST\Node $ast): string

src/Language/Printer.php

Lines changed: 134 additions & 145 deletions
Large diffs are not rendered by default.

src/Type/Definition/BooleanType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function parseValue($value): bool
3636
throw new Error("Boolean cannot represent a non boolean value: {$notBoolean}");
3737
}
3838

39+
/**
40+
* @throws \JsonException
41+
* @throws Error
42+
*/
3943
public function parseLiteral(Node $valueNode, ?array $variables = null): bool
4044
{
4145
if ($valueNode instanceof BooleanValueNode) {

src/Type/Definition/EnumType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public function parseValue($value)
190190
}
191191

192192
/**
193+
* @throws \JsonException
193194
* @throws Error
194195
* @throws InvariantViolation
195196
*/

src/Type/Definition/FloatType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function parseValue($value): float
4949
return $float;
5050
}
5151

52+
/**
53+
* @throws \JsonException
54+
* @throws Error
55+
*/
5256
public function parseLiteral(Node $valueNode, ?array $variables = null)
5357
{
5458
if ($valueNode instanceof FloatValueNode || $valueNode instanceof IntValueNode) {

src/Type/Definition/IDType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function parseValue($value): string
4747
throw new Error("ID cannot represent a non-string and non-integer value: {$notID}");
4848
}
4949

50+
/**
51+
* @throws \JsonException
52+
* @throws Error
53+
*/
5054
public function parseLiteral(Node $valueNode, ?array $variables = null): string
5155
{
5256
if ($valueNode instanceof StringValueNode || $valueNode instanceof IntValueNode) {

src/Type/Definition/IntType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public function parseValue($value): int
6969
return (int) $value;
7070
}
7171

72+
/**
73+
* @throws \JsonException
74+
* @throws Error
75+
*/
7276
public function parseLiteral(Node $valueNode, ?array $variables = null): int
7377
{
7478
if ($valueNode instanceof IntValueNode) {

src/Type/Definition/StringType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function parseValue($value): string
4444
return $value;
4545
}
4646

47+
/**
48+
* @throws \JsonException
49+
* @throws Error
50+
*/
4751
public function parseLiteral(Node $valueNode, ?array $variables = null): string
4852
{
4953
if ($valueNode instanceof StringValueNode) {

src/Validator/Rules/OverlappingFieldsCanBeMerged.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ protected function findConflict(
431431
/**
432432
* @param NodeList<ArgumentNode> $arguments1 keep
433433
* @param NodeList<ArgumentNode> $arguments2 keep
434+
*
435+
* @throws \JsonException
434436
*/
435437
protected function sameArguments(NodeList $arguments1, NodeList $arguments2): bool
436438
{
@@ -459,6 +461,7 @@ protected function sameArguments(NodeList $arguments1, NodeList $arguments2): bo
459461
return true;
460462
}
461463

464+
/** @throws \JsonException */
462465
protected function sameValue(Node $value1, Node $value2): bool
463466
{
464467
return Printer::doPrint($value1) === Printer::doPrint($value2);

src/Validator/Rules/ValuesOfCorrectType.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ public function getVisitor(QueryValidationContext $context): array
138138
];
139139
}
140140

141-
/** @param VariableNode|NullValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|EnumValueNode|ListValueNode|ObjectValueNode $node */
141+
/**
142+
* @param VariableNode|NullValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|EnumValueNode|ListValueNode|ObjectValueNode $node
143+
*
144+
* @throws \JsonException
145+
*/
142146
protected function isValidValueNode(QueryValidationContext $context, ValueNode $node): void
143147
{
144148
// Report any error at the full type expected by the location.

0 commit comments

Comments
 (0)