mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Don’t complain when rescanning file with function in
This commit is contained in:
parent
214fd7d461
commit
a6357b413c
@ -221,13 +221,13 @@ class MethodCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
case Type\Atomic\TNumericString::class:
|
||||
case Type\Atomic\THtmlEscapedString::class:
|
||||
case Type\Atomic\TClassString::class:
|
||||
case Type\Atomic\TEmptyMixed::class:
|
||||
case Type\Atomic\TIterable::class:
|
||||
case Type\Atomic\TGenericIterable::class:
|
||||
$invalid_method_call_types[] = (string)$lhs_type_part;
|
||||
break;
|
||||
|
||||
case Type\Atomic\TGenericParam::class:
|
||||
case Type\Atomic\TEmptyMixed::class:
|
||||
case Type\Atomic\TMixed::class:
|
||||
case Type\Atomic\TNonEmptyMixed::class:
|
||||
case Type\Atomic\TObject::class:
|
||||
|
@ -883,13 +883,26 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
|
||||
return $this->file_storage->functions[$function_id];
|
||||
} elseif (isset($this->config->getPredefinedFunctions()[$function_id])) {
|
||||
if (IssueBuffer::accepts(
|
||||
new DuplicateFunction(
|
||||
'Method ' . $function_id . ' has already been defined as a core function',
|
||||
new CodeLocation($this->file_scanner, $stmt, null, true)
|
||||
)
|
||||
)) {
|
||||
// fall through
|
||||
$duplicate_function_storage = null;
|
||||
|
||||
try {
|
||||
$duplicate_function_storage = $this->codebase->functions->getStorage(null, $function_id);
|
||||
} catch (\Exception $e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
if (!$duplicate_function_storage
|
||||
|| !$duplicate_function_storage->location
|
||||
|| $duplicate_function_storage->location->file_path !== $this->file_path
|
||||
) {
|
||||
if (IssueBuffer::accepts(
|
||||
new DuplicateFunction(
|
||||
'Method ' . $function_id . ' has already been defined as a core function',
|
||||
new CodeLocation($this->file_scanner, $stmt, null, true)
|
||||
)
|
||||
)) {
|
||||
// fall through
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user