mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
update define types to be correct
This commit is contained in:
parent
982f95c87e
commit
4f25ccee40
@ -1552,7 +1552,7 @@ return [
|
||||
'decbin' => ['string', 'num'=>'int'],
|
||||
'dechex' => ['string', 'num'=>'int'],
|
||||
'decoct' => ['string', 'num'=>'int'],
|
||||
'define' => ['bool', 'constant_name'=>'string', 'value'=>'mixed', 'case_insensitive='=>'bool'],
|
||||
'define' => ['bool', 'constant_name'=>'string', 'value'=>'array|scalar|null', 'case_insensitive='=>'false'],
|
||||
'define_syslog_variables' => ['void'],
|
||||
'defined' => ['bool', 'constant_name'=>'string'],
|
||||
'deflate_add' => ['string|false', 'context'=>'DeflateContext', 'data'=>'string', 'flush_mode='=>'int'],
|
||||
|
@ -64,6 +64,10 @@ return [
|
||||
'old' => ['int', 'scale'=>'int'],
|
||||
'new' => ['int', 'scale='=>'int'],
|
||||
],
|
||||
'define' => [
|
||||
'old' => ['bool', 'constant_name'=>'string', 'value'=>'array|scalar|null', 'case_insensitive='=>'bool'],
|
||||
'new' => ['bool', 'constant_name'=>'string', 'value'=>'array|scalar|null', 'case_insensitive='=>'false'],
|
||||
],
|
||||
'ldap_compare' => [
|
||||
'old' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string'],
|
||||
'new' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'array'],
|
||||
|
@ -9937,7 +9937,7 @@ return [
|
||||
'decbin' => ['string', 'num'=>'int'],
|
||||
'dechex' => ['string', 'num'=>'int'],
|
||||
'decoct' => ['string', 'num'=>'int'],
|
||||
'define' => ['bool', 'constant_name'=>'string', 'value'=>'mixed', 'case_insensitive='=>'bool'],
|
||||
'define' => ['bool', 'constant_name'=>'string', 'value'=>'array|scalar|null', 'case_insensitive='=>'bool'],
|
||||
'define_syslog_variables' => ['void'],
|
||||
'defined' => ['bool', 'constant_name'=>'string'],
|
||||
'deflate_add' => ['string|false', 'context'=>'resource', 'data'=>'string', 'flush_mode='=>'int'],
|
||||
|
@ -225,7 +225,38 @@ final class NamedFunctionCallHandler
|
||||
}
|
||||
|
||||
if ($function_id === 'defined') {
|
||||
$context->check_consts = false;
|
||||
if ($first_arg && !$context->inside_negation) {
|
||||
$fq_const_name = ConstFetchAnalyzer::getConstName(
|
||||
$first_arg->value,
|
||||
$statements_analyzer->node_data,
|
||||
$codebase,
|
||||
$statements_analyzer->getAliases(),
|
||||
);
|
||||
|
||||
if ($fq_const_name !== null) {
|
||||
$const_type = ConstFetchAnalyzer::getConstType(
|
||||
$statements_analyzer,
|
||||
$fq_const_name,
|
||||
true,
|
||||
$context,
|
||||
);
|
||||
|
||||
if (!$const_type) {
|
||||
ConstFetchAnalyzer::setConstType(
|
||||
$statements_analyzer,
|
||||
$fq_const_name,
|
||||
Type::getMixed(),
|
||||
$context,
|
||||
);
|
||||
|
||||
$context->check_consts = false;
|
||||
}
|
||||
} else {
|
||||
$context->check_consts = false;
|
||||
}
|
||||
} else {
|
||||
$context->check_consts = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user