Skip to content

Commit

Permalink
Deprecate Node::getLine() in favor of Node::getStartLine()
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Sep 17, 2023
1 parent 1b346f7 commit 1873020
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ See UPGRADE-5.0 for detailed migration instructions.
have been removed. Use `Comment::getStartLine()`, `Comment::getStartTokenPos()` and
`Comment::getStartFilePos()` instead.

### Deprecated

* The `Node::getLine()` method has been deprecated. Use `Node::getStartLine()` instead.

Version 5.0.0-alpha3 (2023-06-24)
---------------------------------

Expand Down
1 change: 1 addition & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,4 @@ Additionally, the token array is now terminated by a sentinel token with ID 0.
* The deprecated `Error` constructor taking a start line has been removed. Pass `['startLine' => $startLine]` attributes instead.
* The deprecated `Comment::getLine()`, `Comment::getTokenPos()` and `Comment::getFilePos()` methods have been removed. Use `Comment::getStartLine()`, `Comment::getStartTokenPos()` and `Comment::getStartFilePos()` instead.
* `Comment::getReformattedText()` now normalizes CRLF newlines to LF newlines.
* The `Node::getLine()` method has been deprecated. Use `Node::getStartLine()` instead.
2 changes: 2 additions & 0 deletions lib/PhpParser/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public function getSubNodeNames(): array;
* Gets line the node started in (alias of getStartLine).
*
* @return int Start line (or -1 if not available)
*
* @deprecated Use getStartLine() instead
*/
public function getLine(): int;

Expand Down

0 comments on commit 1873020

Please sign in to comment.