Skip to content
Permalink
Browse files

Fix #2440 - add support for uasort

  • Loading branch information
muglug committed Dec 9, 2019
1 parent d6a731b commit 432c291dd756060253b918f28404a52d6366308b
Showing with 20 additions and 10 deletions.
  1. +13 −0 src/Psalm/Internal/Stubs/CoreGenericFunctions.php
  2. +7 −10 tests/FunctionCallTest.php
@@ -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 B extends A {
],
'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' => [

0 comments on commit 432c291

Please sign in to comment.
You can’t perform that action at this time.