abstract | |
---|---|
implements |
PrettyPrinter |
Methods | ||
---|---|---|
public
|
__construct(array{phpVersion?:PhpVersion, newline?:string, indent?:string, shortArraySyntax?:bool} $options = [])
|
# |
protected
|
resetState(): void
|
# |
protected
|
setIndentLevel(int $level): void
|
# |
protected
|
indent(): void
|
# |
protected
|
outdent(): void
|
# |
public
|
prettyPrint(Node[] $stmts): string
|
# |
public
|
prettyPrintExpr(Expr $node): string
|
# |
public
|
prettyPrintFile(Node[] $stmts): string
|
# |
protected
|
preprocessNodes(Node[] $nodes): void
|
# |
protected
|
handleMagicTokens(string $str): string
|
# |
protected
|
pStmts(Node[] $nodes, bool $indent = true): string
|
# |
protected
|
pInfixOp(
string $class,
Node $leftNode,
string $operatorString,
Node $rightNode,
int $precedence,
int $lhsPrecedence,
): string
|
# |
protected
|
pPrefixOp(string $class, string $operatorString, Node $node, int $precedence, int $lhsPrecedence): string
|
# |
protected
|
pPostfixOp(string $class, Node $node, string $operatorString, int $precedence, int $lhsPrecedence): string
|
# |
protected
|
pImplode(Node[] $nodes, string $glue = ''): string
|
# |
protected
|
pCommaSeparated(Node[] $nodes): string
|
# |
protected
|
pCommaSeparatedMultiline(Node[] $nodes, bool $trailingComma): string
|
# |
protected
|
pComments(Comment[] $comments): string
|
# |
public
|
printFormatPreserving(Node[] $stmts, Node[] $origStmts, Token[] $origTokens): string
|
# |
protected
|
pFallback(Node $node, int $precedence, int $lhsPrecedence): string
|
# |
protected
|
p(
Node $node,
int $precedence = self::MAX_PRECEDENCE,
int $lhsPrecedence = self::MAX_PRECEDENCE,
bool $parentFormatPreserved = false,
): string
|
# |
protected
|
pArray(
Node[] $nodes,
Node[] $origNodes,
int &$pos,
int $indentAdjustment,
string $parentNodeClass,
string $subNodeName,
null|int $fixup,
): null|string
|
# |
protected
|
pFixup(int $fixup, Node $subNode, string|null $parentClass, int $subStartPos, int $subEndPos): string
|
# |
protected
|
safeAppend(string &$str, string $append): void
|
# |
protected
|
callLhsRequiresParens(Node $node): bool
|
# |
protected
|
dereferenceLhsRequiresParens(Node $node): bool
|
# |
protected
|
staticDereferenceLhsRequiresParens(Node $node): bool
|
# |
protected
|
newOperandRequiresParens(Node $node): bool
|
# |
protected
|
pModifiers(int $modifiers): string
|
# |
protected
|
pStatic(bool $static): string
|
# |
protected
|
isMultiline((Node|null)[] $nodes): bool
|
# |
protected
|
initializeLabelCharMap(): void
|
# |
protected
|
initializeNodeListDiffer(): void
|
# |
protected
|
initializeFixupMap(): void
|
# |
protected
|
initializeRemovalMap(): void
|
# |
protected
|
initializeInsertionMap(): void
|
# |
protected
|
initializeListInsertionMap(): void
|
# |
protected
|
initializeEmptyListInsertionMap(): void
|
# |
protected
|
initializeModifierChangeMap(): void
|
# |
Constants | ||
---|---|---|
protected
|
FIXUP_PREC_LEFT = 0
|
# |
protected
|
FIXUP_PREC_RIGHT = 1
|
# |
protected
|
FIXUP_PREC_UNARY = 2
|
# |
protected
|
FIXUP_CALL_LHS = 3
|
# |
protected
|
FIXUP_DEREF_LHS = 4
|
# |
protected
|
FIXUP_STATIC_DEREF_LHS = 5
|
# |
protected
|
FIXUP_BRACED_NAME = 6
|
# |
protected
|
FIXUP_VAR_BRACED_NAME = 7
|
# |
protected
|
FIXUP_ENCAPSED = 8
|
# |
protected
|
FIXUP_NEW = 9
|
# |
protected
|
MAX_PRECEDENCE = 1000
|
# |
Properties | |||
---|---|---|---|
protected
|
array<class-string, array{int, int, int}>
|
$precedenceMap = [
Clone_::class => [-10, 0, 1],
Pow::class => [0, 0, 1],
BitwiseNot::class => [10, -1, -1],
UnaryPlus::class => [10, -1, -1],
UnaryMinus::class => [10, -1, -1],
Int_::class => [10, -1, -1],
Double::class => [10, -1, -1],
String_::class => [10, -1, -1],
Array_::class => [10, -1, -1],
Object_::class => [10, -1, -1],
Bool_::class => [10, -1, -1],
Unset_::class => [10, -1, -1],
ErrorSuppress::class => [10, -1, -1],
Instanceof_::class => [20, -1, -1],
BooleanNot::class => [30, -1, -1],
Mul::class => [40, 41, 40],
Div::class => [40, 41, 40],
Mod::class => [40, 41, 40],
Plus::class => [50, 51, 50],
Minus::class => [50, 51, 50],
Concat::class => [50, 51, 50],
ShiftLeft::class => [60, 61, 60],
ShiftRight::class => [60, 61, 60],
Smaller::class => [70, 70, 70],
SmallerOrEqual::class => [70, 70, 70],
Greater::class => [70, 70, 70],
GreaterOrEqual::class => [70, 70, 70],
Equal::class => [80, 80, 80],
NotEqual::class => [80, 80, 80],
Identical::class => [80, 80, 80],
NotIdentical::class => [80, 80, 80],
Spaceship::class => [80, 80, 80],
BitwiseAnd::class => [90, 91, 90],
BitwiseXor::class => [100, 101, 100],
BitwiseOr::class => [110, 111, 110],
BooleanAnd::class => [120, 121, 120],
BooleanOr::class => [130, 131, 130],
Coalesce::class => [140, 140, 141],
Ternary::class => [150, 150, 150],
Assign::class => [160, -1, -1],
AssignRef::class => [160, -1, -1],
Plus::class => [160, -1, -1],
Minus::class => [160, -1, -1],
Mul::class => [160, -1, -1],
Div::class => [160, -1, -1],
Concat::class => [160, -1, -1],
Mod::class => [160, -1, -1],
BitwiseAnd::class => [160, -1, -1],
BitwiseOr::class => [160, -1, -1],
BitwiseXor::class => [160, -1, -1],
ShiftLeft::class => [160, -1, -1],
ShiftRight::class => [160, -1, -1],
Pow::class => [160, -1, -1],
Coalesce::class => [160, -1, -1],
YieldFrom::class => [170, -1, -1],
Yield_::class => [175, -1, -1],
Print_::class => [180, -1, -1],
LogicalAnd::class => [190, 191, 190],
LogicalXor::class => [200, 201, 200],
LogicalOr::class => [210, 211, 210],
Include_::class => [220, -1, -1],
ArrowFunction::class => [230, -1, -1],
Throw_::class => [240, -1, -1],
]
|
# |
protected
|
int
|
$indentLevel
|
# |
protected
|
string
|
$newline
|
# |
protected
|
string
|
$nl
|
# |
protected
|
string|null
|
$docStringEndToken
|
# |
protected
|
bool
|
$canUseSemicolonNamespaces
|
# |
protected
|
bool
|
$shortArraySyntax
|
# |
protected
|
PhpVersion
|
$phpVersion
|
# |
protected
|
TokenStream|null
|
$origTokens
|
# |
protected
|
Differ<Node>
|
$nodeListDiffer
|
# |
protected
|
array<string, bool>
|
$labelCharMap
|
# |
protected
|
array<string, array<string, int>>
|
$fixupMap
|
# |
protected
|
array<string, array{left?:(int|string), right?:(int|string)}>
|
$removalMap
|
# |
protected
|
array<string, array{(int|string|null), bool, (string|null), (string|null)}>
|
$insertionMap
|
# |
protected
|
array<string, string>
|
$listInsertionMap
|
# |
protected
|
array<string, array{(int|string|null), string, string}>
|
$emptyListInsertionMap
|
# |
protected
|
array<string, array{string, int}>
|
$modifierChangeMap
|
# |