mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 01:37:23 +01:00
fix build
This commit is contained in:
parent
9264ea5cbb
commit
7308c86bb2
@ -32,6 +32,10 @@ use function strtolower;
|
||||
*/
|
||||
class ClassConstFetchAnalyzer
|
||||
{
|
||||
/**
|
||||
* @psalm-suppress ComplexMethod to be refactored. We should probably regroup the two big if about $stmt->class and
|
||||
* analyse the ::class int $stmt->name separately
|
||||
*/
|
||||
public static function analyze(
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
PhpParser\Node\Expr\ClassConstFetch $stmt,
|
||||
@ -475,9 +479,7 @@ class ClassConstFetchAnalyzer
|
||||
$statements_analyzer,
|
||||
$stmt->class,
|
||||
$fq_class_name,
|
||||
$context->calling_method_id,
|
||||
false,
|
||||
false
|
||||
$context->calling_method_id
|
||||
);
|
||||
}
|
||||
|
||||
@ -485,41 +487,6 @@ class ClassConstFetchAnalyzer
|
||||
$fq_class_name = $codebase->classlikes->getUnAliasedName($fq_class_name);
|
||||
}
|
||||
|
||||
if ($stmt->name instanceof PhpParser\Node\Identifier && $stmt->name->name === 'class') {
|
||||
if ($codebase->classlikes->classExists($fq_class_name)) {
|
||||
$const_class_storage = $codebase->classlike_storage_provider->get($fq_class_name);
|
||||
$fq_class_name = $const_class_storage->name;
|
||||
|
||||
if ($const_class_storage->deprecated && $fq_class_name !== $context->self) {
|
||||
if (IssueBuffer::accepts(
|
||||
new DeprecatedClass(
|
||||
'Class ' . $fq_class_name . ' is deprecated',
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt),
|
||||
$fq_class_name
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
// fall through
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$statements_analyzer->node_data->setType($stmt, Type::getLiteralClassString($fq_class_name));
|
||||
|
||||
if ($codebase->store_node_types
|
||||
&& !$context->collect_initializations
|
||||
&& !$context->collect_mutations
|
||||
) {
|
||||
$codebase->analyzer->addNodeReference(
|
||||
$statements_analyzer->getFilePath(),
|
||||
$stmt->class,
|
||||
$fq_class_name
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// if we're ignoring that the class doesn't exist, exit anyway
|
||||
if (!$codebase->classlikes->classOrInterfaceOrEnumExists($fq_class_name)) {
|
||||
$statements_analyzer->node_data->setType($stmt, Type::getMixed());
|
||||
|
Loading…
Reference in New Issue
Block a user