File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -220,12 +220,32 @@ function countCountable(CountableFoo $x, int $mode)
220
220
class CountWithOptionalKeys
221
221
{
222
222
/**
223
- * @param array{mixed}|array{ 0: mixed, 1?: string|null} $row
223
+ * @param array{0: mixed, 1?: string|null} $row
224
224
*/
225
225
protected function testOptionalKeys (array $ row ): void
226
226
{
227
+ if (count ($ row ) === 0 ) {
228
+ assertType ('*NEVER* ' , $ row );
229
+ } else {
230
+ assertType ('array{0: mixed, 1?: string|null} ' , $ row );
231
+ }
232
+
233
+ if (count ($ row ) === 1 ) {
234
+ assertType ('array{mixed} ' , $ row );
235
+ } else {
236
+ assertType ('array{0: mixed, 1?: string|null} ' , $ row );
237
+ }
238
+
227
239
if (count ($ row ) === 2 ) {
228
240
assertType ('array{mixed, string|null} ' , $ row );
241
+ } else {
242
+ assertType ('array{0: mixed, 1?: string|null} ' , $ row );
243
+ }
244
+
245
+ if (count ($ row ) === 3 ) {
246
+ assertType ('*NEVER* ' , $ row );
247
+ } else {
248
+ assertType ('array{0: mixed, 1?: string|null} ' , $ row );
229
249
}
230
250
}
231
251
You can’t perform that action at this time.
0 commit comments