1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Jerowork\GraphqlAttributeSchema\NodeParser; |
6
|
|
|
|
7
|
|
|
use Exception; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @internal |
11
|
|
|
*/ |
12
|
|
|
final class ParseException extends Exception |
13
|
|
|
{ |
14
|
3 |
|
public static function invalidReturnType(string $class, string $method): self |
15
|
|
|
{ |
16
|
3 |
|
return new self(sprintf('Invalid return type %s:%s', $class, $method)); |
17
|
|
|
} |
18
|
|
|
|
19
|
3 |
|
public static function invalidConnectionReturnType(string $class, string $method): self |
20
|
|
|
{ |
21
|
3 |
|
return new self(sprintf('Invalid return type for connection %s:%s', $class, $method)); |
22
|
|
|
} |
23
|
|
|
|
24
|
1 |
|
public static function invalidParameterType(string $parameter): self |
25
|
|
|
{ |
26
|
1 |
|
return new self(sprintf('Invalid arg parameter type for parameter %s', $parameter)); |
27
|
|
|
} |
28
|
|
|
|
29
|
1 |
|
public static function invalidAutowiredParameterType(string $parameter): self |
30
|
|
|
{ |
31
|
1 |
|
return new self(sprintf('Invalid autowired parameter type for parameter %s', $parameter)); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public static function invalidPropertyType(string $class, string $property): self |
35
|
|
|
{ |
36
|
|
|
return new self(sprintf('Invalid property type for class %s:%s', $class, $property)); |
37
|
|
|
} |
38
|
|
|
|
39
|
2 |
|
public static function invalidConnectionPropertyType(string $class, string $property): self |
40
|
|
|
{ |
41
|
2 |
|
return new self(sprintf('Invalid property type for connection for class %s:%s', $class, $property)); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public static function invalidNameForResolver(string $name): self |
45
|
|
|
{ |
46
|
|
|
return new self(sprintf('Invalid characters in resolver name: %s', $name)); |
47
|
|
|
} |
48
|
|
|
|
49
|
1 |
|
public static function invalidNameForType(string $name): self |
50
|
|
|
{ |
51
|
1 |
|
return new self(sprintf('Invalid characters in type name: %s', $name)); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public static function missingMethodInClass(string $class): self |
55
|
|
|
{ |
56
|
|
|
return new self(sprintf('Missing method in class: %s', $class)); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public static function tooManyMethodsInClass(string $class): self |
60
|
|
|
{ |
61
|
|
|
return new self(sprintf('Too many methods in class: %s', $class)); |
62
|
|
|
} |
63
|
|
|
|
64
|
1 |
|
public static function notAnEnumClass(string $class): self |
65
|
|
|
{ |
66
|
1 |
|
return new self(sprintf('Class %s is not an enum class', $class)); |
67
|
|
|
} |
68
|
|
|
|
69
|
1 |
|
public static function notABackedEnumClass(string $class): self |
70
|
|
|
{ |
71
|
1 |
|
return new self(sprintf('Enum %s is not a BackedEnum', $class)); |
72
|
|
|
} |
73
|
|
|
|
74
|
8 |
|
public static function missingAttribute(string $reflector, string $attribute): self |
75
|
|
|
{ |
76
|
8 |
|
return new self(sprintf('Missing attribute %s on %s', $attribute, $reflector)); |
77
|
|
|
} |
78
|
|
|
|
79
|
1 |
|
public static function missingExtends(string $class, string $extends): self |
80
|
|
|
{ |
81
|
1 |
|
return new self(sprintf('Class %s does not extend %s', $class, $extends)); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public static function invalidListTypeConfiguration(string $type): self |
85
|
|
|
{ |
86
|
|
|
return new self(sprintf('Invalid list type configuration, %s cannot be a list type', $type)); |
87
|
|
|
} |
88
|
|
|
|
89
|
1 |
|
public static function multipleCursorsFound(string $class): self |
90
|
|
|
{ |
91
|
1 |
|
return new self(sprintf('Multiple cursors found for class: %s', $class)); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|