@@ -43,8 +43,8 @@ |
||
43 | 43 | protected function setArgs(array $arguments) |
44 | 44 | { |
45 | 45 | invariant( |
46 | - isAssocArray($arguments), |
|
47 | - 'Args must be an associative array with argument names as keys.' |
|
46 | + isAssocArray($arguments), |
|
47 | + 'Args must be an associative array with argument names as keys.' |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | foreach ($arguments as $argumentName => $argument) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * ]); |
34 | 34 | */ |
35 | 35 | class UnionType implements AbstractTypeInterface, NamedTypeInterface, CompositeTypeInterface, OutputTypeInterface, |
36 | - ConfigAwareInterface, NodeAwareInterface |
|
36 | + ConfigAwareInterface, NodeAwareInterface |
|
37 | 37 | { |
38 | 38 | |
39 | 39 | use ConfigAwareTrait; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $typeMap = resolveThunk($typesOrThunk); |
77 | 77 | |
78 | 78 | invariant( |
79 | - \is_array($typeMap), |
|
80 | - \sprintf( |
|
79 | + \is_array($typeMap), |
|
80 | + \sprintf( |
|
81 | 81 | 'Must provide Array of types or a function which returns such an array for Union %s.', |
82 | 82 | $this->getName() |
83 | - ) |
|
83 | + ) |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | return $typeMap; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * ]); |
26 | 26 | */ |
27 | 27 | class InterfaceType implements NamedTypeInterface, AbstractTypeInterface, CompositeTypeInterface, |
28 | - OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
28 | + OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
29 | 29 | { |
30 | 30 | |
31 | 31 | use ConfigAwareTrait; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * will be used as its internal value. |
36 | 36 | */ |
37 | 37 | class EnumType implements TypeInterface, NamedTypeInterface, InputTypeInterface, |
38 | - LeafTypeInterface, OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
38 | + LeafTypeInterface, OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
39 | 39 | { |
40 | 40 | |
41 | 41 | use ConfigAwareTrait; |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | protected function buildValues(array $valueMap): array |
120 | 120 | { |
121 | 121 | invariant( |
122 | - isAssocArray($valueMap), |
|
123 | - \sprintf('%s values must be an associative array with value names as keys.', |
|
122 | + isAssocArray($valueMap), |
|
123 | + \sprintf('%s values must be an associative array with value names as keys.', |
|
124 | 124 | $this->getName()) |
125 | 125 | ); |
126 | 126 | |
@@ -128,26 +128,26 @@ discard block |
||
128 | 128 | |
129 | 129 | foreach ($valueMap as $valueName => $valueConfig) { |
130 | 130 | invariant( |
131 | - isAssocArray($valueConfig), |
|
132 | - \sprintf( |
|
131 | + isAssocArray($valueConfig), |
|
132 | + \sprintf( |
|
133 | 133 | '%s.%s must refer to an object with a "value" key representing an internal value but got: %s', |
134 | 134 | $this->getName(), |
135 | 135 | $valueName, |
136 | 136 | toString($valueConfig) |
137 | - ) |
|
137 | + ) |
|
138 | 138 | ); |
139 | 139 | |
140 | 140 | invariant( |
141 | - !isset($valueConfig['isDeprecated']), |
|
142 | - \sprintf( |
|
141 | + !isset($valueConfig['isDeprecated']), |
|
142 | + \sprintf( |
|
143 | 143 | '%s.%s should provided "deprecationReason" instead of "isDeprecated".', |
144 | 144 | $this->getName(), |
145 | 145 | $valueName |
146 | - ) |
|
146 | + ) |
|
147 | 147 | ); |
148 | 148 | |
149 | 149 | $values[] = new EnumValue(\array_merge($valueConfig, |
150 | - ['name' => $valueName])); |
|
150 | + ['name' => $valueName])); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return $values; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * ]); |
51 | 51 | */ |
52 | 52 | class ObjectType implements TypeInterface, NamedTypeInterface, CompositeTypeInterface, OutputTypeInterface, |
53 | - ConfigAwareInterface, NodeAwareInterface |
|
53 | + ConfigAwareInterface, NodeAwareInterface |
|
54 | 54 | { |
55 | 55 | |
56 | 56 | use ConfigAwareTrait; |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | $interfaces = resolveThunk($interfacesOrThunk); |
129 | 129 | |
130 | 130 | invariant( |
131 | - \is_array($interfaces), |
|
132 | - \sprintf('%s interfaces must be an array or a function which returns an array.', |
|
131 | + \is_array($interfaces), |
|
132 | + \sprintf('%s interfaces must be an array or a function which returns an array.', |
|
133 | 133 | $this->getName()) |
134 | 134 | ); |
135 | 135 | |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | |
146 | 146 | if ($this->getIsTypeOf() !== null) { |
147 | 147 | invariant( |
148 | - \is_callable($this->getIsTypeOf()), |
|
149 | - \sprintf('%s must provide "isTypeOf" as a function.', |
|
148 | + \is_callable($this->getIsTypeOf()), |
|
149 | + \sprintf('%s must provide "isTypeOf" as a function.', |
|
150 | 150 | $this->getName()) |
151 | 151 | ); |
152 | 152 | } |
@@ -70,40 +70,40 @@ |
||
70 | 70 | $fields = resolveThunk($fieldsOrThunk); |
71 | 71 | |
72 | 72 | invariant( |
73 | - isAssocArray($fields), |
|
74 | - \sprintf( |
|
73 | + isAssocArray($fields), |
|
74 | + \sprintf( |
|
75 | 75 | '%s fields must be an associative array with field names as key or a callable which returns such an array.', |
76 | 76 | $this->getName() |
77 | - ) |
|
77 | + ) |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $fieldMap = []; |
81 | 81 | |
82 | 82 | foreach ($fields as $fieldName => $fieldConfig) { |
83 | 83 | invariant( |
84 | - \is_array($fieldConfig), |
|
85 | - \sprintf('%s.%s field config must be an array', $this->getName(), |
|
84 | + \is_array($fieldConfig), |
|
85 | + \sprintf('%s.%s field config must be an array', $this->getName(), |
|
86 | 86 | $fieldName) |
87 | 87 | ); |
88 | 88 | |
89 | 89 | invariant( |
90 | - !isset($fieldConfig['isDeprecated']), |
|
91 | - \sprintf( |
|
90 | + !isset($fieldConfig['isDeprecated']), |
|
91 | + \sprintf( |
|
92 | 92 | '%s.%s should provide "deprecationReason" instead of "isDeprecated".', |
93 | 93 | $this->getName(), |
94 | 94 | $fieldName |
95 | - ) |
|
95 | + ) |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | if (isset($fieldConfig['resolve'])) { |
99 | 99 | invariant( |
100 | - null === $fieldConfig['resolve'] || \is_callable($fieldConfig['resolve']), |
|
101 | - \sprintf( |
|
100 | + null === $fieldConfig['resolve'] || \is_callable($fieldConfig['resolve']), |
|
101 | + \sprintf( |
|
102 | 102 | '%s.%s field resolver must be a function if provided, but got: %s', |
103 | 103 | $this->getName(), |
104 | 104 | $fieldName, |
105 | 105 | toString($fieldConfig['resolve']) |
106 | - ) |
|
106 | + ) |
|
107 | 107 | ); |
108 | 108 | } |
109 | 109 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * ]); |
32 | 32 | */ |
33 | 33 | class InputObjectType implements TypeInterface, NamedTypeInterface, InputTypeInterface, ConfigAwareInterface, |
34 | - NodeAwareInterface |
|
34 | + NodeAwareInterface |
|
35 | 35 | { |
36 | 36 | |
37 | 37 | use ConfigAwareTrait; |
@@ -72,23 +72,23 @@ discard block |
||
72 | 72 | $fields = resolveThunk($fieldsOrThunk) ?? []; |
73 | 73 | |
74 | 74 | invariant( |
75 | - isAssocArray($fields), |
|
76 | - \sprintf( |
|
75 | + isAssocArray($fields), |
|
76 | + \sprintf( |
|
77 | 77 | '%s fields must be an associative array with field names as keys or a function which returns such an array.', |
78 | 78 | $this->getName() |
79 | - ) |
|
79 | + ) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $fieldMap = []; |
83 | 83 | |
84 | 84 | foreach ($fields as $fieldName => $fieldConfig) { |
85 | 85 | invariant( |
86 | - !isset($fieldConfig['resolve']), |
|
87 | - \sprintf( |
|
86 | + !isset($fieldConfig['resolve']), |
|
87 | + \sprintf( |
|
88 | 88 | '%s.%s field type has a resolve property, but Input Types cannot define resolvers.', |
89 | 89 | $this->getName(), |
90 | 90 | $fieldName |
91 | - ) |
|
91 | + ) |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | $fieldConfig['name'] = $fieldName; |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | if ($ofType instanceof NonNullType) { |
35 | 35 | throw new InvalidTypeException(\sprintf('Expected %s to be a GraphQL nullable type.', |
36 | - (string)$ofType)); |
|
36 | + (string)$ofType)); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $this->ofType = $ofType; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | use function Digia\GraphQL\Util\invariant; |
11 | 11 | |
12 | 12 | class ScalarType implements TypeInterface, NamedTypeInterface, LeafTypeInterface, InputTypeInterface, |
13 | - OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
13 | + OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface |
|
14 | 14 | { |
15 | 15 | |
16 | 16 | use ConfigAwareTrait; |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | protected function afterConfig(): void |
95 | 95 | { |
96 | 96 | invariant( |
97 | - \is_callable($this->serializeFunction), |
|
98 | - \sprintf( |
|
97 | + \is_callable($this->serializeFunction), |
|
98 | + \sprintf( |
|
99 | 99 | '%s must provide "serialize" function. If this custom Scalar ' . |
100 | 100 | 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' . |
101 | 101 | 'functions are also provided.', |
102 | 102 | $this->getName() |
103 | - ) |
|
103 | + ) |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | if (null !== $this->parseValueFunction || null !== $this->parseLiteralFunction) { |
107 | 107 | invariant( |
108 | - \is_callable($this->parseValueFunction) && \is_callable($this->parseLiteralFunction), |
|
109 | - \sprintf('%s must provide both "parseValue" and "parseLiteral" functions.', |
|
108 | + \is_callable($this->parseValueFunction) && \is_callable($this->parseLiteralFunction), |
|
109 | + \sprintf('%s must provide both "parseValue" and "parseLiteral" functions.', |
|
110 | 110 | $this->getName()) |
111 | 111 | ); |
112 | 112 | } |