1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix issues found with Vimeo’s code

This commit is contained in:
Brown 2020-05-10 21:09:48 -04:00
parent f3a6e1a48c
commit 48da7a4be8
3 changed files with 16 additions and 3 deletions

View File

@ -588,7 +588,13 @@ class AssignmentAnalyzer
&& !$assign_value_type->hasArrayAccessInterface($codebase)
) {
if ($assign_value_type->hasArray()) {
if (IssueBuffer::accepts(
if (($assign_value_atomic_type instanceof Type\Atomic\TFalse
&& $assign_value_type->ignore_falsable_issues)
|| ($assign_value_atomic_type instanceof Type\Atomic\TNull
&& $assign_value_type->ignore_nullable_issues)
) {
// do nothing
} elseif (IssueBuffer::accepts(
new PossiblyInvalidArrayAccess(
'Cannot access array value on non-array variable '
. $array_var_id . ' of type ' . $assign_value_atomic_type->getId(),

View File

@ -2783,6 +2783,10 @@ class CallAnalyzer
$codebase->analyzer->incrementNonMixedCount($statements_analyzer->getFilePath());
}
if ($function_param->by_ref) {
$param_type->possibly_undefined = true;
}
$param_type = TypeAnalyzer::simplifyUnionType(
$codebase,
$param_type
@ -3810,7 +3814,10 @@ class CallAnalyzer
$codebase = $statements_analyzer->getCodebase();
if ($first_appearance && $context->vars_in_scope[$var_id]->hasMixed()) {
if ($first_appearance
&& isset($context->vars_in_scope[$var_id])
&& $context->vars_in_scope[$var_id]->hasMixed()
) {
if (!$context->collect_initializations
&& !$context->collect_mutations
&& $statements_analyzer->getFilePath() === $statements_analyzer->getRootFilePath()

View File

@ -616,7 +616,7 @@ class PropertyFetchAnalyzer
continue;
}
if ($interface_exists) {
if (!$class_exists) {
$property_id = $lhs_type_part->value . '::$' . $prop_name;
if (IssueBuffer::accepts(