From 6d09c3c7949c21789f50fdcb06422235d45fa42c Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Wed, 8 Jun 2022 16:00:06 -0400 Subject: [PATCH] Remove nonsensical taint analysis rule --- .../Expression/AssignmentAnalyzer.php | 37 ++----------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php index 805ced5e1..46e6a14dd 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php @@ -776,24 +776,11 @@ class AssignmentAnalyzer ): void { $parent_nodes = $type->parent_nodes; - $unspecialized_parent_nodes = array_filter( - $parent_nodes, - static fn($parent_node): bool => !$parent_node->specialization_key - ); + $new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location); + $data_flow_graph->addNode($new_parent_node); + $new_parent_nodes = [$new_parent_node->id => $new_parent_node]; - $specialized_parent_nodes = array_filter( - $parent_nodes, - static fn($parent_node): bool => (bool) $parent_node->specialization_key - ); - - $new_parent_nodes = []; - - foreach ($specialized_parent_nodes as $parent_node) { - $new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location); - $new_parent_node->specialization_key = $parent_node->specialization_key; - - $data_flow_graph->addNode($new_parent_node); - $new_parent_nodes += [$new_parent_node->id => $new_parent_node]; + foreach ($parent_nodes as $parent_node) { $data_flow_graph->addPath( $parent_node, $new_parent_node, @@ -803,22 +790,6 @@ class AssignmentAnalyzer ); } - if ($unspecialized_parent_nodes) { - $new_parent_node = DataFlowNode::getForAssignment($var_id, $var_location); - $data_flow_graph->addNode($new_parent_node); - $new_parent_nodes += [$new_parent_node->id => $new_parent_node]; - - foreach ($unspecialized_parent_nodes as $parent_node) { - $data_flow_graph->addPath( - $parent_node, - $new_parent_node, - '=', - $added_taints, - $removed_taints - ); - } - } - $type->parent_nodes = $new_parent_nodes; }