PhpUnitTestAnnotationFixer
extends AbstractPhpUnitFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
FinalYes
Tags
Table of Contents
Interfaces
Methods
- getDefinition() : FixerDefinitionInterface
- Returns the definition of the fixer.
- getPriority() : int
- Returns the priority of the fixer.
- isRisky() : bool
- Check if fixer is risky or not.
- applyPhpUnitClassFix() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- addTestAnnotation() : array<int, Line>
- addTestPrefix() : string
- addTestPrefixToDependsAnnotation() : Line
- applyTestAnnotation() : void
- applyTestPrefix() : void
- createDocBlock() : void
- doesDocBlockContainTest() : bool
- findWhereDependsFunctionNameStarts() : int
- Helps to find where the function name in the doc block starts.
- getSingleLineDocBlockEntry() : string
- hasProperTestAnnotation() : bool
- hasTestPrefix() : bool
- isMethod() : bool
- isTestMethod() : bool
- removeTestPrefix() : string
- removeTestPrefixFromDependsAnnotation() : Line
- splitUpDocBlock() : array<int, Line>
- Take a one line doc block, and turn it into a multi line doc block.
- updateDependsAnnotation() : Line
- Updates the depends tag on the current doc block.
- updateDocBlock() : array<int, Line>
- updateLines() : array<int, Line>
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 before NoEmptyPhpdocFixer, PhpUnitMethodCasingFixer, PhpdocTrimFixer.
Return values
intisRisky()
Check if fixer is risky or not.
public
isRisky() : bool
Risky fixer could change code behavior!
Return values
boolapplyPhpUnitClassFix()
protected
applyPhpUnitClassFix(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
- $tokens : Tokens
- $startIndex : int
- $endIndex : int
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfaceaddTestAnnotation()
private
addTestAnnotation(array<int, Line> $lines, Tokens $tokens, int $docBlockIndex) : array<int, Line>
Parameters
Return values
array<int, Line>addTestPrefix()
private
addTestPrefix(string $functionName) : string
Parameters
- $functionName : string
Return values
stringaddTestPrefixToDependsAnnotation()
private
addTestPrefixToDependsAnnotation(Line $line) : Line
Parameters
- $line : Line
Return values
LineapplyTestAnnotation()
private
applyTestAnnotation(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
- $tokens : Tokens
- $startIndex : int
- $endIndex : int
applyTestPrefix()
private
applyTestPrefix(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
- $tokens : Tokens
- $startIndex : int
- $endIndex : int
createDocBlock()
private
createDocBlock(Tokens $tokens, int $docBlockIndex) : void
Parameters
- $tokens : Tokens
- $docBlockIndex : int
doesDocBlockContainTest()
private
doesDocBlockContainTest(DocBlock $doc) : bool
Parameters
- $doc : DocBlock
Return values
boolfindWhereDependsFunctionNameStarts()
Helps to find where the function name in the doc block starts.
private
findWhereDependsFunctionNameStarts(array<int, string> $line) : int
Parameters
- $line : array<int, string>
Return values
intgetSingleLineDocBlockEntry()
private
getSingleLineDocBlockEntry(array<int, Line> $lines) : string
Parameters
- $lines : array<int, Line>
Tags
Return values
stringhasProperTestAnnotation()
private
hasProperTestAnnotation(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
boolhasTestPrefix()
private
hasTestPrefix(string $functionName) : bool
Parameters
- $functionName : string
Return values
boolisMethod()
private
isMethod(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
boolisTestMethod()
private
isTestMethod(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
boolremoveTestPrefix()
private
removeTestPrefix(string $functionName) : string
Parameters
- $functionName : string
Return values
stringremoveTestPrefixFromDependsAnnotation()
private
removeTestPrefixFromDependsAnnotation(Line $line) : Line
Parameters
- $line : Line
Return values
LinesplitUpDocBlock()
Take a one line doc block, and turn it into a multi line doc block.
private
splitUpDocBlock(array<int, Line> $lines, Tokens $tokens, int $docBlockIndex) : array<int, Line>
Parameters
Return values
array<int, Line>updateDependsAnnotation()
Updates the depends tag on the current doc block.
private
updateDependsAnnotation(Line $line) : Line
Parameters
- $line : Line
Return values
LineupdateDocBlock()
private
updateDocBlock(Tokens $tokens, int $docBlockIndex) : array<int, Line>
Parameters
- $tokens : Tokens
- $docBlockIndex : int
Return values
array<int, Line>updateLines()
private
updateLines(array<int, Line> $lines, Tokens $tokens, int $docBlockIndex) : array<int, Line>