| Methods |
protected
|
p(
Node $node,
int $precedence = self::MAX_PRECEDENCE,
int $lhsPrecedence = self::MAX_PRECEDENCE,
bool $parentFormatPreserved = false,
): string
Every construct the printer descends into comes back through here, and
each level of a chain is printed again in turn for its own expression
key, so a chain of depth N costs O(N^2). Remembering each expression's
printed form on its node makes the levels below it O(1) — and it is the
very same cache ExprPrinter fills, so a key printed once is never
rebuilt, wherever it was first reached from. Only the standalone form is remembered: at a lower precedence the
printer may parenthesise, and a form containing a newline was indented
for the level it was printed at, while expression keys are printed at
the top level.
Every construct the printer descends into comes back through here, and
each level of a chain is printed again in turn for its own expression
key, so a chain of depth N costs O(N^2). Remembering each expression's
printed form on its node makes the levels below it O(1) — and it is the
very same cache ExprPrinter fills, so a key printed once is never
rebuilt, wherever it was first reached from. Only the standalone form is remembered: at a lower precedence the
printer may parenthesise, and a form containing a newline was indented
for the level it was printed at, while expression keys are printed at
the top level.
Parameters
| $node |
Node to be pretty printed
|
| $precedence |
Precedence of parent operator
|
| $lhsPrecedence |
Precedence for unary operator on LHS of binary operator
|
| $parentFormatPreserved |
Whether parent node has preserved formatting
|
Returns
Overrides
|
#
|
protected
|
pObjectProperty(Node $node): string
Normalize curly-brace member access with a constant string name to the
bareword form, so that e.g. $obj->{'n'} and $obj->n (or $obj->{'n'}()
and $obj->n()) produce identical expression keys and are treated as the
same member by the analyser.
Normalize curly-brace member access with a constant string name to the
bareword form, so that e.g. $obj->{'n'} and $obj->n (or $obj->{'n'}()
and $obj->n()) produce identical expression keys and are treated as the
same member by the analyser.
Overrides
|
#
|
protected
|
pPHPStan_Node_TypeExpr(TypeExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_NativeTypeExpr(NativeTypeExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_UnsetOffsetExpr(UnsetOffsetExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_ExistingArrayDimFetch(ExistingArrayDimFetch $expr): string
|
#
|
protected
|
pPHPStan_Node_SetOffsetValueTypeExpr(SetOffsetValueTypeExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_SetExistingOffsetValueTypeExpr(SetExistingOffsetValueTypeExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_AlwaysRememberedExpr(AlwaysRememberedExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_PossiblyImpureCallExpr(PossiblyImpureCallExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_PropertyInitializationExpr(PropertyInitializationExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_CloneReinitializationExpr(CloneReinitializationExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_ForeachValueByRefExpr(ForeachValueByRefExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_ParameterVariableOriginalValueExpr(ParameterVariableOriginalValueExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_OriginalForeachKeyExpr(OriginalForeachKeyExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_OriginalForeachValueExpr(OriginalForeachValueExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_IntertwinedVariableByReferenceWithExpr(IntertwinedVariableByReferenceWithExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_IssetExpr(IssetExpr $expr): string
|
#
|
protected
|
pPHPStan_Node_BooleanOrNode(BooleanOrNode $expr): string
|
#
|
protected
|
pPHPStan_Node_BooleanAndNode(BooleanAndNode $expr): string
|
#
|
protected
|
pPHPStan_Node_FunctionCallableNode(FunctionCallableNode $expr): string
|
#
|
protected
|
pPHPStan_Node_MethodCallableNode(MethodCallableNode $expr): string
|
#
|
protected
|
pPHPStan_Node_StaticMethodCallableNode(StaticMethodCallableNode $expr): string
|
#
|
protected
|
pPHPStan_Node_InstantiationCallableNode(InstantiationCallableNode $expr): string
|
#
|