Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class Autoload
/**
* The composer autoloader.
*
* @var \Composer\Autoload\ClassLoader
* @var \Composer\Autoload\ClassLoader|false|null The autoloader object or FALSE if no Composer autoloader could
* be found. NULL when this hasn't been determined yet.
*/
private static $composerAutoloader = null;

Expand Down
28 changes: 14 additions & 14 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,13 @@ public function cleanUp()
/**
* Records an error against a specific token in the file.
*
* @param string $error The error message.
* @param int $stackPtr The stack position where the error occurred.
* @param string $code A violation code unique to the sniff message.
* @param array $data Replacements for the error message.
* @param int $severity The severity level for this error. A value of 0
* will be converted into the default severity level.
* @param boolean $fixable Can the error be fixed by the sniff?
* @param string $error The error message.
* @param int|null $stackPtr The stack position where the error occurred.
* @param string $code A violation code unique to the sniff message.
* @param array $data Replacements for the error message.
* @param int $severity The severity level for this error. A value of 0
* will be converted into the default severity level.
* @param boolean $fixable Can the error be fixed by the sniff?
*
* @return boolean
*/
Expand Down Expand Up @@ -690,13 +690,13 @@ public function addError(
/**
* Records a warning against a specific token in the file.
*
* @param string $warning The error message.
* @param int $stackPtr The stack position where the error occurred.
* @param string $code A violation code unique to the sniff message.
* @param array $data Replacements for the warning message.
* @param int $severity The severity level for this warning. A value of 0
* will be converted into the default severity level.
* @param boolean $fixable Can the warning be fixed by the sniff?
* @param string $warning The error message.
* @param int|null $stackPtr The stack position where the error occurred.
* @param string $code A violation code unique to the sniff message.
* @param array $data Replacements for the warning message.
* @param int $severity The severity level for this warning. A value of 0
* will be converted into the default severity level.
* @param boolean $fixable Can the warning be fixed by the sniff?
*
* @return boolean
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function register()
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function setCliValues($testFile, $config)
*
* @param string $testFile The name of the file being tested.
*
* @return array(int => int)
* @return array<int, int>
*/
public function getErrorList($testFile='')
{
Expand Down Expand Up @@ -115,7 +115,7 @@ public function getErrorList($testFile='')
* 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.
*
* @return array(int => int)
* @return array<int, int>
*/
public function getWarningList()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class OneTraitPerFileUnitTest extends AbstractSniffUnitTest
* 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.
*
* @return array(int => int)
* @return array<int, int>
*/
public function getErrorList()
{
Expand All @@ -44,7 +44,7 @@ public function getErrorList()
* 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.
*
* @return array(int => int)
* @return array<int, int>
*/
public function getWarningList()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LongConditionClosingCommentSniff implements Sniff
/**
* The openers that we are interested in.
*
* @var integer[]
* @var array<int|string>
*/
private static $openers = [
T_SWITCH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ComparisonOperatorUsageSniff implements Sniff
/**
* A list of invalid operators with their alternatives.
*
* @var array<string, array<int, string>>
* @var array<string, array<int|string, string>>
*/
private static $invalidOps = [
'PHP' => [
Expand Down
14 changes: 7 additions & 7 deletions tests/Core/AbstractMethodUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ public static function assertTestMarkersAreUnique(File $phpcsFile)
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
* distinguish between comments used *in* a test and test delimiters.
*
* @param string $commentString The delimiter comment to look for.
* @param int|string|array $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
* @param string $commentString The delimiter comment to look for.
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
*
* @return int
*/
Expand All @@ -183,10 +183,10 @@ public function getTargetToken($commentString, $tokenType, $tokenContent=null)
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
* distinguish between comments used *in* a test and test delimiters.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file to find the token in.
* @param string $commentString The delimiter comment to look for.
* @param int|string|array $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file to find the token in.
* @param string $commentString The delimiter comment to look for.
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
*
* @return int
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Config/ExtensionsArgTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testValidExtensions($passedValue, $expected)
*
* @see self::testValidExtensions()
*
* @return array<int, array<string>>
* @return array<string, array<string, string|array<string, string>>>
*/
public static function dataValidExtensions()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Core/Config/GeneratorArgTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testValidGenerators($argumentValue, $expectedPropertyValue)
*
* @see self::testValidGenerators()
*
* @return array<int, array<string>>
* @return array<string, array<string, string>>
*/
public static function dataValidGeneratorNames()
{
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testInvalidGenerator($generatorName)
*
* @see self::testInvalidGenerator()
*
* @return array<int, array<string>>
* @return array<array<string>>
*/
public static function dataInvalidGeneratorNames()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/File/FindImplementedInterfaceNamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testFindImplementedInterfaceNames($identifier, $expected)
*
* @see testFindImplementedInterfaceNames()
*
* @return array<string, array<string, string|array<string>>>
* @return array<string, array<string, string|array<string>|false>>
*/
public static function dataImplementedInterface()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Core/Filters/AbstractFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ protected static function getFakeFileList()
* These type of tests should be able to run and pass on both *nix as well as Windows
* based dev systems. This method is a helper to allow for this.
*
* @param array<string|array> $paths A single or multi-dimensional array containing
* file paths.
* @param array<string|array<string>> $paths A single or multi-dimensional array containing
* file paths.
*
* @return array<string|array>
* @return array<string|array<string>>
*/
protected static function mapPathsToRuntimeOs(array $paths)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Filters/GitStagedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function testExecAlwaysReturnsArray($cmd, $expected)
* JRF: I've not managed to find a command which does so, let alone one, which then
* doesn't have side-effects of uncatchable output while running the tests.}
*
* @return array<string, array<string, array<string>>>
* @return array<string, array<string, string|array<string>>>
*/
public static function dataExecAlwaysReturnsArray()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/DisplayCachedMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function testNonBlockingErrorsGenerateOutput($messages, $expected)
*
* @see testNonBlockingErrorsGenerateOutput()
*
* @return array<string, array<string, string|array<string>>>
* @return array<string, array<string, string|array<string, int>>>
*/
public static function dataNonBlockingErrorsGenerateOutput()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/ProcessRulesetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function testRuleExcludeWithoutNameIsIgnored()
/**
* Test Helper.
*
* @return \PHP_CodeSniffer\Sniffs\Sniff
* @return \PHP_CodeSniffer\Ruleset
*/
private function getMiscRuleset()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Sniffs/AbstractArraySniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class AbstractArraySniffTest extends AbstractMethodUnitTest
* This extends the \PHP_CodeSniffer\Sniffs\AbstractArraySniff class to make the
* internal workings of the sniff observable.
*
* @var \PHP_CodeSniffer\Sniffs\AbstractArraySniffTestable
* @var \PHP_CodeSniffer\Tests\Core\Sniffs\AbstractArraySniffTestable
*/
protected static $sniff;

Expand Down
6 changes: 3 additions & 3 deletions tests/Core/Tokenizers/AbstractTokenizerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public function testTestMarkersAreUnique()
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
* distinguish between comments used *in* a test and test delimiters.
*
* @param string $commentString The delimiter comment to look for.
* @param int|string|array $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
* @param string $commentString The delimiter comment to look for.
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
* @param string $tokenContent Optional. The token content for the target token.
*
* @return int
*/
Expand Down
20 changes: 10 additions & 10 deletions tests/Core/Tokenizers/PHP/BackfillMatchTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,16 @@ public static function dataSwitchCaseVersusMatch()
* Helper function to verify that all scope related array indexes for a control structure
* are set correctly.
*
* @param string $token The control structure token to check.
* @param int $openerOffset The expected offset of the scope opener in relation to
* the control structure token.
* @param int $closerOffset The expected offset of the scope closer in relation to
* the control structure token.
* @param bool $skipScopeCloserCheck Whether to skip the scope closer check.
* This should be set to "true" when testing nested arrow functions,
* where the "inner" arrow function shares a scope closer with the
* "outer" arrow function, as the 'scope_condition' for the scope closer
* of the "inner" arrow function will point to the "outer" arrow function.
* @param int $token The control structure token to check.
* @param int $openerOffset The expected offset of the scope opener in relation to
* the control structure token.
* @param int $closerOffset The expected offset of the scope closer in relation to
* the control structure token.
* @param bool $skipScopeCloserCheck Whether to skip the scope closer check.
* This should be set to "true" when testing nested arrow functions,
* where the "inner" arrow function shares a scope closer with the
* "outer" arrow function, as the 'scope_condition' for the scope closer
* of the "inner" arrow function will point to the "outer" arrow function.
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function testKeywords($testMarker, $expectedTokenType)
*
* @see testKeywords()
*
* @return array
* @return array<string, array<string, string>>
*/
public static function dataKeywords()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Tokenizers/PHP/DNFTypesParseError1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testBrokenDNFTypeCantEndOnOpenParenthesis($testMarker)
*
* @see testBrokenDNFTypeCantEndOnOpenParenthesis()
*
* @return array<string, array<string, string>>
* @return array<string, array<string>>
*/
public static function dataBrokenDNFTypeCantEndOnOpenParenthesis()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens($te
*
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens()
*
* @return array<string, array<string, string>>
* @return array<string, array<string>>
*/
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens()
{
Expand Down Expand Up @@ -120,7 +120,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens($tes
*
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens()
*
* @return array<string, array<string, string>>
* @return array<string, array<string>>
*/
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens()
{
Expand Down Expand Up @@ -201,7 +201,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched($t
*
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched()
*
* @return array<string, array<string, string>>
* @return array<string, array<string>>
*/
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Tokenizers/PHP/DNFTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testNormalParentheses($testMarker, $skipCheckInside=false)
*
* @see testNormalParentheses()
*
* @return array<string, array<string, string|int|false>>
* @return array<string, array<string, string|bool>>
*/
public static function dataNormalParentheses()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testKeywords($testMarker, $expectedTokenType)
*
* @see testKeywords()
*
* @return array
* @return array<string, array<string, string>>
*/
public static function dataKeywords()
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Core/Tokenizers/PHP/TypedConstantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public static function dataTypedConstant()
*
* @see testTypedConstant()
*
* @return array<string, array<string, string>>
* @return array<string, array<string, string|array<int|string>>>
*/
public static function dataNullableTypedConstant()
{
Expand Down Expand Up @@ -386,7 +386,7 @@ public static function dataNullableTypedConstant()
*
* @see testTypedConstant()
*
* @return array<string, array<string, string>>
* @return array<string, array<string, string|array<int|string>>>
*/
public static function dataUnionTypedConstant()
{
Expand Down Expand Up @@ -475,7 +475,7 @@ public static function dataUnionTypedConstant()
*
* @see testTypedConstant()
*
* @return array<string, array<string, string>>
* @return array<string, array<string, string|array<int|string>>>
*/
public static function dataIntersectionTypedConstant()
{
Expand Down Expand Up @@ -520,7 +520,7 @@ public static function dataIntersectionTypedConstant()
*
* @see testTypedConstant()
*
* @return array<string, array<string, string>>
* @return array<string, array<string, string|array<int|string>>>
*/
public static function dataDNFTypedConstant()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testSwitchScope($testMarker, $expectedTokens, $testOpenerMarker=
*
* @see testSwitchScope()
*
* @return array<string, array<string, string|array<string, int|string>>>
* @return array<string, array<string, string|array<string, int|string>|null>>
*/
public static function dataSwitchScope()
{
Expand Down
Loading