Skip to content

Commit 29d7e08

Browse files
committed
Regression test
Ref phpstan/phpstan#3555
1 parent f7c6464 commit 29d7e08

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,4 +2103,17 @@ public function testLiteralString(): void
21032103
]);
21042104
}
21052105

2106+
public function testBug3555(): void
2107+
{
2108+
$this->checkThisOnly = false;
2109+
$this->checkNullables = true;
2110+
$this->checkUnionTypes = true;
2111+
$this->analyse([__DIR__ . '/data/bug-3555.php'], [
2112+
[
2113+
'Parameter #1 $arg of method Bug3555\Enum::run() expects 1|2|3|4|5|6|7|8|9, 100 given.',
2114+
28,
2115+
],
2116+
]);
2117+
}
2118+
21062119
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Bug3555;
4+
5+
6+
class Enum
7+
{
8+
const A = 1;
9+
const B = 2;
10+
const C = 3;
11+
const D = 4;
12+
const E = 5;
13+
const F = 6;
14+
const G = 7;
15+
const H = 8;
16+
const I = 9;
17+
18+
/**
19+
* @param Enum::* $arg
20+
*/
21+
public function run($arg): void
22+
{
23+
24+
}
25+
26+
public function doFoo()
27+
{
28+
$this->run(100);
29+
}
30+
31+
}

0 commit comments

Comments
 (0)