mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix errors
This commit is contained in:
parent
cd23a19931
commit
14ee221075
@ -607,6 +607,7 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
|
||||
return false;
|
||||
}
|
||||
} elseif ($function->parts === ['define']) {
|
||||
if ($first_arg) {
|
||||
$const_name = StatementsAnalyzer::getConstName($first_arg->value);
|
||||
|
||||
if ($const_name !== null) {
|
||||
@ -615,9 +616,12 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
|
||||
|
||||
$statements_analyzer->setConstType(
|
||||
$const_name,
|
||||
isset($second_arg->value->inferredType) ? $second_arg->value->inferredType : Type::getMixed(),
|
||||
isset($second_arg->value->inferredType) ?
|
||||
$second_arg->value->inferredType :
|
||||
Type::getMixed(),
|
||||
$context
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$context->check_consts = false;
|
||||
}
|
||||
|
@ -1467,7 +1467,7 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $first_arg_value
|
||||
* @param PhpParser\Node\Expr $first_arg_value
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
|
@ -588,8 +588,9 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
if ($function_id === 'define') {
|
||||
$first_arg_value = isset($node->args[0]) ? $node->args[0]->value : null;
|
||||
$second_arg_value = isset($node->args[1]) ? $node->args[1]->value : null;
|
||||
if ($first_arg_value && $second_arg_value) {
|
||||
$const_name = StatementsAnalyzer::getConstName($first_arg_value);
|
||||
if ($const_name !== null && $second_arg_value) {
|
||||
if ($const_name !== null) {
|
||||
$const_type = StatementsAnalyzer::getSimpleType(
|
||||
$this->codebase,
|
||||
$second_arg_value,
|
||||
@ -605,6 +606,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mapping_function_ids = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user