Skip to content

Commit

Permalink
Narrow down error lines for reconcileKeyedTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Dec 11, 2016
1 parent 562f71b commit 1e8f986
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/Psalm/Checker/Statements/Block/IfChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static function check(
TypeChecker::reconcileKeyedTypes(
$reconcilable_if_types,
$if_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->cond),
$statements_checker->getSuppressedIssues()
);

Expand All @@ -139,7 +139,7 @@ public static function check(
$else_vars_reconciled = TypeChecker::reconcileKeyedTypes(
$if_scope->negated_types,
$temp_else_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->cond),
$statements_checker->getSuppressedIssues()
);

Expand Down Expand Up @@ -283,7 +283,7 @@ protected static function checkIfBlock(
$outer_context_vars_reconciled = TypeChecker::reconcileKeyedTypes(
$if_scope->negated_types,
$outer_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->cond),
$statements_checker->getSuppressedIssues()
);

Expand Down Expand Up @@ -351,7 +351,7 @@ protected static function checkElseIfBlock(
$elseif_vars_reconciled = TypeChecker::reconcileKeyedTypes(
$if_scope->negated_types,
$elseif_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $elseif),
new CodeLocation($statements_checker->getSource(), $elseif->cond),
$statements_checker->getSuppressedIssues()
);

Expand Down Expand Up @@ -416,7 +416,7 @@ protected static function checkElseIfBlock(
$elseif_vars_reconciled = TypeChecker::reconcileKeyedTypes(
$reconcilable_elseif_types,
$elseif_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $elseif),
new CodeLocation($statements_checker->getSource(), $elseif->cond),
$statements_checker->getSuppressedIssues()
);

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Checker/Statements/Block/WhileChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function check(
$while_vars_in_scope_reconciled = TypeChecker::reconcileKeyedTypes(
$while_types,
$while_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->cond),
$statements_checker->getSuppressedIssues()
);

Expand Down
4 changes: 2 additions & 2 deletions src/Psalm/Checker/Statements/ExpressionChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ protected static function checkTernary(
$t_if_vars_in_scope_reconciled = TypeChecker::reconcileKeyedTypes(
$reconcilable_if_types,
$t_if_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->cond),
$statements_checker->getSuppressedIssues()
);

Expand All @@ -1207,7 +1207,7 @@ protected static function checkTernary(
$t_else_vars_in_scope_reconciled = TypeChecker::reconcileKeyedTypes(
$negated_if_types,
$t_else_context->vars_in_scope,
new CodeLocation($statements_checker->getSource(), $stmt),
new CodeLocation($statements_checker->getSource(), $stmt->else),
$statements_checker->getSuppressedIssues()
);

Expand Down

0 comments on commit 1e8f986

Please sign in to comment.