Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require-dev": {
"beberlei/porpaginas": "^2.0",
"doctrine/coding-standard": "^13.0",
"doctrine/coding-standard": "^13.0 || ^14.0",
"ecodev/graphql-upload": "^7.0",
"laminas/laminas-diactoros": "^3.5",
"php-coveralls/php-coveralls": "^2.7",
Expand Down
21 changes: 8 additions & 13 deletions src/Types/MutableInputObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GraphQL\Error\InvariantViolation;
use GraphQL\Type\Definition\InputObjectField;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\InputType;
use GraphQL\Type\Definition\Type;
use RuntimeException;

Expand All @@ -18,7 +19,6 @@
* It can be later extended with the "Decorate" annotation
*
* @phpstan-import-type InputObjectConfig from InputObjectType
* @phpstan-import-type ArgumentType from InputObjectField
* @phpstan-import-type InputObjectFieldConfig from InputObjectField
*/
class MutableInputObjectType extends InputObjectType implements MutableInputInterface
Expand Down Expand Up @@ -90,21 +90,16 @@ public function getFields(): array
$this->finalFields = parent::getFields();
foreach ($this->fieldsCallables as $fieldsCallable) {
$fieldDefinitions = $fieldsCallable();
/** @var (ArgumentType)[] $fieldDefinitions */
foreach ($fieldDefinitions as $name => $fieldDefinition) {
assert(is_string($name));
if ($fieldDefinition instanceof Type) {
$fieldDefinition = ['type' => $fieldDefinition];
assert($fieldDefinition instanceof InputType);
$this->finalFields[$name] = new InputObjectField(['name' => $name, 'type' => $fieldDefinition]);
} else {
/** @phpstan-var InputObjectFieldConfig $fieldDefinition */
$fieldDefinition['name'] = $name;
$this->finalFields[$name] = new InputObjectField($fieldDefinition);
}
assert(is_string($name));
// @codingStandardsIgnoreStart
/**
* @var InputObjectFieldConfig $config
*/
// @codingStandardsIgnoreEnd

$config = $fieldDefinition;
$config['name'] = $name;
$this->finalFields[$name] = new InputObjectField($config);
}
}
if (empty($this->finalFields)) {
Expand Down
Loading