6 declare(strict_types=1);
36 $this->typeFactory = $typeFactory;
37 $this->scalarTypes = $scalarTypes;
51 return $this->processIsNullable($field, $this->processIsList($field, $object));
66 ) : \GraphQL\Type\Definition\Type {
68 $object = $this->scalarTypes->getScalarTypeInstance($field->
getTypeName());
70 return $this->processScalarIsNullable($field, $this->processScalarIsList($field, $object));
83 return $this->typeFactory->createNonNull($object);
95 private function processIsList(FieldInterface $field, TypeInterface $object =
null) : TypeInterface
97 if ($field->isList()) {
98 if ($field instanceof \
Magento\Framework\GraphQl\
Config\Element\Argument) {
99 if ($field->areItemsRequired()) {
100 $object = $this->typeFactory->createNonNull($object);
103 return $this->typeFactory->createList($object);
115 private function processScalarIsNullable(
116 FieldInterface $field,
117 \GraphQL\Type\Definition\Type $object =
null 118 ) : \GraphQL\Type\Definition\Type {
119 $object = $object ?: $this->scalarTypes->getScalarTypeInstance($field->getTypeName());
120 if ($field->isRequired()) {
121 return $this->scalarTypes->createNonNull($object);
133 private function processScalarIsList(
134 FieldInterface $field,
135 \GraphQL\Type\Definition\Type $object =
null 136 ) : \GraphQL\Type\Definition\Type {
137 $object = $object ?: $this->scalarTypes->getScalarTypeInstance($field->getTypeName());
138 if ($field->isList()) {
139 if ($field instanceof \
Magento\Framework\GraphQl\Config\Element\Argument) {
140 if ($field->areItemsRequired()) {
141 $object = $this->scalarTypes->createNonNull($object);
144 return $this->scalarTypes->createList($object);
processScalarWrappedType(FieldInterface $field, TypeInterface $object=null)
__construct(TypeFactory $typeFactory, ScalarTypes $scalarTypes)
processWrappedType(FieldInterface $field, TypeInterface $object=null)