Skip to content

Commit e481026

Browse files
committed
Document attributes used by pretty printer
1 parent 24fb844 commit e481026

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

doc/component/Pretty_printing.markdown

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,19 @@ expression.
3131
Customizing the formatting
3232
--------------------------
3333

34-
The pretty printer respects a number of `kind` attributes used by some nodes (e.g., whether an
35-
integer should be printed as decimal, hexadecimal, etc). Additionally, it supports three options:
34+
The pretty printer respects a number of attributes used by some nodes:
35+
36+
* `kind` on `Scalar\String_` to use single quotes (default), double quotes, heredoc or nowdoc.
37+
In the latter two cases, the heredoc/nowdoc label from the `docLabel` attribute is used.
38+
* `kind` on `Scalar\Int_` to use decimal (default), binary, octal or hexadecimal representation.
39+
* `kind` on `Cast\Double` to use `(double)` (default), `(float)` or `(real)`.
40+
* `kind` on `Expr\List_` to use `[]` or `list()` (default depends on `phpVersion` option).
41+
* `kind` on `Expr\Array_` to use `[]` or `array()` (default depends on `shortArraySyntax` option).
42+
* `kind` on `Expr\Exit_` to use `die` (defaul) or `exit`.
43+
* `hasLeadingNewline` on `Stmt\InlineHTML` to determine whether a newline is emitted after `?>`
44+
or not.
45+
46+
Additionally, the pretty printer supports three options:
3647

3748
* `phpVersion` (defaults to 7.4) allows opting into formatting that is not supported by older PHP
3849
versions.

0 commit comments

Comments
 (0)