Skip to content

Commit

Permalink
fix: remove duplicate match without line number
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Dec 27, 2020
1 parent c2ccd43 commit 8f92e21
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,22 @@ public function scanFile($info)
];
}

return $patternFound;
// Remove duplicated without line number
$result = $patternFound;
foreach ($patternFound as $itemKey => $item) {
foreach ($patternFound as $key => $value) {
if ($item['match'] === $value['match'] &&
$item['type'] === $value['type'] &&
$item['key'] === $value['key'] &&
empty($item['line']) &&
!empty($value['line'])
) {
unset($result[$itemKey]);
}
}
}

return $result;
}

/**
Expand Down

0 comments on commit 8f92e21

Please sign in to comment.