Skip to content

Commit 6308420

Browse files
Add test
1 parent 235c090 commit 6308420

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/PHPStan/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRuleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ public function testBug13642(): void
104104
{
105105
$this->missingCheckedExceptionInThrows = false;
106106
$this->checkedExceptionClasses = [ValueError::class];
107-
$this->analyse([__DIR__ . '/data/bug-13642.php'], []);
107+
$this->analyse([__DIR__ . '/data/bug-13642.php'], [
108+
[
109+
'Method Bug13642\HelloWorld::sayHello2() throws exception ValueError but the PHPDoc contains @throws void.',
110+
21,
111+
],
112+
]);
108113
}
109114

110115
#[RequiresPhp('>= 8.0')]

tests/PHPStan/Rules/Exceptions/data/bug-13642.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@ public function sayHello(): void
99
{
1010
array_combine([1, 2], [1, 2]);
1111
}
12+
13+
/**
14+
* @param mixed $mixed1
15+
* @param mixed $mixed2
16+
*
17+
* @throws void
18+
*/
19+
public function sayHello2($mixed1, $mixed2): void
20+
{
21+
array_combine($mixed1, $mixed2);
22+
}
1223
}

0 commit comments

Comments
 (0)