|
222 | 222 | 'globe' => Type::nonNull( Type::string() ), |
223 | 223 | ], |
224 | 224 | 'resolveField' => function ( Statement|PropertyValuePair $valueProvider, $args, $context, ResolveInfo $info ) { |
225 | | - /** @var GlobeCoordinateValue $globeCoordinateValue */ |
226 | | - $globeCoordinateValue = $valueProvider->value->content; |
227 | | - '@phan-var GlobeCoordinateValue $globeCoordinateValue'; |
228 | | - |
229 | | - return match ( $info->fieldName ) { |
230 | | - 'latitude' => $globeCoordinateValue->getLatitude(), |
231 | | - 'longitude' => $globeCoordinateValue->getLongitude(), |
232 | | - 'precision' => $globeCoordinateValue->getPrecision(), |
233 | | - 'globe' => $globeCoordinateValue->getGlobe(), |
234 | | - default => null, |
235 | | - }; |
| 225 | + return $valueProvider->value->content |
| 226 | + ->getArrayValue()[$info->fieldName] ?? null; |
236 | 227 | }, |
237 | 228 | ] ); |
238 | 229 | }, |
|
271 | 262 | 'text' => Type::nonNull( Type::string() ), |
272 | 263 | ], |
273 | 264 | 'resolveField' => function ( Statement|PropertyValuePair $valueProvider, $args, $context, ResolveInfo $info ) { |
274 | | - /** @var MonolingualTextValue $value */ |
275 | | - $value = $valueProvider->value->content; |
276 | | - '@phan-var MonolingualTextValue $value'; |
277 | | - |
278 | | - return match ( $info->fieldName ) { |
279 | | - 'language' => $value->getLanguageCode(), |
280 | | - 'text' => $value->getText(), |
281 | | - default => null, |
282 | | - }; |
| 265 | + return $valueProvider->value->content |
| 266 | + ->getArrayValue()[$info->fieldName] ?? null; |
283 | 267 | }, |
284 | 268 | ] ); |
285 | 269 | }, |
|
0 commit comments