Skip to content

Commit d5ec93e

Browse files
committed
Refactor ArrayInputTest to add type annotations for array parameters and improve documentation
1 parent 10756d1 commit d5ec93e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/ArrayInputTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public function testArrayOfInputObjects(): void
3333
];
3434

3535
$controller = new class {
36+
/**
37+
* @param array<mixed> $users
38+
* @param array<mixed>
39+
*
40+
* @return array<mixed>
41+
*/
3642
public function listUsers(
3743
#[Input(item: UserInputWithAttribute::class)]
3844
array $users,
@@ -94,6 +100,11 @@ public function testEmptyArray(): void
94100
$query = ['users' => []];
95101

96102
$controller = new class {
103+
/**
104+
* @param array<mixed> $users
105+
*
106+
* @return array<mixed>
107+
*/
97108
public function listUsers(
98109
#[Input(item: UserInputWithAttribute::class)]
99110
array $users,
@@ -113,6 +124,11 @@ public function testMissingArrayParameter(): void
113124
{
114125
$query = [];
115126

127+
/**
128+
* @param array<mixed> $users
129+
*
130+
* @return array<mixed>
131+
*/
116132
$controller = new class {
117133
public function listUsers(
118134
#[Input(item: UserInputWithAttribute::class)]
@@ -131,6 +147,11 @@ public function listUsers(
131147

132148
public function testNonArrayValueForArrayParameter(): void
133149
{
150+
/**
151+
* @param array<mixed> $users
152+
*
153+
* @return array<mixed>
154+
*/
134155
$query = ['users' => 'not-an-array'];
135156

136157
$controller = new class {
@@ -158,6 +179,11 @@ public function testArrayWithNonArrayElements(): void
158179
],
159180
];
160181

182+
/**
183+
* @param array<mixed> $users
184+
*
185+
* @return array<mixed>
186+
*/
161187
$controller = new class {
162188
public function listUsers(
163189
#[Input(item: UserInputWithAttribute::class)]
@@ -184,6 +210,11 @@ public function testCustomArrayObjectOfInputObjects(): void
184210
],
185211
];
186212

213+
/**
214+
* @param array<mixed> $users
215+
*
216+
* @return array<mixed>
217+
*/
187218
$controller = new class {
188219
public function listUsers(
189220
#[Input(item: UserInputWithAttribute::class)]

0 commit comments

Comments
 (0)