Skip to content

Commit

Permalink
test passing a class-string errors
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab committed Sep 5, 2022
1 parent f8757ab commit ce84362
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,12 @@ public function testBug7156(): void

public function testBug7823(): void
{
$this->analyse([__DIR__ . '/data/bug-7823.php'], []);
$this->analyse([__DIR__ . '/data/bug-7823.php'], [
[
'Parameter #1 $s of function Bug7823\sayHello expects literal-string, class-string given.',
34,
],
]);
}

}
8 changes: 8 additions & 0 deletions tests/PHPStan/Rules/Functions/data/bug-7823.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ function x($t): void
assertType('class-string<T of Bug7823\A (function Bug7823\x(), argument)>&literal-string', $t::class);
sayHello($t::class);
}

/**
* @param class-string $t
*/
function y($t): void
{
sayHello($t);
}

0 comments on commit ce84362

Please sign in to comment.