diff --git a/composer.json b/composer.json index c6e7eb1..915c2c2 100644 --- a/composer.json +++ b/composer.json @@ -21,19 +21,19 @@ }, "require": { "php": "^8.1", - "thecodingmachine/graphqlite": "^v6.2.1", - "illuminate/console": "^9 || ^10 | ^11", - "illuminate/container": "^9 || ^10 | ^11", - "illuminate/support": "^9 || ^10 | ^11", - "illuminate/cache": "^9 || ^10 | ^11", - "symfony/psr-http-message-bridge": "^1.3.0 || ^2 || ^6", - "laminas/laminas-diactoros": "^2.2.2", + "thecodingmachine/graphqlite": "^v8.1.0", + "illuminate/console": "^9 || ^10 | ^11 | ^12", + "illuminate/container": "^9 || ^10 | ^11 | ^12", + "illuminate/support": "^9 || ^10 | ^11 | ^12", + "illuminate/cache": "^9 || ^10 | ^11 | ^12", + "symfony/psr-http-message-bridge": "^1.3.0 || ^2 || ^6 || ^7", + "laminas/laminas-diactoros": "3.8.0", "symfony/cache": "^4.3 || ^5 || ^6", "psr/container": "^2.0.2" }, "require-dev": { "orchestra/testbench": "^7 || ^8", - "phpunit/phpunit": "^9.6.6 || ^10.0.19", + "phpunit/phpunit": "^9.6.6 || ^10.0.19 || ^11", "ext-sqlite3": "*" }, "autoload": { diff --git a/src/Mappers/PaginatorTypeMapper.php b/src/Mappers/PaginatorTypeMapper.php index e110a77..b242c5f 100644 --- a/src/Mappers/PaginatorTypeMapper.php +++ b/src/Mappers/PaginatorTypeMapper.php @@ -104,54 +104,54 @@ private function getObjectType(bool $countable, OutputType $subType): MutableInt 'firstItem' => [ 'type' => Type::int(), 'description' => 'Get the "index" of the first item being paginated.', - 'resolve' => static function (Paginator $root): int { + 'resolve' => static function (Paginator $root): ?int { return $root->firstItem(); }, ], 'lastItem' => [ 'type' => Type::int(), 'description' => 'Get the "index" of the last item being paginated.', - 'resolve' => static function (Paginator $root): int { + 'resolve' => static function (Paginator $root): ?int { return $root->lastItem(); }, ], 'hasMorePages' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if there are more items in the data source.', 'resolve' => static function (Paginator $root): bool { return $root->hasMorePages(); }, ], 'perPage' => [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Get the number of items shown per page.', 'resolve' => static function (Paginator $root): int { return $root->perPage(); }, ], 'hasPages' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if there are enough items to split into multiple pages.', 'resolve' => static function (Paginator $root): bool { return $root->hasPages(); }, ], 'currentPage' => [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Determine the current page being paginated.', 'resolve' => static function (Paginator $root): int { return $root->currentPage(); }, ], 'isEmpty' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if the list of items is empty or not.', 'resolve' => static function (Paginator $root): bool { return $root->isEmpty(); }, ], 'isNotEmpty' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if the list of items is not empty.', 'resolve' => static function (Paginator $root): bool { return $root->isNotEmpty(); @@ -161,13 +161,13 @@ private function getObjectType(bool $countable, OutputType $subType): MutableInt if ($countable) { $fields['totalCount'] = [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'The total count of items.', 'resolve' => static function (LengthAwarePaginator $root): int { return $root->total(); }]; $fields['lastPage'] = [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Get the page number of the last available page.', 'resolve' => static function (LengthAwarePaginator $root): int { return $root->lastPage();