Skip to content

Commit efde2ea

Browse files
committed
added failling test
1 parent 55773e6 commit efde2ea

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug11705;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
/**
8+
* @param array{'name':string,'owners':array<int,string>, 'optional'?: string} $theInput
9+
* @param array<int,string> $theTags
10+
*/
11+
function example(array $theInput, array $theTags): void
12+
{
13+
foreach ($theTags as $tag) {
14+
if (!array_key_exists($tag, $theInput)) {
15+
continue;
16+
}
17+
switch ($tag) {
18+
case 'name':
19+
assertType("'name'", $tag);
20+
assertType('string', $theInput[$tag]);
21+
if ($tag === 'name') {
22+
echo "Of course it is...";
23+
}
24+
assertType("'name'", $tag);
25+
assertType('string', $theInput[$tag]);
26+
break;
27+
default:
28+
// fall out
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)