mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #2847 - use fully-qualified function name
This commit is contained in:
parent
ae08552f40
commit
f4485cc529
@ -321,7 +321,10 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
|
||||
}
|
||||
} elseif ($this->function instanceof Function_) {
|
||||
$cased_method_id = $this->function->name->name;
|
||||
$context->calling_function_id = strtolower($cased_method_id);
|
||||
$namespace_prefix = $this->getNamespace();
|
||||
$context->calling_function_id = strtolower(
|
||||
($namespace_prefix !== null ? $namespace_prefix . '\\' : '') . $cased_method_id
|
||||
);
|
||||
} else { // Closure
|
||||
if ($storage->return_type) {
|
||||
$closure_return_type = ExpressionAnalyzer::fleshOutType(
|
||||
|
@ -969,6 +969,42 @@ class FunctionTemplateTest extends TestCase
|
||||
echo (string) $key;
|
||||
}'
|
||||
],
|
||||
'uksortNoNamespace' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
*
|
||||
* @param array<Tk, Tv> $result
|
||||
* @param (callable(Tk, Tk): int) $comparator
|
||||
*
|
||||
* @preturn array<Tk, Tv>
|
||||
*/
|
||||
function sort_by_key(array $result, callable $comparator): array
|
||||
{
|
||||
\uksort($result, $comparator);
|
||||
return $result;
|
||||
}'
|
||||
],
|
||||
'uksortNamespaced' => [
|
||||
'<?php
|
||||
namespace Psl\Arr;
|
||||
|
||||
/**
|
||||
* @template Tk of array-key
|
||||
* @template Tv
|
||||
*
|
||||
* @param array<Tk, Tv> $result
|
||||
* @param (callable(Tk, Tk): int) $comparator
|
||||
*
|
||||
* @preturn array<Tk, Tv>
|
||||
*/
|
||||
function sort_by_key(array $result, callable $comparator): array
|
||||
{
|
||||
\uksort($result, $comparator);
|
||||
return $result;
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user