Menu

## Doc extends Comment
in package

Doc.php : 5

### Table of Contents

$endFilePos : mixed
$endLine : mixed
$endTokenPos : mixed
$startFilePos : mixed
$startLine : mixed
$startTokenPos : mixed
$text : mixed
__construct() : mixed
  Constructs a comment node.
__toString() : string
  Gets the comment text.
getEndFilePos() : int
  Gets the file offset the comment ends on.
getEndLine() : int
  Gets the line number the comment ends on.
getEndTokenPos() : int
  Gets the token offset the comment ends on.
getFilePos() : int
  Gets the file offset the comment started on.
getLine() : int
  Gets the line number the comment started on.
getReformattedText() : mixed|string
  Gets the reformatted comment text.
getStartFilePos() : int
  Gets the file offset the comment started on.
getStartLine() : int
  Gets the line number the comment started on.
getStartTokenPos() : int
  Gets the token offset the comment started on.
getText() : string
  Gets the comment text.
getTokenPos() : int
  Gets the token offset the comment started on.
jsonSerialize() : array<string|int, mixed>
getShortestWhitespacePrefixLen() : int
  Get length of shortest whitespace prefix (at the start of a line).

### Properties

#### $endFilePos

Comment.php : 12
`protected mixed $endFilePos`

#### $endLine

Comment.php : 11
`protected mixed $endLine`

#### $endTokenPos

Comment.php : 13
`protected mixed $endTokenPos`

#### $startFilePos

Comment.php : 9
`protected mixed $startFilePos`

#### $startLine

Comment.php : 8
`protected mixed $startLine`

#### $startTokenPos

Comment.php : 10
`protected mixed $startTokenPos`

#### $text

Comment.php : 7
`protected mixed $text`

### Methods

#### __construct()

Comment.php : 23

Constructs a comment node.

`public __construct(string $text[, int $startLine = -1 ][, int $startFilePos = -1 ][, int $startTokenPos = -1 ][, int $endLine = -1 ][, int $endFilePos = -1 ][, int $endTokenPos = -1 ]) : mixed`

##### Parameters

$text : string

  Comment text (including comment delimiters like /*)

$startLine : int = -1

  Line number the comment started on

$startFilePos : int = -1

  File offset the comment started on

$startTokenPos : int = -1

  Token offset the comment started on

$endLine : int = -1
$endFilePos : int = -1
$endTokenPos : int = -1

##### Return values

mixed —

#### __toString()

Comment.php : 138

Gets the comment text.

`public __toString() : string`

##### Return values

string —

The comment text (including comment delimiters like /*)

#### getEndFilePos()

Comment.php : 87

Gets the file offset the comment ends on.

`public getEndFilePos() : int`

##### Return values

int —

File offset (or -1 if not available)

#### getEndLine()

Comment.php : 78

Gets the line number the comment ends on.

`public getEndLine() : int`

##### Return values

int —

Line number (or -1 if not available)

#### getEndTokenPos()

Comment.php : 96

Gets the token offset the comment ends on.

`public getEndTokenPos() : int`

##### Return values

int —

Token offset (or -1 if not available)

#### getFilePos()

Comment.php : 118

Gets the file offset the comment started on.

`public getFilePos() : int`

##### Tags

deprecated

  Use getStartFilePos() instead

##### Return values

int —

File offset

#### getLine()

Comment.php : 107

Gets the line number the comment started on.

`public getLine() : int`

##### Tags

deprecated

  Use getStartLine() instead

##### Return values

int —

Line number

#### getReformattedText()

Comment.php : 152

Gets the reformatted comment text.

`public getReformattedText() : mixed|string`

"Reformatted" here means that we try to clean up the whitespace at the starts of the lines. This is necessary because we receive the comments without trailing whitespace on the first line, but with trailing whitespace on all subsequent lines.

##### Return values

mixed|string —

#### getStartFilePos()

Comment.php : 60

Gets the file offset the comment started on.

`public getStartFilePos() : int`

##### Return values

int —

File offset (or -1 if not available)

#### getStartLine()

Comment.php : 51

Gets the line number the comment started on.

`public getStartLine() : int`

##### Return values

int —

Line number (or -1 if not available)

#### getStartTokenPos()

Comment.php : 69

Gets the token offset the comment started on.

`public getStartTokenPos() : int`

##### Return values

int —

Token offset (or -1 if not available)

#### getText()

Comment.php : 42

Gets the comment text.

`public getText() : string`

##### Return values

string —

The comment text (including comment delimiters like /*)

#### getTokenPos()

Comment.php : 129

Gets the token offset the comment started on.

`public getTokenPos() : int`

##### Tags

deprecated

  Use getStartTokenPos() instead

##### Return values

int —

Token offset

#### jsonSerialize()

Comment.php : 224
`public jsonSerialize() : array<string|int, mixed>`

##### Tags

psalm-return

  array{nodeType:string, text:mixed, line:mixed, filePos:mixed}

##### Return values

array<string|int, mixed> —

#### getShortestWhitespacePrefixLen()

Comment.php : 207

Get length of shortest whitespace prefix (at the start of a line).

`private getShortestWhitespacePrefixLen(string $str) : int`

If there is a line with no prefix whitespace, 0 is a valid return value.

##### Parameters

$str : string

  String to check

##### Return values

int —

Length in characters. Tabs count as single characters.

## Search results