diff --git a/src/CodeCleaner/ImplicitReturnPass.php b/src/CodeCleaner/ImplicitReturnPass.php index 24c4f4de..2e4ebf3d 100644 --- a/src/CodeCleaner/ImplicitReturnPass.php +++ b/src/CodeCleaner/ImplicitReturnPass.php @@ -77,14 +77,14 @@ private function addImplicitReturn(array $nodes): array } elseif ($last instanceof Expr && !($last instanceof Exit_)) { // @codeCoverageIgnoreStart $nodes[\count($nodes) - 1] = new Return_($last, [ - 'startLine' => $last->getLine(), - 'endLine' => $last->getLine(), + 'startLine' => $last->getStartLine(), + 'endLine' => $last->getEndLine(), ]); // @codeCoverageIgnoreEnd } elseif ($last instanceof Expression && !($last->expr instanceof Exit_)) { $nodes[\count($nodes) - 1] = new Return_($last->expr, [ - 'startLine' => $last->getLine(), - 'endLine' => $last->getLine(), + 'startLine' => $last->getStartLine(), + 'endLine' => $last->getEndLine(), ]); } elseif ($last instanceof Namespace_) { $last->stmts = $this->addImplicitReturn($last->stmts); diff --git a/src/CodeCleaner/LabelContextPass.php b/src/CodeCleaner/LabelContextPass.php index f34424d5..44962f63 100644 --- a/src/CodeCleaner/LabelContextPass.php +++ b/src/CodeCleaner/LabelContextPass.php @@ -68,9 +68,9 @@ public function enterNode(Node $node) } if ($node instanceof Goto_) { - $this->labelGotos[\strtolower($node->name)] = $node->getLine(); + $this->labelGotos[\strtolower($node->name)] = $node->getStartLine(); } elseif ($node instanceof Label) { - $this->labelDeclarations[\strtolower($node->name)] = $node->getLine(); + $this->labelDeclarations[\strtolower($node->name)] = $node->getStartLine(); } } diff --git a/src/CodeCleaner/ListPass.php b/src/CodeCleaner/ListPass.php index 2b5c9578..52d9c582 100644 --- a/src/CodeCleaner/ListPass.php +++ b/src/CodeCleaner/ListPass.php @@ -52,7 +52,10 @@ public function enterNode(Node $node) $items = isset($node->var->items) ? $node->var->items : $node->var->vars; if ($items === [] || $items === [null]) { - throw new ParseErrorException('Cannot use empty list', $node->var->getLine()); + throw new ParseErrorException('Cannot use empty list', [ + 'startLine' => $node->var->getStartLine(), + 'endLine' => $node->var->getEndLine(), + ]); } $itemFound = false; @@ -65,7 +68,10 @@ public function enterNode(Node $node) if (!self::isValidArrayItem($item)) { $msg = 'Assignments can only happen to writable values'; - throw new ParseErrorException($msg, $item->getLine()); + throw new ParseErrorException($msg, [ + 'startLine' => $item->getStartLine(), + 'endLine' => $item->getEndLine(), + ]); } }