diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 2c21243..9645207 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -12,5 +12,9 @@
src
tests
-
+
+
+
+
+
diff --git a/src/Builder/EnumBuilder.php b/src/Builder/EnumBuilder.php
index d812def..5e75e2e 100644
--- a/src/Builder/EnumBuilder.php
+++ b/src/Builder/EnumBuilder.php
@@ -41,9 +41,6 @@ public function addValue(string $value, ?string $name = null, ?string $descripti
return $this;
}
- /**
- * @return mixed[]
- */
public function build(): array
{
$parameters = parent::build();
diff --git a/src/Builder/FieldBuilder.php b/src/Builder/FieldBuilder.php
index 6ea1d47..c5ff49f 100644
--- a/src/Builder/FieldBuilder.php
+++ b/src/Builder/FieldBuilder.php
@@ -81,7 +81,7 @@ public function setDeprecationReason(string $reason): self
}
/**
- * @return mixed[]
+ * @return array
*/
public function build(): array
{
diff --git a/src/Builder/InterfaceBuilder.php b/src/Builder/InterfaceBuilder.php
index e4ad649..b15e293 100644
--- a/src/Builder/InterfaceBuilder.php
+++ b/src/Builder/InterfaceBuilder.php
@@ -19,9 +19,6 @@ public function setResolveType(callable $resolveType): self
return $this;
}
- /**
- * @return mixed[]
- */
public function build(): array
{
$parameters = parent::build();
diff --git a/src/Builder/ObjectBuilder.php b/src/Builder/ObjectBuilder.php
index 2f29638..57de763 100644
--- a/src/Builder/ObjectBuilder.php
+++ b/src/Builder/ObjectBuilder.php
@@ -4,6 +4,7 @@
namespace SimPod\GraphQLUtils\Builder;
+use GraphQL\Type\Definition\FieldDefinition;
use GraphQL\Type\Definition\InterfaceType;
use GraphQL\Type\Definition\ResolveInfo;
@@ -12,7 +13,7 @@ class ObjectBuilder extends TypeBuilder
/** @var InterfaceType[] */
private array $interfaces = [];
- /** @var callable|mixed[][] */
+ /** @var callable():array>|array> */
private $fields = [];
/** @var callable(mixed, array, mixed, ResolveInfo) : mixed|null */
@@ -37,7 +38,7 @@ public function addInterface(InterfaceType $interfaceType): self
}
/**
- * @param callable|mixed[][] $fields
+ * @param callable():array>|array> $fields
*
* @return static
*/
@@ -60,9 +61,6 @@ public function setFieldResolver(callable $fieldResolver): self
return $this;
}
- /**
- * @return mixed[]
- */
public function build(): array
{
$parameters = parent::build();
diff --git a/src/Builder/TypeBuilder.php b/src/Builder/TypeBuilder.php
index 09b4a6f..21e1c2b 100644
--- a/src/Builder/TypeBuilder.php
+++ b/src/Builder/TypeBuilder.php
@@ -36,7 +36,7 @@ public function setDescription(string $description): self
}
/**
- * @return mixed[]
+ * @return array
*/
public function build(): array
{
diff --git a/src/Builder/UnionBuilder.php b/src/Builder/UnionBuilder.php
index e89f8b5..620c141 100644
--- a/src/Builder/UnionBuilder.php
+++ b/src/Builder/UnionBuilder.php
@@ -49,9 +49,6 @@ public function setTypes(array $types): self
return $this;
}
- /**
- * @return mixed[]
- */
public function build(): array
{
$parameters = parent::build();
diff --git a/tests/Builder/ObjectBuilderTest.php b/tests/Builder/ObjectBuilderTest.php
index 8f66c3a..cfccef9 100644
--- a/tests/Builder/ObjectBuilderTest.php
+++ b/tests/Builder/ObjectBuilderTest.php
@@ -4,6 +4,7 @@
namespace SimPod\GraphQLUtils\Tests\Builder;
+use GraphQL\Type\Definition\FieldDefinition;
use GraphQL\Type\Definition\InterfaceType;
use GraphQL\Type\Definition\Type;
use PHPUnit\Framework\TestCase;
@@ -35,6 +36,7 @@ public function __construct()
->setFields(
[
FieldBuilder::create('SomeField', Type::string())->build(),
+ FieldDefinition::create(FieldBuilder::create('Another', Type::string())->build()),
]
)
->setFieldResolver($fieldResolver)
@@ -45,7 +47,7 @@ public function __construct()
self::assertArrayHasKey('fields', $object);
self::assertIsArray($object['fields']);
self::assertSame($fieldResolver, $object['resolveField']);
- self::assertCount(1, $object['fields']);
+ self::assertCount(2, $object['fields']);
}
public function testInvalidName(): void