PhpdocAlignFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Constants
- DEFAULT_SPACING = 1
- DEFAULT_SPACING_KEY = '_default'
- DEFAULT_TAGS = ['method', 'param', 'property', 'return', 'throws', 'type', 'var']
- TAGS_WITH_METHOD_SIGNATURE = ['method', 'phpstan-method', 'psalm-method']
- TAGS_WITH_NAME = ['param', 'property', 'property-read', 'property-write', 'phpstan-param', 'phpstan-property', 'phpstan-property-read', 'phpstan-property-write', 'phpstan-assert', 'phpstan-assert-if-true', 'phpstan-assert-if-false', 'psalm-param', 'psalm-param-out', 'psalm-property', 'psalm-property-read', 'psalm-property-write', 'psalm-assert', 'psalm-assert-if-true', 'psalm-assert-if-false']
Properties
- $align : string
- $regex : string
- $regexCommentLine : string
- $spacing : array<string, int>|int
- same spacing for all or specific for different tags.
Methods
- getDefinition() : FixerDefinitionInterface
- Returns the definition of the fixer.
- getPriority() : int
- Returns the priority of the fixer.
- isCandidate() : bool
- Check if the fixer is a candidate for given Tokens collection.
- applyFix() : void
- configurePostNormalisation() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- fixDocBlock() : void
- getIndent() : string
- getLeftAlignedDescriptionIndent() : int
- getMatches() : null|array{indent: null|string, tag: null|string, hint: string, var: null|string, static: string, desc?: null|string}
- getSentenceIndent() : int
- Get indent for sentence.
- spacingForTag() : int
Constants
DEFAULT_SPACING
private
mixed
DEFAULT_SPACING
= 1
DEFAULT_SPACING_KEY
private
mixed
DEFAULT_SPACING_KEY
= '_default'
DEFAULT_TAGS
private
mixed
DEFAULT_TAGS
= ['method', 'param', 'property', 'return', 'throws', 'type', 'var']
TAGS_WITH_METHOD_SIGNATURE
private
mixed
TAGS_WITH_METHOD_SIGNATURE
= ['method', 'phpstan-method', 'psalm-method']
TAGS_WITH_NAME
private
mixed
TAGS_WITH_NAME
= ['param', 'property', 'property-read', 'property-write', 'phpstan-param', 'phpstan-property', 'phpstan-property-read', 'phpstan-property-write', 'phpstan-assert', 'phpstan-assert-if-true', 'phpstan-assert-if-false', 'psalm-param', 'psalm-param-out', 'psalm-property', 'psalm-property-read', 'psalm-property-write', 'psalm-assert', 'psalm-assert-if-true', 'psalm-assert-if-false']
Properties
$align
private
string
$align
$regex
private
string
$regex
$regexCommentLine
private
string
$regexCommentLine
$spacing
same spacing for all or specific for different tags.
private
array<string, int>|int
$spacing
= 1
Methods
getDefinition()
Returns the definition of the fixer.
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
Returns the priority of the fixer.
public
getPriority() : int
Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, GeneralPhpdocTagRenameFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAnnotationWithoutDotFixer, PhpdocArrayTypeFixer, PhpdocIndentFixer, PhpdocInlineTagNormalizerFixer, PhpdocLineSpanFixer, PhpdocListTypeFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderByValueFixer, PhpdocOrderFixer, PhpdocParamOrderFixer, PhpdocReadonlyClassCommentToKeywordFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocTagCasingFixer, PhpdocTagTypeFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToPropertyTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
Return values
intisCandidate()
Check if the fixer is a candidate for given Tokens collection.
public
isCandidate(Tokens $tokens) : bool
Fixer is a candidate when the collection contains tokens that may be fixed during fixer work. This could be considered as some kind of bloom filter. When this method returns true then to the Tokens collection may or may not need a fixing, but when this method returns false then the Tokens collection need no fixing for sure.
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
configurePostNormalisation()
protected
configurePostNormalisation() : void
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacefixDocBlock()
private
fixDocBlock(DocBlock $docBlock) : void
Parameters
- $docBlock : DocBlock
getIndent()
private
getIndent(int $verticalAlignIndent[, int $leftAlignIndent = 1 ]) : string
Parameters
- $verticalAlignIndent : int
- $leftAlignIndent : int = 1
Return values
stringgetLeftAlignedDescriptionIndent()
private
getLeftAlignedDescriptionIndent(array<int, array{indent: null|string, tag: null|string, hint: string, var: null|string, static: string, desc?: null|string}> $items, int $index) : int
Parameters
- $items : array<int, array{indent: null|string, tag: null|string, hint: string, var: null|string, static: string, desc?: null|string}>
- $index : int
Return values
intgetMatches()
private
getMatches(string $line[, bool $matchCommentOnly = false ]) : null|array{indent: null|string, tag: null|string, hint: string, var: null|string, static: string, desc?: null|string}
Parameters
- $line : string
- $matchCommentOnly : bool = false
Tags
Return values
null|array{indent: null|string, tag: null|string, hint: string, var: null|string, static: string, desc?: null|string}getSentenceIndent()
Get indent for sentence.
private
getSentenceIndent(string|null $sentence[, int $spacingForTag = 1 ]) : int
Parameters
- $sentence : string|null
- $spacingForTag : int = 1
Return values
intspacingForTag()
private
spacingForTag(string|null $tag) : int
Parameters
- $tag : string|null