Documentation

PhpUnitDedicateAssertFixer extends AbstractPhpUnitFixer
in package
implements ConfigurableFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Dariusz Rumiński dariusz.ruminski@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ target?: '3.0'|'3.5'|'5.0'|'5.6'|'newest' }

phpstan-type

_AutogeneratedComputedConfiguration array{ target: '3.0'|'3.5'|'5.0'|'5.6'|'newest' }

Table of Contents

Interfaces

ConfigurableFixerInterface

Properties

$fixMap  : array<string, array{positive: string, negative: false|string, argument_count?: int, swap_arguments?: true}|true>
$functions  : array<int, string>

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
configurePostNormalisation()  : void
createConfigurationDefinition()  : FixerConfigurationResolverInterface
cloneAndClearTokens()  : array<int, Token>
fixAssertSameEquals()  : void
fixAssertTrueFalse()  : void
fixAssertTrueFalseInstanceof()  : bool
getPreviousAssertCall()  : iterable<string|int, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}>
removeFunctionCall()  : void
swapArguments()  : void

Properties

$fixMap

private static array<string, array{positive: string, negative: false|string, argument_count?: int, swap_arguments?: true}|true> $fixMap = ['array_key_exists' => ['positive' => 'assertArrayHasKey', 'negative' => 'assertArrayNotHasKey', 'argument_count' => 2], 'empty' => ['positive' => 'assertEmpty', 'negative' => 'assertNotEmpty'], 'file_exists' => ['positive' => 'assertFileExists', 'negative' => 'assertFileNotExists'], 'is_array' => true, 'is_bool' => true, 'is_callable' => true, 'is_dir' => ['positive' => 'assertDirectoryExists', 'negative' => 'assertDirectoryNotExists'], 'is_double' => true, 'is_float' => true, 'is_infinite' => ['positive' => 'assertInfinite', 'negative' => 'assertFinite'], 'is_int' => true, 'is_integer' => true, 'is_long' => true, 'is_nan' => ['positive' => 'assertNan', 'negative' => false], 'is_null' => ['positive' => 'assertNull', 'negative' => 'assertNotNull'], 'is_numeric' => true, 'is_object' => true, 'is_readable' => ['positive' => 'assertIsReadable', 'negative' => 'assertNotIsReadable'], 'is_real' => true, 'is_resource' => true, 'is_scalar' => true, 'is_string' => true, 'is_writable' => ['positive' => 'assertIsWritable', 'negative' => 'assertNotIsWritable'], 'str_contains' => [ // since 7.5 'positive' => 'assertStringContainsString', 'negative' => 'assertStringNotContainsString', 'argument_count' => 2, 'swap_arguments' => true, ], 'str_ends_with' => [ // since 3.4 'positive' => 'assertStringEndsWith', 'negative' => 'assertStringEndsNotWith', 'argument_count' => 2, 'swap_arguments' => true, ], 'str_starts_with' => [ // since 3.4 'positive' => 'assertStringStartsWith', 'negative' => 'assertStringStartsNotWith', 'argument_count' => 2, 'swap_arguments' => true, ]]

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before NoUnusedImportsFixer, PhpUnitDedicateAssertInternalTypeFixer. Must run after ModernizeStrposFixer, NoAliasFunctionsFixer, PhpUnitConstructFixer.

Return values
int

isRisky()

Check if fixer is risky or not.

public isRisky() : bool

Risky fixer could change code behavior!

Return values
bool

applyPhpUnitClassFix()

protected applyPhpUnitClassFix(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
$tokens : Tokens
$startIndex : int
$endIndex : int

fixAssertSameEquals()

private fixAssertSameEquals(Tokens $tokens, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int} $assertCall) : void
Parameters
$tokens : Tokens
$assertCall : array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}

fixAssertTrueFalse()

private fixAssertTrueFalse(Tokens $tokens, ArgumentsAnalyzer $argumentsAnalyzer, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int} $assertCall) : void
Parameters
$tokens : Tokens
$argumentsAnalyzer : ArgumentsAnalyzer
$assertCall : array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}

fixAssertTrueFalseInstanceof()

private fixAssertTrueFalseInstanceof(Tokens $tokens, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int} $assertCall, int $testIndex) : bool
Parameters
$tokens : Tokens
$assertCall : array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}
$testIndex : int
Return values
bool

getPreviousAssertCall()

private getPreviousAssertCall(Tokens $tokens, int $startIndex, int $endIndex) : iterable<string|int, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}>
Parameters
$tokens : Tokens
$startIndex : int
$endIndex : int
Return values
iterable<string|int, array{index: int, loweredName: string, openBraceIndex: int, closeBraceIndex: int}>

removeFunctionCall()

private removeFunctionCall(Tokens $tokens, int|null $callNSIndex, int $callIndex, int $openIndex, int $closeIndex) : void
Parameters
$tokens : Tokens
$callNSIndex : int|null
$callIndex : int
$openIndex : int
$closeIndex : int

        
On this page

Search results