Skip to content

Commit f51f89a

Browse files
committed
Ensure correct type when counting LIST items
1 parent 10ad39e commit f51f89a

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/Generator/Client.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,11 @@ private static function callOperation(Routers $routers, Representation\Operation
904904
static fn (Expr $expr): Node\Stmt\Expression => new Node\Stmt\Expression(
905905
new Node\Expr\Assign(
906906
new Expr\Variable('items'),
907-
$expr,
907+
new Expr\Array_([
908+
new Expr\ArrayItem(value: $expr, unpack: true),
909+
], [
910+
'kind' => Node\Expr\Array_::KIND_SHORT,
911+
]),
908912
),
909913
),
910914
),

tests/app/etc/openapi-client-generator.state

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@
216216
},
217217
{
218218
"name": ".\/tests\/app\/src\/\/Router\/List\/Pets.php",
219-
"hash": "2275eaa5b79fe7e404e44307c7bd611e"
219+
"hash": "b6c6f9ea32f2797e49f62da95b2aa273"
220220
},
221221
{
222222
"name": ".\/tests\/app\/src\/\/Router\/List\/PetsList.php",
223-
"hash": "24686950c441b8eda04aebbe3b2ffd24"
223+
"hash": "ba00aad83ddbfccd10c10038ca0ecebd"
224224
},
225225
{
226226
"name": ".\/tests\/app\/src\/\/Router\/Post\/Pets.php",

tests/app/src/Router/List/Pets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function listListing(array $params) : iterable
3737
$arguments['page'] = 1;
3838
do {
3939
$operator = new Operator\Pets\ListListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Pets());
40-
$items = $operator->call($arguments['per_page'], $arguments['page']);
40+
$items = [...$operator->call($arguments['per_page'], $arguments['page'])];
4141
yield from $items;
4242
$arguments['page']++;
4343
} while (count($items) > 0);
@@ -61,7 +61,7 @@ public function namesListing(array $params) : iterable
6161
$arguments['page'] = 1;
6262
do {
6363
$operator = new Operator\Pets\NamesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Pets🌀Names());
64-
$items = $operator->call($arguments['per_page'], $arguments['page']);
64+
$items = [...$operator->call($arguments['per_page'], $arguments['page'])];
6565
yield from $items;
6666
$arguments['page']++;
6767
} while (count($items) > 0);

tests/app/src/Router/List/PetsList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function gatosListing(array $params) : iterable
3737
$arguments['page'] = 1;
3838
do {
3939
$operator = new Operator\Pets\List_\GatosListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Pets🌀Gatos());
40-
$items = $operator->call($arguments['per_page'], $arguments['page']);
40+
$items = [...$operator->call($arguments['per_page'], $arguments['page'])];
4141
yield from $items;
4242
$arguments['page']++;
4343
} while (count($items) > 0);

0 commit comments

Comments
 (0)