Skip to content

Commit c6704ad

Browse files
committed
Added regression tests
1 parent 98bb0a9 commit c6704ad

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,4 +2711,16 @@ public function testBug14012(): void
27112711
$this->analyse([__DIR__ . '/../Properties/data/bug-14012.php'], []);
27122712
}
27132713

2714+
public function testBug11534(): void
2715+
{
2716+
$this->checkExplicitMixed = true;
2717+
$this->checkImplicitMixed = true;
2718+
$this->analyse([__DIR__ . '/data/bug-11534.php'], [
2719+
[
2720+
'Parameter #2 $param2 of function Bug11534\hello expects int, mixed given.',
2721+
14
2722+
]
2723+
]);
2724+
}
2725+
27142726
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Bug11534;
4+
5+
function hello(int $param1, int $param2): void
6+
{
7+
}
8+
/** @param mixed[] $params */
9+
function world(array $params): void
10+
{
11+
if (!is_int($params['param1'])) {
12+
throw new \Exception();
13+
}
14+
hello($params['param1'], $params['param2']);
15+
}

0 commit comments

Comments
 (0)