Skip to content

Commit 05e43db

Browse files
committed
Add regression test phpstan#130
1 parent 0beb5f6 commit 05e43db

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/Type/WebMozartAssert/ImpossibleCheckTypeMethodCallRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ protected function getRule(): Rule
1717
return self::getContainer()->getByType(ImpossibleCheckTypeStaticMethodCallRule::class);
1818
}
1919

20+
public function testBug130(): void
21+
{
22+
$this->analyse([__DIR__ . '/data/bug-130.php'], []);
23+
}
24+
2025
public function testExtension(): void
2126
{
2227
$this->analyse([__DIR__ . '/data/impossible-check.php'], [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace PHPStan\Type\WebMozartAssert;
4+
5+
use Webmozart\Assert\Assert;
6+
7+
class Bug130
8+
{
9+
/** @var array<int, array{id: string, num_order: string}> */
10+
protected $orders = [];
11+
12+
public function setOrders(array $orders): self
13+
{
14+
Assert::allCount($orders, 2);
15+
Assert::allKeyExists($orders, 'id');
16+
Assert::allKeyExists($orders, 'num_order');
17+
18+
$this->orders = $orders;
19+
20+
return $this;
21+
}
22+
}

0 commit comments

Comments
 (0)