\PHP_CodeSniffer\Standards\Generic\Tests\ArraysDisallowShortArraySyntaxUnitTest

Summary

Methods
Properties
Constants
testSniff()
generateFailureMessages()
setCliValues()
getErrorList()
getWarningList()
$standardsDir
$testsDir
No constants found
setUp()
getTestFiles()
shouldSkipTest()
$backupGlobals
N/A
No private methods found
No private properties found
N/A

Properties

$standardsDir

$standardsDir : string

The path to the standard's main directory.

Type

string

$testsDir

$testsDir : string

The path to the standard's test directory.

Type

string

$backupGlobals

$backupGlobals : boolean

Enable or disable the backup and restoration of the $GLOBALS array.

Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect!

Type

boolean

Methods

testSniff()

testSniff() : void

Tests the extending classes Sniff class.

Throws

\PHPUnit\Framework\Exception

generateFailureMessages()

generateFailureMessages(\PHP_CodeSniffer\Files\LocalFile  $file) : array

Generate a list of test failures for a given sniffed file.

Parameters

\PHP_CodeSniffer\Files\LocalFile $file

The file being tested.

Throws

\PHP_CodeSniffer\Exceptions\RuntimeException

Returns

array

setCliValues()

setCliValues(string  $filename, \PHP_CodeSniffer\Config  $config) : void

Get a list of CLI values to set before the file is tested.

Parameters

string $filename

The name of the file being tested.

\PHP_CodeSniffer\Config $config

The config data for the run.

getErrorList()

getErrorList() : \PHP_CodeSniffer\Standards\Generic\Tests\Arrays\array<int,

Returns the lines where errors should occur.

The key of the array should represent the line number and the value should represent the number of errors that should occur on that line.

Returns

\PHP_CodeSniffer\Standards\Generic\Tests\Arrays\arrayint>

getWarningList()

getWarningList() : \PHP_CodeSniffer\Standards\Generic\Tests\Arrays\array<int,

Returns the lines where warnings should occur.

The key of the array should represent the line number and the value should represent the number of warnings that should occur on that line.

Returns

\PHP_CodeSniffer\Standards\Generic\Tests\Arrays\arrayint>

setUp()

setUp() : void

Sets up this unit test.

getTestFiles()

getTestFiles(string  $testFileBase) : array<mixed,string>

Get a list of all test files to check.

These will have the same base as the sniff name but different extensions. We ignore the .php file as it is the class.

Parameters

string $testFileBase

The base path that the unit tests files will have.

Returns

array<mixed,string>

shouldSkipTest()

shouldSkipTest() : boolean

Should this test be skipped for some reason.

Returns

boolean