mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Still look at param defaults even without param types
This commit is contained in:
parent
3c3c8cd3b9
commit
4660beb28e
@ -588,10 +588,6 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
|
||||
];
|
||||
}
|
||||
|
||||
if (!$function_param->type_location || !$function_param->location) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-suppress MixedArrayAccess
|
||||
*
|
||||
@ -599,6 +595,14 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
|
||||
*/
|
||||
$parser_param = $this->function->getParams()[$offset];
|
||||
|
||||
if (!$function_param->type_location || !$function_param->location) {
|
||||
if ($parser_param->default) {
|
||||
ExpressionAnalyzer::analyze($statements_analyzer, $parser_param->default, $context);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($signature_type) {
|
||||
if (!TypeAnalyzer::isContainedBy(
|
||||
$codebase,
|
||||
|
@ -120,6 +120,12 @@ class IssueSuppressionTest extends TestCase
|
||||
new C();',
|
||||
'error_message' => 'UndefinedClass - src' . DIRECTORY_SEPARATOR . 'somefile.php:6:25 - Class or interface C',
|
||||
],
|
||||
'missingParamTypeShouldntPreventUndefinedClassError' => [
|
||||
'<?php
|
||||
/** @psalm-suppress MissingParamType */
|
||||
function foo($s = Foo::BAR) : void {}',
|
||||
'error_message' => 'UndefinedClass',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user