Printer
in package
Inspired by https://github.com/nikic/PHP-Parser/tree/36a6dcd04e7b0285e8f0868f44bd4927802f7df1
Copyright (c) 2011, Nikita Popov All rights reserved.
Table of Contents
- $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, class-string<\PHPStan\PhpDocParser\Ast\Type\TypeNode>>>
- $parenthesesMap : array<string, array<int, class-string<\PHPStan\PhpDocParser\Ast\Type\TypeNode>>>
- 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
= [PHPStanPhpDocParserAstTypeCallableTypeNode::class . '->parameters' => ['(', '', ''], PHPStanPhpDocParserAstTypeArrayShapeNode::class . '->items' => ['{', '', ''], PHPStanPhpDocParserAstTypeObjectShapeNode::class . '->items' => ['{', '', ''], PHPStanPhpDocParserAstPhpDocDoctrineDoctrineArray::class . '->items' => ['{', '', ''], PHPStanPhpDocParserAstPhpDocDoctrineDoctrineAnnotation::class . '->arguments' => ['(', '', '']]
$listInsertionMap
Map From "{$class}->{$subNode}" to string that should be inserted between elements of this list subnode
private
array<string, string>
$listInsertionMap
= [PHPStanPhpDocParserAstPhpDocPhpDocNode::class . '->children' => "
* ", PHPStanPhpDocParserAstTypeUnionTypeNode::class . '->types' => '|', PHPStanPhpDocParserAstTypeIntersectionTypeNode::class . '->types' => '&', PHPStanPhpDocParserAstTypeArrayShapeNode::class . '->items' => ', ', PHPStanPhpDocParserAstTypeObjectShapeNode::class . '->items' => ', ', PHPStanPhpDocParserAstTypeCallableTypeNode::class . '->parameters' => ', ', PHPStanPhpDocParserAstTypeCallableTypeNode::class . '->templateTypes' => ', ', PHPStanPhpDocParserAstTypeGenericTypeNode::class . '->genericTypes' => ', ', PHPStanPhpDocParserAstConstExprConstExprArrayNode::class . '->items' => ', ', PHPStanPhpDocParserAstPhpDocMethodTagValueNode::class . '->parameters' => ', ', PHPStanPhpDocParserAstPhpDocDoctrineDoctrineArray::class . '->items' => ', ', PHPStanPhpDocParserAstPhpDocDoctrineDoctrineAnnotation::class . '->arguments' => ', ']
$parenthesesListMap
private
array<string, array<int, class-string<\PHPStan\PhpDocParser\Ast\Type\TypeNode>>>
$parenthesesListMap
= [PHPStanPhpDocParserAstTypeIntersectionTypeNode::class . '->types' => [PHPStanPhpDocParserAstTypeIntersectionTypeNode::class, PHPStanPhpDocParserAstTypeUnionTypeNode::class, PHPStanPhpDocParserAstTypeNullableTypeNode::class], PHPStanPhpDocParserAstTypeUnionTypeNode::class . '->types' => [PHPStanPhpDocParserAstTypeIntersectionTypeNode::class, PHPStanPhpDocParserAstTypeUnionTypeNode::class, PHPStanPhpDocParserAstTypeNullableTypeNode::class]]
$parenthesesMap
private
array<string, array<int, class-string<\PHPStan\PhpDocParser\Ast\Type\TypeNode>>>
$parenthesesMap
= [PHPStanPhpDocParserAstTypeCallableTypeNode::class . '->returnType' => [PHPStanPhpDocParserAstTypeCallableTypeNode::class, PHPStanPhpDocParserAstTypeUnionTypeNode::class, PHPStanPhpDocParserAstTypeIntersectionTypeNode::class], PHPStanPhpDocParserAstTypeArrayTypeNode::class . '->type' => [PHPStanPhpDocParserAstTypeCallableTypeNode::class, PHPStanPhpDocParserAstTypeUnionTypeNode::class, PHPStanPhpDocParserAstTypeIntersectionTypeNode::class, PHPStanPhpDocParserAstTypeConstTypeNode::class, PHPStanPhpDocParserAstTypeNullableTypeNode::class], PHPStanPhpDocParserAstTypeOffsetAccessTypeNode::class . '->type' => [PHPStanPhpDocParserAstTypeCallableTypeNode::class, PHPStanPhpDocParserAstTypeUnionTypeNode::class, PHPStanPhpDocParserAstTypeIntersectionTypeNode::class, PHPStanPhpDocParserAstTypeConstTypeNode::class, PHPStanPhpDocParserAstTypeNullableTypeNode::class]]
Methods
print()
public
print(Node $node) : string
Parameters
- $node : Node
Return values
string —printFormatPreserving()
public
printFormatPreserving(PhpDocNode $node, PhpDocNode $originalNode, TokenIterator $originalTokens) : string
Parameters
- $node : PhpDocNode
- $originalNode : PhpDocNode
- $originalTokens : TokenIterator
Return values
string —isMultiline()
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|null —printConstExpr()
private
printConstExpr(ConstExprNode $node) : string
Parameters
- $node : ConstExprNode
Return values
string —printNodeFormatPreserving()
private
printNodeFormatPreserving(Node $node, TokenIterator $originalTokens) : string
Parameters
- $node : Node
- $originalTokens : TokenIterator
Return values
string —printOffsetAccessType()
private
printOffsetAccessType(TypeNode $type) : string
Parameters
- $type : TypeNode
Return values
string —printTagValue()
private
printTagValue(PhpDocTagValueNode $node) : string
Parameters
- $node : PhpDocTagValueNode
Return values
string —printType()
private
printType(TypeNode $node) : string
Parameters
- $node : TypeNode
Return values
string —wrapInParentheses()
private
wrapInParentheses(TypeNode $node) : string
Parameters
- $node : TypeNode