Printer
in package
FinalYes
Inspired by https://github.com/nikic/PHP-Parser/tree/36a6dcd04e7b0285e8f0868f44bd4927802f7df1
Copyright (c) 2011, Nikita Popov All rights reserved.
Table of Contents
Properties
- $differ : Differ<string|int, Node>
- $emptyListInsertionMap : array<string, array{: string|null, : string, : string}>
- [$find, $extraLeft, $extraRight]
- $listInsertionMap : array<string, string>
- Map From "{$class}->{$subNode}" to string that should be inserted between elements of this list subnode
- $parenthesesListMap : array<string, array<int, TypeNode>>>
- $parenthesesMap : array<string, array<int, TypeNode>>>
Methods
- print() : string
- printFormatPreserving() : string
- isMultiline() : array{: bool, : string, : string}
- printArrayFormatPreserving() : string|null
- printConstExpr() : string
- printNodeFormatPreserving() : string
- printOffsetAccessType() : string
- printTagValue() : string
- printType() : string
- wrapInParentheses() : string
Properties
$differ
private
Differ<string|int, Node>
$differ
$emptyListInsertionMap
[$find, $extraLeft, $extraRight]
private
array<string, array{: string|null, : string, : string}>
$emptyListInsertionMap
= [\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class . '->parameters' => ['(', '', ''], \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode::class . '->items' => ['{', '', ''], \PHPStan\PhpDocParser\Ast\Type\ObjectShapeNode::class . '->items' => ['{', '', ''], \PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineArray::class . '->items' => ['{', '', ''], \PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineAnnotation::class . '->arguments' => ['(', '', '']]
$listInsertionMap
Map From "{$class}->{$subNode}" to string that should be inserted between elements of this list subnode
private
array<string, string>
$listInsertionMap
= [\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::class . '->children' => "\n * ", \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class . '->types' => '|', \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class . '->types' => '&', \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode::class . '->items' => ', ', \PHPStan\PhpDocParser\Ast\Type\ObjectShapeNode::class . '->items' => ', ', \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class . '->parameters' => ', ', \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class . '->genericTypes' => ', ', \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprArrayNode::class . '->items' => ', ', \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode::class . '->parameters' => ', ', \PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineArray::class . '->items' => ', ', \PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineAnnotation::class . '->arguments' => ', ']
$parenthesesListMap
private
array<string, array<int, TypeNode>>>
$parenthesesListMap
= [\PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class . '->types' => [\PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class], \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class . '->types' => [\PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class]]
$parenthesesMap
private
array<string, array<int, TypeNode>>>
$parenthesesMap
= [\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class . '->returnType' => [\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class], \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode::class . '->type' => [\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\ConstTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class], \PHPStan\PhpDocParser\Ast\Type\OffsetAccessTypeNode::class . '->type' => [\PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\ConstTypeNode::class, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class]]
Methods
print()
public
print(Node $node) : string
Parameters
- $node : Node
Return values
stringprintFormatPreserving()
public
printFormatPreserving(PhpDocNode $node, PhpDocNode $originalNode, TokenIterator $originalTokens) : string
Parameters
- $node : PhpDocNode
- $originalNode : PhpDocNode
- $originalTokens : TokenIterator
Return values
stringisMultiline()
private
isMultiline(int $initialIndex, array<string|int, Node> $nodes, TokenIterator $originalTokens) : array{: bool, : string, : string}
Parameters
- $initialIndex : int
- $nodes : array<string|int, Node>
- $originalTokens : TokenIterator
Return values
array{: bool, : string, : string}printArrayFormatPreserving()
private
printArrayFormatPreserving(array<string|int, Node> $nodes, array<string|int, Node> $originalNodes, TokenIterator $originalTokens, int &$tokenIndex, string $parentNodeClass, string $subNodeName) : string|null
Parameters
- $nodes : array<string|int, Node>
- $originalNodes : array<string|int, Node>
- $originalTokens : TokenIterator
- $tokenIndex : int
- $parentNodeClass : string
- $subNodeName : string
Return values
string|nullprintConstExpr()
private
printConstExpr(ConstExprNode $node) : string
Parameters
- $node : ConstExprNode
Return values
stringprintNodeFormatPreserving()
private
printNodeFormatPreserving(Node $node, TokenIterator $originalTokens) : string
Parameters
- $node : Node
- $originalTokens : TokenIterator
Return values
stringprintOffsetAccessType()
private
printOffsetAccessType(TypeNode $type) : string
Parameters
- $type : TypeNode
Return values
stringprintTagValue()
private
printTagValue(PhpDocTagValueNode $node) : string
Parameters
- $node : PhpDocTagValueNode
Return values
stringprintType()
private
printType(TypeNode $node) : string
Parameters
- $node : TypeNode
Return values
stringwrapInParentheses()
private
wrapInParentheses(TypeNode $node) : string
Parameters
- $node : TypeNode