From 1e8f986d8cc8efd2d2839558c73fa6ff03d47939 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sun, 11 Dec 2016 13:59:36 -0500 Subject: [PATCH] Narrow down error lines for reconcileKeyedTypes --- src/Psalm/Checker/Statements/Block/IfChecker.php | 10 +++++----- src/Psalm/Checker/Statements/Block/WhileChecker.php | 2 +- src/Psalm/Checker/Statements/ExpressionChecker.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Psalm/Checker/Statements/Block/IfChecker.php b/src/Psalm/Checker/Statements/Block/IfChecker.php index b07a25ad893..c746b07aa0b 100644 --- a/src/Psalm/Checker/Statements/Block/IfChecker.php +++ b/src/Psalm/Checker/Statements/Block/IfChecker.php @@ -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() ); @@ -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() ); @@ -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() ); @@ -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() ); @@ -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() ); diff --git a/src/Psalm/Checker/Statements/Block/WhileChecker.php b/src/Psalm/Checker/Statements/Block/WhileChecker.php index 16eb2d51a24..00507c9206f 100644 --- a/src/Psalm/Checker/Statements/Block/WhileChecker.php +++ b/src/Psalm/Checker/Statements/Block/WhileChecker.php @@ -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() ); diff --git a/src/Psalm/Checker/Statements/ExpressionChecker.php b/src/Psalm/Checker/Statements/ExpressionChecker.php index d1659f01629..ed93f011d00 100644 --- a/src/Psalm/Checker/Statements/ExpressionChecker.php +++ b/src/Psalm/Checker/Statements/ExpressionChecker.php @@ -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() ); @@ -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() );