Skip to content

Commit 138c4a4

Browse files
authored
Add regression test for anonymous class in trait
1 parent daf7d55 commit 138c4a4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Diff for: tests/PHPStan/Rules/Methods/MissingMethodParameterTypehintRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,9 @@ public function testBug3723(): void
116116
$this->analyse([__DIR__ . '/data/bug-3723.php'], []);
117117
}
118118

119+
public function testBug6472(): void
120+
{
121+
$this->analyse([__DIR__ . '/data/bug-6472.php'], []);
122+
}
123+
119124
}

Diff for: tests/PHPStan/Rules/Methods/data/bug-6472.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Bug6472;
4+
5+
trait A
6+
{
7+
/**
8+
* @param mixed[] $array
9+
*/
10+
public static function a(array $array): void
11+
{
12+
new class {
13+
14+
};
15+
}
16+
17+
/**
18+
* @param mixed[] $array
19+
*/
20+
public static function b(array $array): void
21+
{
22+
}
23+
24+
}
25+
26+
class B
27+
{
28+
use A;
29+
}

0 commit comments

Comments
 (0)