mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #2440 - add support for uasort
This commit is contained in:
parent
d6a731be73
commit
432c291dd7
@ -166,6 +166,19 @@ function usort(array &$arr, callable $callback): bool
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @template TKey
|
||||
* @template T
|
||||
*
|
||||
* @param array<TKey,T> $arr
|
||||
* @param callable(T,T):int $callback
|
||||
* @param-out array<TKey,T> $arr
|
||||
* @psalm-pure
|
||||
*/
|
||||
function uasort(array &$arr, callable $callback): bool
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-template T
|
||||
*
|
||||
|
@ -550,18 +550,15 @@ class FunctionCallTest extends TestCase
|
||||
],
|
||||
'uasort' => [
|
||||
'<?php
|
||||
$manifest = ["a" => 1, "b" => 2];
|
||||
uasort(
|
||||
$manifest,
|
||||
function ($a, $b) {
|
||||
return strcmp($a["parent"],$b["parent"]);
|
||||
}
|
||||
$manifest,
|
||||
function (int $a, int $b) {
|
||||
return $a > $b ? 1 : -1;
|
||||
}
|
||||
);',
|
||||
'assertions' => [],
|
||||
'error_levels' => [
|
||||
'MixedArrayAccess',
|
||||
'MixedArgument',
|
||||
'MissingClosureParamType',
|
||||
'MissingClosureReturnType',
|
||||
'assertions' => [
|
||||
'$manifest' => 'array<string, int>'
|
||||
],
|
||||
],
|
||||
'byRefAfterCallable' => [
|
||||
|
Loading…
x
Reference in New Issue
Block a user