1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #7054 from orklah/6933

fix missing case for displaying varId
This commit is contained in:
orklah 2021-12-09 23:54:37 +01:00 committed by GitHub
commit ae765dfba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -217,6 +217,10 @@ class ExpressionIdentifier
}
}
if ($stmt instanceof PhpParser\Node\Expr\ConstFetch) {
return implode('\\', $stmt->name->parts);
}
return self::getVarId($stmt, $this_class_name, $source);
}
}

View File

@ -4,6 +4,7 @@ namespace Psalm\Type;
use InvalidArgumentException;
use Psalm\CodeLocation;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\Statements\Expression\Fetch\ConstFetchAnalyzer;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Codebase\TaintFlowGraph;
use Psalm\Internal\Codebase\VariableUseGraph;
@ -553,7 +554,13 @@ class Reconciler
$key_parts = self::breakUpPathIntoParts($key);
if (count($key_parts) === 1) {
return isset($existing_keys[$key_parts[0]]) ? clone $existing_keys[$key_parts[0]] : null;
if (isset($existing_keys[$key_parts[0]])) {
return clone $existing_keys[$key_parts[0]];
}
if ($type = ConstFetchAnalyzer::getGlobalConstType($codebase, $key_parts[0], $key_parts[0])) {
return $type;
}
}
$base_key = array_shift($key_parts);