Skip to content

Commit c88d744

Browse files
committed
Fix default values for docStartLine and docEndLine to -1 when no docComment is present
1 parent 964477f commit c88d744

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/CodeVisitor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ private function processClass(Node\Stmt\Class_ $node)
102102
// Get class docblock
103103
$docComment = $node->getDocComment();
104104
$docString = $docComment ? $docComment->getText() : '';
105-
$docStartLine = $docComment ? $docComment->getStartLine() : $classStartLine;
106-
$docEndLine = $docComment ? $docComment->getEndLine() : $classStartLine;
105+
$docStartLine = $docComment ? $docComment->getStartLine() : -1;
106+
$docEndLine = $docComment ? $docComment->getEndLine() : -1;
107107

108108
// Get class content
109109
$classContent = $this->extractNodeContent($node);
@@ -158,8 +158,8 @@ private function extractMethodData(Node\FunctionLike $node)
158158
// Get method docblock
159159
$docComment = $node->getDocComment();
160160
$docString = $docComment ? $docComment->getText() : '';
161-
$docStartLine = $docComment ? $docComment->getStartLine() : $startLine;
162-
$docEndLine = $docComment ? $docComment->getEndLine() : $startLine;
161+
$docStartLine = $docComment ? $docComment->getStartLine() : -1;
162+
$docEndLine = $docComment ? $docComment->getEndLine() : -1;
163163

164164
// Get method content and called functions
165165
$methodContent = $this->extractNodeContent($node);

0 commit comments

Comments
 (0)