Skip to content

Commit 2f8bbbd

Browse files
committed
Minor optimization
1 parent 91be05c commit 2f8bbbd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/StaticAnalysis/ExecutableLinesFindingVisitor.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*/
1010
namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
1111

12-
use function array_unique;
13-
use function sort;
1412
use PhpParser\Node;
1513
use PhpParser\Node\Expr\BinaryOp;
1614
use PhpParser\Node\Expr\CallLike;
@@ -44,7 +42,7 @@
4442
final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
4543
{
4644
/**
47-
* @psalm-var list<int>
45+
* @psalm-var array<int, int>
4846
*/
4947
private $executableLines = [];
5048

@@ -67,19 +65,15 @@ public function enterNode(Node $node): void
6765
return;
6866
}
6967

70-
$this->executableLines[] = $line;
68+
$this->executableLines[$line] = $line;
7169
}
7270

7371
/**
74-
* @psalm-return list<int>
72+
* @psalm-return array<int, int>
7573
*/
7674
public function executableLines(): array
7775
{
78-
$executableLines = array_unique($this->executableLines);
79-
80-
sort($executableLines);
81-
82-
return $executableLines;
76+
return $this->executableLines;
8377
}
8478

8579
private function savePropertyLines(Node $node): void

0 commit comments

Comments
 (0)