Skip to content

Commit

Permalink
Add regression test for phpstan/phpstan#3312
Browse files Browse the repository at this point in the history
  • Loading branch information
takaram committed Jan 27, 2024
1 parent ca920eb commit c2e62bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Expand Up @@ -1420,6 +1420,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10264.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/conditional-vars.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/sort.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3312.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5961.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10189.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10317.php');
Expand Down
12 changes: 12 additions & 0 deletions tests/PHPStan/Analyser/data/bug-3312.php
@@ -0,0 +1,12 @@
<?php declare(strict_types=1);

namespace Bug3312;

use function PHPStan\Testing\assertType;

function sayHello(): void
{
$arr = ['one' => 'een', 'two' => 'twee', 'three' => 'drie'];
usort($arr, 'strcmp');
assertType("non-empty-list<'drie'|'een'|'twee'>", $arr);
}

0 comments on commit c2e62bd

Please sign in to comment.