Skip to content

Commit

Permalink
add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rajyan committed May 12, 2022
1 parent f2e511b commit 152694e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,9 @@ public function testBug7000(): void
]);
}

public function testBug6508(): void
{
$this->analyse([__DIR__ . '/data/bug-6508.php'], []);
}

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-6508.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Bug6508;

class Foo
{
/**
* @param array{
* type1?: array{bool: bool},
* type2?: array{bool: bool}
* } $types
* @param 'type1'|'type2' $type
*/
function test(array $types, string $type): void
{
if (isset($types[$type]) && $types[$type]['bool']) {}
}
}

0 comments on commit 152694e

Please sign in to comment.