Property | Type | Description | |
---|---|---|---|
$canUseSemicolonNamespaces | |||
$docStringEndToken | |||
$noIndentToken | |||
$options | |||
$precedenceMap |
Method | Description | |
---|---|---|
__construct ( array $options = [] ) | Creates a pretty printer instance using the given options. | |
prettyPrint ( array $stmts ) : string | Pretty prints an array of statements. | |
prettyPrintExpr ( PhpParser\Node\Expr $node ) : string | Pretty prints an expression. | |
prettyPrintFile ( array $stmts ) : string | Pretty prints a file of statements (includes the opening |
Method | Description | |
---|---|---|
handleMagicTokens ( $str ) | ||
p ( phpparser\Node $node ) : string | Pretty prints a node. | |
pCommaSeparated ( array $nodes ) : string | Pretty prints an array of nodes and implodes the printed values with commas. | |
pComments ( array $comments ) : string | Prints reformatted text of the passed comments. | |
pImplode ( array $nodes, string $glue = '' ) : string | Pretty prints an array of nodes and implodes the printed values. | |
pInfixOp ( $type, phpparser\Node $leftNode, $operatorString, phpparser\Node $rightNode ) | ||
pNoIndent ( string $string ) : string | Signals the pretty printer that a string shall not be indented. | |
pPostfixOp ( $type, phpparser\Node $node, $operatorString ) | ||
pPrec ( phpparser\Node $node, integer $parentPrecedence, integer $parentAssociativity, integer $childPosition ) : string | Prints an expression node with the least amount of parentheses necessary to preserve the meaning. | |
pPrefixOp ( $type, $operatorString, phpparser\Node $node ) | ||
pStmts ( array $nodes, boolean $indent = true ) : string | Pretty prints an array of nodes (statements) and indents them optionally. | |
preprocessNodes ( array $nodes ) | Preprocesses the top-level nodes to initialize pretty printer state. |
public __construct ( array $options = [] ) | ||
$options | array | Dictionary of formatting options |
protected pCommaSeparated ( array $nodes ) : string | ||
$nodes | array | Array of Nodes to be printed |
return | string | Comma separated pretty printed nodes |
protected pInfixOp ( $type, phpparser\Node $leftNode, $operatorString, phpparser\Node $rightNode ) | ||
$leftNode | phpparser\Node | |
$rightNode | phpparser\Node |
protected pPostfixOp ( $type, phpparser\Node $node, $operatorString ) | ||
$node | phpparser\Node |
protected pPrec ( phpparser\Node $node, integer $parentPrecedence, integer $parentAssociativity, integer $childPosition ) : string | ||
$node | phpparser\Node | Node to pretty print |
$parentPrecedence | integer | Precedence of the parent operator |
$parentAssociativity | integer | Associativity of parent operator (-1 is left, 0 is nonassoc, 1 is right) |
$childPosition | integer | Position of the node relative to the operator (-1 is left, 1 is right) |
return | string | The pretty printed node |
protected pPrefixOp ( $type, $operatorString, phpparser\Node $node ) | ||
$node | phpparser\Node |
protected preprocessNodes ( array $nodes ) | ||
$nodes | array | Array of nodes |
public prettyPrint ( array $stmts ) : string | ||
$stmts | array | Array of statements |
return | string | Pretty printed statements |
public prettyPrintExpr ( PhpParser\Node\Expr $node ) : string | ||
$node | PhpParser\Node\Expr | Expression node |
return | string | Pretty printed node |
public prettyPrintFile ( array $stmts ) : string | ||
$stmts | array | Array of statements |
return | string | Pretty printed statements |