Skip to content

Commit 9fc6582

Browse files
committed
simplify
1 parent 548bcae commit 9fc6582

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/StaticAnalysis/ExecutableLinesFindingVisitor.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ public function executableLines(): array
108108

109109
private function savePropertyLines(Node $node): void
110110
{
111-
if (!$node instanceof Property && !$node instanceof Node\Stmt\ClassConst) {
112-
return;
113-
}
114-
115-
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
116-
$this->propertyLines[$index] = $index;
111+
if ($node instanceof Property) {
112+
foreach (range($node->getStartLine(), $node->getEndLine()) as $index) {
113+
$this->propertyLines[$index] = $index;
114+
}
117115
}
118116
}
119117

@@ -126,10 +124,10 @@ private function computeReturns(): void
126124
}
127125
}
128126

129-
$line = $return->getEndLine();
130-
131127
if ($return->expr !== null) {
132128
$line = $this->getNodeStartLine($return->expr);
129+
} else {
130+
$line = $return->getEndLine();
133131
}
134132

135133
$this->executableLines[$line] = $line;
@@ -249,10 +247,7 @@ private function getLines(Node $node): array
249247

250248
private function getNodeStartLine(NodeAbstract $node): int
251249
{
252-
if ($node instanceof Node\Expr\BooleanNot ||
253-
$node instanceof Node\Expr\AssignOp\ShiftLeft ||
254-
$node instanceof Node\Expr\AssignOp\ShiftRight
255-
) {
250+
if ($node instanceof Node\Expr\BooleanNot) {
256251
return $node->getEndLine();
257252
}
258253

0 commit comments

Comments
 (0)