mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-29 05:07:34 +01:00
Remove deprecated Comment methods
This commit is contained in:
parent
2d3dd4e23e
commit
1b346f7935
@ -23,6 +23,12 @@ See UPGRADE-5.0 for detailed migration instructions.
|
||||
* The pretty printer now indents heredoc/nowdoc strings if the target version is >= 7.3
|
||||
(flexible heredoc/nowdoc).
|
||||
|
||||
### Removed
|
||||
|
||||
* The deprecated `Comment::getLine()`, `Comment::getTokenPos()` and `Comment::getFilePos()` methods
|
||||
have been removed. Use `Comment::getStartLine()`, `Comment::getStartTokenPos()` and
|
||||
`Comment::getStartFilePos()` instead.
|
||||
|
||||
Version 5.0.0-alpha3 (2023-06-24)
|
||||
---------------------------------
|
||||
|
||||
|
@ -290,4 +290,5 @@ Additionally, the token array is now terminated by a sentinel token with ID 0.
|
||||
|
||||
* The deprecated `Builder\Param::setTypeHint()` method has been removed in favor of `Builder\Param::setType()`.
|
||||
* The deprecated `Error` constructor taking a start line has been removed. Pass `['startLine' => $startLine]` attributes instead.
|
||||
* `Comment::getReformattedText()` now normalizes CRLF newlines to LF newlines.
|
||||
* 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.
|
||||
|
@ -103,39 +103,6 @@ class Comment implements \JsonSerializable {
|
||||
return $this->endTokenPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the line number the comment started on.
|
||||
*
|
||||
* @deprecated Use getStartLine() instead
|
||||
*
|
||||
* @return int Line number
|
||||
*/
|
||||
public function getLine(): int {
|
||||
return $this->startLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file offset the comment started on.
|
||||
*
|
||||
* @deprecated Use getStartFilePos() instead
|
||||
*
|
||||
* @return int File offset
|
||||
*/
|
||||
public function getFilePos(): int {
|
||||
return $this->startFilePos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token offset the comment started on.
|
||||
*
|
||||
* @deprecated Use getStartTokenPos() instead
|
||||
*
|
||||
* @return int Token offset
|
||||
*/
|
||||
public function getTokenPos(): int {
|
||||
return $this->startTokenPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the comment text.
|
||||
*
|
||||
|
@ -9,9 +9,6 @@ class CommentTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
$this->assertSame('/* Some comment */', $comment->getText());
|
||||
$this->assertSame('/* Some comment */', (string) $comment);
|
||||
$this->assertSame(1, $comment->getLine());
|
||||
$this->assertSame(10, $comment->getFilePos());
|
||||
$this->assertSame(2, $comment->getTokenPos());
|
||||
$this->assertSame(1, $comment->getStartLine());
|
||||
$this->assertSame(10, $comment->getStartFilePos());
|
||||
$this->assertSame(2, $comment->getStartTokenPos());
|
||||
|
Loading…
x
Reference in New Issue
Block a user