Skip to content

Commit 3e298aa

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

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"Bash(composer install:*)",
66
"Bash(composer:*)",
77
"Bash(./vendor/bin/phpunit:*)",
8-
"Bash(./vendor/bin/phpmd:*)"
8+
"Bash(./vendor/bin/phpmd:*)",
9+
"Bash(vendor/bin/phpunit:*)",
10+
"Bash(XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --coverage-filter src/)"
911
],
1012
"deny": []
1113
}

tests/ArrayInputTest.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function testArrayOfInputObjects(): void
3535
$controller = new class {
3636
/**
3737
* @param array<mixed> $users
38-
* @param array<mixed>
3938
*
4039
* @return array<mixed>
4140
*/
@@ -124,12 +123,12 @@ public function testMissingArrayParameter(): void
124123
{
125124
$query = [];
126125

127-
/**
128-
* @param array<mixed> $users
129-
*
130-
* @return array<mixed>
131-
*/
132126
$controller = new class {
127+
/**
128+
* @param array<mixed> $users
129+
*
130+
* @return array<mixed>
131+
*/
133132
public function listUsers(
134133
#[Input(item: UserInputWithAttribute::class)]
135134
array $users,
@@ -155,6 +154,11 @@ public function testNonArrayValueForArrayParameter(): void
155154
$query = ['users' => 'not-an-array'];
156155

157156
$controller = new class {
157+
/**
158+
* @param array<mixed> $users
159+
*
160+
* @return array<mixed>
161+
*/
158162
public function listUsers(
159163
#[Input(item: UserInputWithAttribute::class)]
160164
array $users,
@@ -179,12 +183,12 @@ public function testArrayWithNonArrayElements(): void
179183
],
180184
];
181185

182-
/**
183-
* @param array<mixed> $users
184-
*
185-
* @return array<mixed>
186-
*/
187186
$controller = new class {
187+
/**
188+
* @param array<mixed> $users
189+
*
190+
* @return array<mixed>
191+
*/
188192
public function listUsers(
189193
#[Input(item: UserInputWithAttribute::class)]
190194
array $users,

0 commit comments

Comments
 (0)