Skip to content

Commit c882fd4

Browse files
committed
Fix types for Paginator
1 parent 067a746 commit c882fd4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Mappers/PaginatorTypeMapper.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,54 +104,54 @@ private function getObjectType(bool $countable, OutputType $subType): MutableInt
104104
'firstItem' => [
105105
'type' => Type::int(),
106106
'description' => 'Get the "index" of the first item being paginated.',
107-
'resolve' => static function (Paginator $root): int {
107+
'resolve' => static function (Paginator $root): ?int {
108108
return $root->firstItem();
109109
},
110110
],
111111
'lastItem' => [
112112
'type' => Type::int(),
113113
'description' => 'Get the "index" of the last item being paginated.',
114-
'resolve' => static function (Paginator $root): int {
114+
'resolve' => static function (Paginator $root): ?int {
115115
return $root->lastItem();
116116
},
117117
],
118118
'hasMorePages' => [
119-
'type' => Type::boolean(),
119+
'type' => Type::nonNull(Type::boolean()),
120120
'description' => 'Determine if there are more items in the data source.',
121121
'resolve' => static function (Paginator $root): bool {
122122
return $root->hasMorePages();
123123
},
124124
],
125125
'perPage' => [
126-
'type' => Type::int(),
126+
'type' => Type::nonNull(Type::int()),
127127
'description' => 'Get the number of items shown per page.',
128128
'resolve' => static function (Paginator $root): int {
129129
return $root->perPage();
130130
},
131131
],
132132
'hasPages' => [
133-
'type' => Type::boolean(),
133+
'type' => Type::nonNull(Type::boolean()),
134134
'description' => 'Determine if there are enough items to split into multiple pages.',
135135
'resolve' => static function (Paginator $root): bool {
136136
return $root->hasPages();
137137
},
138138
],
139139
'currentPage' => [
140-
'type' => Type::int(),
140+
'type' => Type::nonNull(Type::int()),
141141
'description' => 'Determine the current page being paginated.',
142142
'resolve' => static function (Paginator $root): int {
143143
return $root->currentPage();
144144
},
145145
],
146146
'isEmpty' => [
147-
'type' => Type::boolean(),
147+
'type' => Type::nonNull(Type::boolean()),
148148
'description' => 'Determine if the list of items is empty or not.',
149149
'resolve' => static function (Paginator $root): bool {
150150
return $root->isEmpty();
151151
},
152152
],
153153
'isNotEmpty' => [
154-
'type' => Type::boolean(),
154+
'type' => Type::nonNull(Type::boolean()),
155155
'description' => 'Determine if the list of items is not empty.',
156156
'resolve' => static function (Paginator $root): bool {
157157
return $root->isNotEmpty();

0 commit comments

Comments
 (0)