Skip to content

Commit 312ea63

Browse files
authored
Fix PHPStan and PHPCS issues in MutableInputObjectType: use @phpstan-var to satisfy both tools
1 parent f492b9b commit 312ea63

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/Types/MutableInputObjectType.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* It can be later extended with the "Decorate" annotation
1919
*
2020
* @phpstan-import-type InputObjectConfig from InputObjectType
21-
* @phpstan-import-type ArgumentType from InputObjectField
21+
* @phpstan-import-type InputObjectFieldConfig from InputObjectField
2222
*/
2323
class MutableInputObjectType extends InputObjectType implements MutableInputInterface
2424
{
@@ -89,14 +89,15 @@ public function getFields(): array
8989
$this->finalFields = parent::getFields();
9090
foreach ($this->fieldsCallables as $fieldsCallable) {
9191
$fieldDefinitions = $fieldsCallable();
92-
/** @var (ArgumentType)[] $fieldDefinitions */
9392
foreach ($fieldDefinitions as $name => $fieldDefinition) {
93+
assert(is_string($name));
9494
if ($fieldDefinition instanceof Type) {
95-
$fieldDefinition = ['type' => $fieldDefinition];
95+
$this->finalFields[$name] = new InputObjectField(['name' => $name, 'type' => $fieldDefinition]);
96+
} else {
97+
/** @phpstan-var InputObjectFieldConfig $fieldDefinition */
98+
$fieldDefinition['name'] = $name;
99+
$this->finalFields[$name] = new InputObjectField($fieldDefinition);
96100
}
97-
assert(is_string($name));
98-
$fieldDefinition['name'] = $name;
99-
$this->finalFields[$name] = new InputObjectField($fieldDefinition);
100101
}
101102
}
102103
if (empty($this->finalFields)) {

0 commit comments

Comments
 (0)