mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Add test for mismatch param type from docblock
This commit is contained in:
parent
63a1c71c83
commit
3d212c642c
@ -1318,6 +1318,42 @@ class CallableTest extends TestCase
|
||||
c("hii");',
|
||||
'error_message' => 'InvalidArgument',
|
||||
],
|
||||
'mismatchParamTypeFromDocblock' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template A
|
||||
*/
|
||||
final class ArrayList
|
||||
{
|
||||
/**
|
||||
* @template B
|
||||
* @param Closure(A): B $effect
|
||||
* @return ArrayList<B>
|
||||
*/
|
||||
public function map(Closure $effect): ArrayList
|
||||
{
|
||||
throw new RuntimeException("???");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template B
|
||||
*
|
||||
* @param ArrayList<T> $list
|
||||
* @return ArrayList<array{T}>
|
||||
*/
|
||||
function genericContext(ArrayList $list): ArrayList
|
||||
{
|
||||
return $list->map(
|
||||
/** @param B $_a */
|
||||
function ($_a) {
|
||||
return [$_a];
|
||||
}
|
||||
);
|
||||
}',
|
||||
'error_message' => 'InvalidArgument',
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user