1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Allow completion from functions to work without namespacing cc @iluuu1994

This commit is contained in:
Matthew Brown 2019-07-18 21:50:59 -04:00
parent 3df248eea2
commit 0e6bd79a09
2 changed files with 14 additions and 14 deletions

View File

@ -237,17 +237,6 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
strtolower($function_id)
);
if (!$context->collect_initializations
&& !$context->collect_mutations
) {
ArgumentMapPopulator::recordArgumentPositions(
$statements_analyzer,
$stmt,
$codebase,
$function_id
);
}
if (!$namespaced_function_exists
&& !$stmt->name instanceof PhpParser\Node\Name\FullyQualified
) {
@ -266,6 +255,18 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
$function_exists = true;
}
if ($function_exists
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
ArgumentMapPopulator::recordArgumentPositions(
$statements_analyzer,
$stmt,
$codebase,
$function_id
);
}
$is_predefined = true;
$is_maybe_root_function = !$stmt->name instanceof PhpParser\Node\Name\FullyQualified

View File

@ -329,6 +329,7 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase
[new Position(10, 40), 'B\A::staticfoo', 0],
[new Position(12, 28), 'B\foo', 0],
[new Position(14, 30), 'B\A::__construct', 0],
[new Position(16, 31), 'strlen', 0],
];
}
@ -362,9 +363,7 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase
new A();
// Blocked by https://github.com/nikic/PHP-Parser/issues/616
//$this->foo(, "Bar");
//$this->foo(,,);
strlen();
}
public function bar(string $a) {}