Skip to content

Commit

Permalink
solution for start line detection with attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Feb 4, 2024
1 parent 2d3441b commit a06b0c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/Traits/ReflectionClassLikeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,8 @@ public function getShortName(): string

public function getStartLine(): int
{
// php parser detect same line for has attrGroups
// attrGroup is mostly on next line
if ($this->classLikeNode->attrGroups !== []) {
return $this->classLikeNode->getAttribute('startLine') + count($this->classLikeNode->attrGroups);
return parent::getStartLine();
}

return $this->classLikeNode->getAttribute('startLine');
Expand Down
4 changes: 1 addition & 3 deletions src/Traits/ReflectionFunctionLikeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ public function getShortName(): string

public function getStartLine(): int
{
// php parser detect same line for has attrGroups
// attrGroup is mostly on next line
if ($this->functionLikeNode->attrGroups !== []) {
return $this->functionLikeNode->getAttribute('startLine') + count($this->functionLikeNode->attrGroups);
return parent::getStartLine();
}

return $this->functionLikeNode->getAttribute('startLine');
Expand Down

0 comments on commit a06b0c7

Please sign in to comment.