Skip to content

Commit 0754f5b

Browse files
Add non regression test for #5206
1 parent 1198173 commit 0754f5b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,17 @@ public function testNever(): void
311311
$this->analyse([__DIR__ . '/data/arrow-function-never.php'], $errors);
312312
}
313313

314+
public function testBug5206(): void
315+
{
316+
$errors = [];
317+
if (PHP_VERSION_ID < 80000) {
318+
$errors[] = [
319+
'Parameter $mixed of anonymous function has invalid type Bug5206\mixed.',
320+
9,
321+
];
322+
}
323+
324+
$this->analyse([__DIR__ . '/data/bug-5206.php'], $errors);
325+
}
326+
314327
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug5206;
4+
5+
class HelloWorld
6+
{
7+
public function sayHello(): \Closure
8+
{
9+
return fn (mixed $mixed) => '`mixed` type!';
10+
}
11+
}

0 commit comments

Comments
 (0)