Documentation

PhpdocAlignFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Fabien Potencier fabien@symfony.com

author

Jordi Boggiano j.boggiano@seld.be

author

Sebastiaan Stok s.stok@rollerscapes.net

author

Graham Campbell hello@gjcampbell.co.uk

author

Dariusz Rumiński dariusz.ruminski@gmail.com

author

Jakub Kwaśniewski jakub@zero-85.pl

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ align?: 'left'|'vertical', spacing?: array<string, int>|int, tags?: list }

phpstan-type

_AutogeneratedComputedConfiguration array{ align: 'left'|'vertical', spacing: array<string, int>|int, tags: list }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

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_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

$spacing

same spacing for all or specific for different tags.

private array<string, int>|int $spacing = 1

Methods

getPriority()

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
int

isCandidate()

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
bool

configurePostNormalisation()

protected configurePostNormalisation() : void

getIndent()

private getIndent(int $verticalAlignIndent[, int $leftAlignIndent = 1 ]) : string
Parameters
$verticalAlignIndent : int
$leftAlignIndent : int = 1
Return values
string

getLeftAlignedDescriptionIndent()

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
int

getMatches()

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
TODO

Introduce proper DTO instead of an array

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
int

spacingForTag()

private spacingForTag(string|null $tag) : int
Parameters
$tag : string|null
Return values
int

        
On this page

Search results