Skip to content

Commit eaa2a24

Browse files
committed
Refactor ArrayInputTest to add type annotations for array parameters and improve documentation
1 parent e69bc94 commit eaa2a24

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ final class UserInput
137137

138138
final class UserListController
139139
{
140+
/**
141+
* @param list<UserInput> $users
142+
*/
140143
public function updateUsers(
141144
#[Input(item: UserInput::class)] array $users // Array of UserInput objects
142145
) {
@@ -145,6 +148,9 @@ final class UserListController
145148
}
146149
}
147150

151+
/**
152+
* @param ArrayObject<int, UserInput> $users
153+
*/
148154
public function processUsers(
149155
#[Input(item: UserInput::class)] ArrayObject $users // ArrayObject collection
150156
) {
@@ -212,6 +218,10 @@ $data = [
212218
];
213219

214220
// In your controller
221+
/**
222+
* @param list<string> $hobbies
223+
* @param list<string> $categories
224+
*/
215225
public function updatePreferences(
216226
#[Input] array $hobbies, // Simple string array
217227
#[Input] array $categories // Simple string array
@@ -240,6 +250,9 @@ final class UserCollection extends ArrayObject
240250
}
241251
}
242252

253+
/**
254+
* @param array<UserInput> $users
255+
*/
243256
public function handleUsers(
244257
#[Input(item: UserInput::class)] UserCollection $users
245258
) {

0 commit comments

Comments
 (0)